You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2017/10/11 17:21:01 UTC

svn commit: r1811850 - /uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/util/Misc.java

Author: schor
Date: Wed Oct 11 17:21:01 2017
New Revision: 1811850

URL: http://svn.apache.org/viewvc?rev=1811850&view=rev
Log:
copy from v2 - for backwards compatibility

Added:
    uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/util/Misc.java

Added: uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/util/Misc.java
URL: http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/util/Misc.java?rev=1811850&view=auto
==============================================================================
--- uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/util/Misc.java (added)
+++ uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/util/Misc.java Wed Oct 11 17:21:01 2017
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.util;
+
+// not used in v3, kept for backwards compatibility
+public class Misc {
+
+  /**
+   * 
+   * @param name of property
+   * @return true if property is defined, or is defined and set to anything 
+   * except "false"; false if property is not defined, or is defined and set to
+   * "false".
+   */
+  public static boolean getNoValueSystemProperty(String name) {
+    return !System.getProperty(name, "false").equals("false");
+  }
+  
+//  public static void main(String[] args) {
+//    System.out.println("should be false - not defined: " + getNoValueSystemProperty("foo"));
+//    System.setProperty("foo", "");
+//    System.out.println("should be true - defined, 0 len str value: " + getNoValueSystemProperty("foo"));
+//    System.setProperty("foo", "true");
+//    System.out.println("should be true - defined, true value: " + getNoValueSystemProperty("foo"));
+//    System.setProperty("foo", "zzz");
+//    System.out.println("should be true - defined, zzz value: " + getNoValueSystemProperty("foo"));
+//    System.setProperty("foo", "false");
+//    System.out.println("should be false - defined, false value: " + getNoValueSystemProperty("foo"));
+//  }
+}