org.hecl
Class Properties
- java.lang.Object
-
- org.hecl.Properties
-
- Direct Known Subclasses:
- MethodProps
public class Properties extends java.lang.ObjectThePropertiesclass is used to parse command line arguments. Its basic usage pattern is like so: a new Properties is instantiated with default properties and values, then setProps is called with argv. At that point the rest of the command can go on, and for every prop that's needed, it can be fetched with getProp.
-
-
Constructor Summary
Constructors Constructor and Description Properties()Creates a newPropertiesinstance with no default properties.Properties(java.lang.Object[] defaultprops)Creates a newPropertiesinstance with default properties and their values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voiddelProp(java.lang.String name)delPropremoves a property from the property set.booleanexistsProp(java.lang.String name)TheexistsPropmethod is used to determine if a property exists or not.ThinggetAndDelProp(java.lang.String name)ThegetAndDelPropmethod fetches and deletes the value associated with 'name', or returns null if there is no value associated with it.ThinggetProp(java.lang.String name)ThegetPropmethod fetches the value of a property.ThinggetProp(java.lang.String name, Thing defaultVal)ThegetPropmethod with two arguments fetches the value of the property given by 'name', or, if that does not exist, returns a default value.Thing[]getProps()getPropsconverts the properties back into an array ofThings.booleanisEmpty()isEmptytest if property set is empty.voidsetProp(java.lang.String name, Thing val)ThesetPropmethod sets a single property to some value.voidsetProps(Thing[] argv, int offset)ThesetPropsmethod sets properties with their values from the command line argv.
-
-
-
Constructor Detail
-
Properties
public Properties()
Creates a newPropertiesinstance with no default properties.
-
Properties
public Properties(java.lang.Object[] defaultprops)
Creates a newPropertiesinstance with default properties and their values.- Parameters:
defaultprops- anObject[]value
-
-
Method Detail
-
setProps
public void setProps(Thing[] argv, int offset) throws HeclException
ThesetPropsmethod sets properties with their values from the command line argv. The number of Things handled must be even.- Parameters:
argv- aThing[]valueoffset- anintvalue- Throws:
HeclException- if an error occurs
-
setProp
public void setProp(java.lang.String name, Thing val)ThesetPropmethod sets a single property to some value.- Parameters:
name- aStringvalueval- aThingvalue
-
getProp
public Thing getProp(java.lang.String name)
ThegetPropmethod fetches the value of a property.- Parameters:
name- aStringvalue- Returns:
- a
Thingvalue
-
getProp
public Thing getProp(java.lang.String name, Thing defaultVal)
ThegetPropmethod with two arguments fetches the value of the property given by 'name', or, if that does not exist, returns a default value.- Parameters:
name- aStringvaluedefaultVal- aThingvalue- Returns:
- a
Thingvalue
-
existsProp
public boolean existsProp(java.lang.String name)
TheexistsPropmethod is used to determine if a property exists or not.- Parameters:
name- aStringvalue- Returns:
- a
booleanvalue
-
getAndDelProp
public Thing getAndDelProp(java.lang.String name)
ThegetAndDelPropmethod fetches and deletes the value associated with 'name', or returns null if there is no value associated with it.- Parameters:
name- aStringvalue- Returns:
- a
Thingvalue
-
delProp
public void delProp(java.lang.String name)
delPropremoves a property from the property set.- Parameters:
name- aStringvalue
-
getProps
public Thing[] getProps()
getPropsconverts the properties back into an array ofThings.- Returns:
- an array of
Things, being property name and property value.
-
isEmpty
public boolean isEmpty()
isEmptytest if property set is empty.- Returns:
- true if it's empty, flase otherwise.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG