Package org.quartz.utils
Class PropertiesParser
- java.lang.Object
-
- org.quartz.utils.PropertiesParser
-
public class PropertiesParser extends java.lang.Object
This is an utility calss used to parse the properties.
- Author:
- James House
-
-
Constructor Summary
Constructors Constructor Description PropertiesParser(java.util.Properties props)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
getBooleanProperty(java.lang.String name)
boolean
getBooleanProperty(java.lang.String name, boolean def)
byte
getByteProperty(java.lang.String name)
byte
getByteProperty(java.lang.String name, byte def)
char
getCharProperty(java.lang.String name)
char
getCharProperty(java.lang.String name, char def)
double
getDoubleProperty(java.lang.String name)
double
getDoubleProperty(java.lang.String name, double def)
float
getFloatProperty(java.lang.String name)
float
getFloatProperty(java.lang.String name, float def)
int[]
getIntArrayProperty(java.lang.String name)
int[]
getIntArrayProperty(java.lang.String name, int[] def)
int
getIntProperty(java.lang.String name)
int
getIntProperty(java.lang.String name, int def)
long
getLongProperty(java.lang.String name)
long
getLongProperty(java.lang.String name, long def)
java.util.Properties
getPropertyGroup(java.lang.String prefix)
java.util.Properties
getPropertyGroup(java.lang.String prefix, boolean stripPrefix)
java.util.Properties
getPropertyGroup(java.lang.String prefix, boolean stripPrefix, java.lang.String[] excludedPrefixes)
Get all properties that start with the given prefix.java.lang.String[]
getPropertyGroups(java.lang.String prefix)
short
getShortProperty(java.lang.String name)
short
getShortProperty(java.lang.String name, short def)
java.lang.String[]
getStringArrayProperty(java.lang.String name)
java.lang.String[]
getStringArrayProperty(java.lang.String name, java.lang.String[] def)
java.lang.String
getStringProperty(java.lang.String name)
Get the trimmed String value of the property with the givenname
.java.lang.String
getStringProperty(java.lang.String name, java.lang.String def)
Get the trimmed String value of the property with the givenname
or the given default value if the value is null or empty after trimming.java.util.Properties
getUnderlyingProperties()
-
-
-
Method Detail
-
getUnderlyingProperties
public java.util.Properties getUnderlyingProperties()
-
getStringProperty
public java.lang.String getStringProperty(java.lang.String name)
Get the trimmed String value of the property with the givenname
. If the value the empty String (after trimming), then it returns null.
-
getStringProperty
public java.lang.String getStringProperty(java.lang.String name, java.lang.String def)
Get the trimmed String value of the property with the givenname
or the given default value if the value is null or empty after trimming.
-
getStringArrayProperty
public java.lang.String[] getStringArrayProperty(java.lang.String name)
-
getStringArrayProperty
public java.lang.String[] getStringArrayProperty(java.lang.String name, java.lang.String[] def)
-
getBooleanProperty
public boolean getBooleanProperty(java.lang.String name)
-
getBooleanProperty
public boolean getBooleanProperty(java.lang.String name, boolean def)
-
getByteProperty
public byte getByteProperty(java.lang.String name) throws java.lang.NumberFormatException
- Throws:
java.lang.NumberFormatException
-
getByteProperty
public byte getByteProperty(java.lang.String name, byte def) throws java.lang.NumberFormatException
- Throws:
java.lang.NumberFormatException
-
getCharProperty
public char getCharProperty(java.lang.String name)
-
getCharProperty
public char getCharProperty(java.lang.String name, char def)
-
getDoubleProperty
public double getDoubleProperty(java.lang.String name) throws java.lang.NumberFormatException
- Throws:
java.lang.NumberFormatException
-
getDoubleProperty
public double getDoubleProperty(java.lang.String name, double def) throws java.lang.NumberFormatException
- Throws:
java.lang.NumberFormatException
-
getFloatProperty
public float getFloatProperty(java.lang.String name) throws java.lang.NumberFormatException
- Throws:
java.lang.NumberFormatException
-
getFloatProperty
public float getFloatProperty(java.lang.String name, float def) throws java.lang.NumberFormatException
- Throws:
java.lang.NumberFormatException
-
getIntProperty
public int getIntProperty(java.lang.String name) throws java.lang.NumberFormatException
- Throws:
java.lang.NumberFormatException
-
getIntProperty
public int getIntProperty(java.lang.String name, int def) throws java.lang.NumberFormatException
- Throws:
java.lang.NumberFormatException
-
getIntArrayProperty
public int[] getIntArrayProperty(java.lang.String name) throws java.lang.NumberFormatException
- Throws:
java.lang.NumberFormatException
-
getIntArrayProperty
public int[] getIntArrayProperty(java.lang.String name, int[] def) throws java.lang.NumberFormatException
- Throws:
java.lang.NumberFormatException
-
getLongProperty
public long getLongProperty(java.lang.String name) throws java.lang.NumberFormatException
- Throws:
java.lang.NumberFormatException
-
getLongProperty
public long getLongProperty(java.lang.String name, long def) throws java.lang.NumberFormatException
- Throws:
java.lang.NumberFormatException
-
getShortProperty
public short getShortProperty(java.lang.String name) throws java.lang.NumberFormatException
- Throws:
java.lang.NumberFormatException
-
getShortProperty
public short getShortProperty(java.lang.String name, short def) throws java.lang.NumberFormatException
- Throws:
java.lang.NumberFormatException
-
getPropertyGroups
public java.lang.String[] getPropertyGroups(java.lang.String prefix)
-
getPropertyGroup
public java.util.Properties getPropertyGroup(java.lang.String prefix)
-
getPropertyGroup
public java.util.Properties getPropertyGroup(java.lang.String prefix, boolean stripPrefix)
-
getPropertyGroup
public java.util.Properties getPropertyGroup(java.lang.String prefix, boolean stripPrefix, java.lang.String[] excludedPrefixes)
Get all properties that start with the given prefix.- Parameters:
prefix
- The prefix for which to search. If it does not end in a "." then one will be added to it for search purposes.stripPrefix
- Whether to strip off the givenprefix
in the result's keys.excludedPrefixes
- Optional array of fully qualified prefixes to exclude. For example ifprefix
is "a.b.c", thenexcludedPrefixes
might be "a.b.c.ignore".- Returns:
- Group of
Properties
that start with the given prefix, optionally have that prefix removed, and do not include properties that start with one of the given excluded prefixes.
-
-