|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.novell.nds.dirxml.driver.xds.Parameter
A convenience class used to extract values from a ParamElement.
All parameters are implicitly constrained to have unique tag names in the
scope in which they are used. By default, <password> is
content sensitive.
Usage examples:
//non-negative (0...Integer.MAX_VALUE); required
RangeConstraint range;
range = new RangeConstraint(0,EqualityOp.GTE);
param = new Parameter("non-negative", "default value", DataType.INT);
param.add(RequiredConstraint.REQUIRED);
param.add(range);
//enumeration of legal values; optional
EnumConstraint enum;
enum = new EnumConstraint();
enum.addLiteral("first");
enum.addLiteral("second");
enum.addLiteral("third");
param = new Parameter("enumeration", "first", DataType.STRING);
param.add(enum);
//complex param; (1...4) or (6...10)
ConstraintGroup complex;
complex = new ConstraintGroup();
range = new RangeConstraint(1, 4);
complex.add(range);
range = new RangeConstraint(6, 10);
complex.add(range);
param = new Parameter("complex", "1", DataType.INT);
param.add(RequiredConstraint.REQUIRED);
param.add(complex);
| Field Summary | |
static int |
INSTANCE_ID_NONE
|
| Constructor Summary | |
Parameter(String someTagName,
Parameter defaultValue,
boolean inheritConstraints)
Creates a new Parameter object. |
|
Parameter(String someTagName,
String defaultValue,
DataType someType)
Creates a new parameter instance. |
|
| Method Summary | |
void |
add(Constraint someConstraint)
Adds a contraint to this parameter. |
void |
add(Parameter p)
Adds a member parameter to this parameter. |
void |
addIsSetWhen(Parameter p)
Indicates which member parameters of a structured parameter have to hav values before this parameter is evaluated. |
Object |
clone()
Clones this parameter. |
Object |
clone(String tagName)
Clones this parameter. |
int |
compareTo(Object o)
Compares this parameter's tag name to someParam's tag name. |
boolean |
equals(Object o)
Is the passed parameter equal to this parameter? |
int |
getInstanceID()
Returns the unique instance ID for this parameter. |
Parameter |
getNext()
Returns the next parameter if this parameter is multi-valued. |
Parameter |
getParameter(String tagName)
Returns a member parameter by tagname. |
Collection |
getParameters()
Returns all member parameters. |
DataType |
getType()
Returns the data type of this parameter. |
boolean |
hasContent()
Do any of the XML elements comprising this parameter have child nodes? |
int |
hashCode()
Returns this parameter's hashcode. |
boolean |
hasValue(Object o)
|
boolean |
hasValues()
Does this parameter or any of its member parameters have values? |
boolean |
isContentSensitive()
Is this parameter's value content sensitive? |
boolean |
isMultiValued()
Is this parameter multi-valued? |
boolean |
isScalar()
Is this a scalar parameter? |
boolean |
isSet()
Indicates whether this parameter is set. |
boolean |
isSingleValued()
Is this parameter single-valued? |
boolean |
isStructured()
Is this a structured parameter? |
void |
overrideDefault(Parameter override,
boolean inheritConstraints)
Overrides the default value of this parameter. |
void |
overrideValue(Object someValue)
Overrides this parameter's value to the value actually used by the driver. |
void |
overrideValue(String someValue)
Overrides this parameter's value to the value actually used by the driver. |
ParamElement |
paramElement()
Returns the ParamElement that corresponds to this
parameter. |
List |
paramElements()
Returns the DOM elements comprising this parameter. |
String |
qualifiedTagName()
Returns the tagname and all parent parameters tagnames (if any). |
void |
setContentSensitive()
Marks this parameter as content sensitive. |
String |
tagName()
Returns the tagname of this parameter. |
Boolean |
toBoolean()
Returns this parameter's value as a Boolean. |
Character |
toCharacter()
Returns this parameter's value as a Character. |
Double |
toDouble()
Returns this parameter's value as a Double. |
Float |
toFloat()
Returns this parameter's value as a Float. |
Integer |
toInteger()
Returns this parameter's value as an Integer. |
List |
toList()
Returns this parameter's values as a list. |
Long |
toLong()
Returns this parameter's value as a Long. |
Number |
toNumber()
Returns this parameter's value as a Number. |
Short |
toShort()
Returns this parameter's value as a Short. |
String |
toString()
Returns this parameter's value as a String. |
| Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static int INSTANCE_ID_NONE
| Constructor Detail |
public Parameter(String someTagName,
String defaultValue,
DataType someType)
defaultValue adhere's to any subsequently applied
constraints. Therefore, it is not validated.
someTagName - this parameter's tag name; must not be
null or ""defaultValue - default value (optional); may be null
or ""someType - data type constraint; must not be null
public Parameter(String someTagName,
Parameter defaultValue,
boolean inheritConstraints)
someTagName - this parameter's tag name; must not be
null or ""defaultValue - default value (optional); may be null
or ""inheritConstraints - should this parameter inherit the passed default parameter's constraints?| Method Detail |
public void addIsSetWhen(Parameter p)
p - may be null
IllegalArgumentException - if this parameter is not structured or
the passed parameter is not a member of this parameterpublic DataType getType()
nullpublic void setContentSensitive()
public boolean isSet()
trueaddIsSetWhen(Parameter)public boolean hasContent()
true if they do; false otherwisepublic boolean hasValues()
true if they do; false otherwisepublic boolean isStructured()
true if it is; false otherwisepublic boolean isScalar()
true if it is; false otherwisepublic boolean isSingleValued()
true if it is; false otherwisepublic boolean isMultiValued()
true if it is; false otherwisepublic int getInstanceID()
public Parameter getParameter(String tagName)
tagName - may be null
nullpublic Collection getParameters()
nullpublic void add(Parameter p)
p - may be null
IllegalArgumentException - if this is a scalar parameter or a
member of this parameter or any member parameters it containspublic boolean isContentSensitive()
By default password elements are content sensitive.
true:false:public boolean hasValue(Object o)
public void add(Constraint someConstraint)
someConstraint - must not be null; each constraint
must be added only oncepublic ParamElement paramElement()
ParamElement that corresponds to this
parameter. This method should be called after this parameter has been
extracted.
null; will not return null
if this parameter has a RequiredConstraint and is
called after parameters have been extractedpublic List paramElements()
nullpublic String tagName()
nullpublic String qualifiedTagName()
nullpublic void overrideValue(String someValue)
someValue - may be nullpublic void overrideValue(Object someValue)
someValue - may be null
public void overrideDefault(Parameter override,
boolean inheritConstraints)
override - may be nullinheritConstraints - should the passed parameter's constrains be inherited
by this parameter?
IllegalStateException - if this parameter doesn't already have a default value
IllegalArgumentException - if the passed parameter doesn't have the same type and constraints as the
current defaultpublic Character toCharacter()
Character.
null if a default value is provided
or this parameter has a RequiredConstraint
IllegalStateException - if this parameter's data type is not
DataType.CHARpublic Short toShort()
Short.
null if a default value is provided
or this parameter has a RequiredConstraint
IllegalStateException - if this parameter's data type is not
DataType.SHORTpublic Integer toInteger()
Integer.
null if a default value is provided
or this parameter has a RequiredConstraint
IllegalStateException - if this parameter's data type is not
DataType.INTpublic Long toLong()
Long.
null if a default value is provided
or this parameter has a RequiredConstraint
IllegalStateException - if this parameter's data type is not
DataType.LONGpublic Float toFloat()
Float.
null if a default value is provided
or this parameter has a RequiredConstraint
IllegalStateException - if this parameter's data type is not
DataType.FLOATpublic Double toDouble()
Double.
null if a default value is provided
or this parameter has a RequiredConstraint
IllegalStateException - if this parameter's data type is not
DataType.DOUBLEpublic Number toNumber()
Number.
null if a default value is provided
or this parameter has a RequiredConstraint
IllegalStateException - if this parameter's data type is not
DataType SHORT,
DataType INT,
DataType LONG,
DataType FLOAT or
DataType.DOUBLEpublic Boolean toBoolean()
Boolean.
null if a default value is provided
or this parameter has a RequiredConstraint
IllegalStateException - if this parameter's data type is not
DataType.BOOLEANpublic String toString()
String.
null if a default value is provided
or this parameter has a RequiredConstraintpublic List toList()
nullpublic Parameter getNext()
nullpublic int compareTo(Object o)
someParam's tag name.
compareTo in interface Comparableo - must not be null
XDS.LESS_THAN:someParam'sXDS.EQUAL:someParam'sXDS.GREATER_THAN:someParam'spublic int hashCode()
public boolean equals(Object o)
o - may be null
true if they're equal; false if they're notpublic Object clone(String tagName)
tagName - the new tagName; must not be null
nullpublic Object clone()
null
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||