tig
Class TigProperties
- java.lang.Object
-
- java.util.Dictionary<K,V>
-
- java.util.Hashtable<java.lang.Object,java.lang.Object>
-
- java.util.Properties
-
- tig.TigProperties
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.Object,java.lang.Object>
public class TigProperties extends java.util.PropertiesSuperclass for Preferences classes.
ThegetXxxProperty()method behave like methodgetProperty(String key), inherited fromPropertiesclass : if the property can't be correctly retrieved, an exception is thrown.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description TigProperties()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleangetBooleanProperty(java.lang.String key)Returns a property of typeboolean.booleangetBooleanProperty(java.lang.String key, boolean defaultValue)Returns a property of typeboolean.doublegetDoubleProperty(java.lang.String key)Returns a property of typedouble.doublegetDoubleProperty(java.lang.String key, double defaultValue)Returns a property of typedouble.int[]getIntArrayProperty(java.lang.String key)Returns a property of typeint[].int[]getIntArrayProperty(java.lang.String key, int[] defaultValue)Returns a property of typeint[].static intgetIntConstant(java.lang.String constantName, java.lang.String className)Convenient method to get astatic final intfield of a class, using reflection.intgetIntProperty(java.lang.String key)Returns a property of typeint.intgetIntProperty(java.lang.String key, int defaultValue)Returns a property of typeint.voidsetBooleanProperty(java.lang.String key, boolean booleanValue)Sets a property of typeboolean.voidsetDoubleProperty(java.lang.String key, double doubleValue)Sets a property of typedouble.voidsetIntArrayProperty(java.lang.String key, int[] intArray)Sets a property of typeint[].voidsetIntProperty(java.lang.String key, int intValue)Sets a property of typeint.-
Methods inherited from class java.util.Properties
getProperty, getProperty, list, list, load, load, loadFromXML, propertyNames, save, setProperty, store, store, storeToXML, storeToXML, stringPropertyNames
-
Methods inherited from class java.util.Hashtable
clear, clone, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keys, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, toString, values
-
-
-
-
Method Detail
-
getIntConstant
public static int getIntConstant(java.lang.String constantName, java.lang.String className)Convenient method to get astatic final intfield of a class, using reflection.
For example, if you have this piece of code in a class :package mypackage; public class MyClass{ public static final int MY_CONSTANT = 8; }The call :TigBundle.getIntConstant("My_CONSTANT", "mypackage.MyClass");will then return 8.- Throws:
java.lang.RuntimeException- If the property can't be correctly retrieved.
-
getIntProperty
public int getIntProperty(java.lang.String key)
Returns a property of typeint.- Throws:
java.lang.NumberFormatException- If the property can't be retrieved, or can't be converted to an integer.
-
getIntProperty
public int getIntProperty(java.lang.String key, int defaultValue)Returns a property of typeint.
If the property can't be retrieved, or can't be converted to an integer, the default value is returned.
-
setIntProperty
public void setIntProperty(java.lang.String key, int intValue)Sets a property of typeint.
-
getDoubleProperty
public double getDoubleProperty(java.lang.String key)
Returns a property of typedouble.
If the property can't be retrieved, or if it can't be converted to a double,nullis returned.
-
getDoubleProperty
public double getDoubleProperty(java.lang.String key, double defaultValue)Returns a property of typedouble.
If the property can't be retrieved, or can't be converted to a double, the default value is returned.
-
setDoubleProperty
public void setDoubleProperty(java.lang.String key, double doubleValue)Sets a property of typedouble.
-
getBooleanProperty
public boolean getBooleanProperty(java.lang.String key)
Returns a property of typeboolean.- Returns
trueif the property exists and equals (ignoring case) to "true".- Returns
falseif the property exists and equals (ignoring case) to "false".- A
RuntimeExceptionis thrown otherwise. - Returns
-
getBooleanProperty
public boolean getBooleanProperty(java.lang.String key, boolean defaultValue)Returns a property of typeboolean.- Returns
trueif the property exists and equals (ignoring case) to "true".- Returns
falseif the property exists and equals (ignoring case) to "false".- 'defaultValue' is returned otherwise.
- Returns
-
setBooleanProperty
public void setBooleanProperty(java.lang.String key, boolean booleanValue)Sets a property of typeboolean.
-
getIntArrayProperty
public int[] getIntArrayProperty(java.lang.String key)
Returns a property of typeint[].
Thevaluecorresponding tokeyis a Sting, and must contain a list of substrings which can be parsed to integers, and separated by comas.
For example,"12, 23, 34"is a correct value.- Throws:
java.lang.RuntimeException- If the property corresponding to 'key' can't be parsed that way.
-
getIntArrayProperty
public int[] getIntArrayProperty(java.lang.String key, int[] defaultValue)Returns a property of typeint[].
Thevaluecorresponding tokeyis a Sting, and must contain a list of substrings which can be parsed to integers, and separated by comas.
For example,"12, 23, 34"is a correct value.
If the property corresponding to 'key' can't be parsed that way, 'defaultValue' is returned.
-
setIntArrayProperty
public void setIntArrayProperty(java.lang.String key, int[] intArray)Sets a property of typeint[].
Theint[]is transformed to a String.
Ex : if 'intArray' contains 1, 4, 7 and 5, it will be stored as "1, 4, 7, 5".int[]stored this way can be retrived withgetIntArrayProperty(String)
-
-
DMelt 3.0 © DataMelt by jWork.ORG