1 23 package org.archive.util; 24 25 29 public class PropertyUtils { 30 34 public static String getPropertyOrNull(final String key) { 35 String value = System.getProperty(key); 36 return (value == null || value.length() <= 0)? null: value; 37 } 38 39 43 public static boolean getBooleanProperty(final String key) { 44 return (getPropertyOrNull(key) == null)? 45 false: Boolean.valueOf(getPropertyOrNull(key)).booleanValue(); 46 } 47 48 54 public static int getIntProperty(final String key, final int fallback) { 55 return getPropertyOrNull(key) == null? 56 fallback: Integer.parseInt(getPropertyOrNull(key)); 57 } 58 } 59 | Popular Tags |