jgroup.experiment
Class PropertyDefinition

java.lang.Object
  extended by jgroup.experiment.PropertyDefinition

public class PropertyDefinition
extends java.lang.Object

An instance of class PropertyDefinition contains information about valid values for a named property. The constructors of PropertyDefinition usually take a property name, the type of property, and the valid values of the property, as parameters. If the valid values are not given, all values are valid, as long as they are of the given type.
Valid types are boolean, String, int, Integer and Range, or an array of these types. The list of valid values is also passed as an array of one of these types. Each type is represented by a member constant according to this list:

boolean PropertyDefinition.BOOLEAN_TYPE
String PropertyDefinition.STRING_TYPE
int PropertyDefinition.INT_TYPE
Integer PropertyDefinition.INTEGER_TYPE
Range PropertyDefinition.RANGE_TYPE

Author:
Bjarte Svaeren

Field Summary
static int BOOLEAN_ARRAY_TYPE
           
static int BOOLEAN_TYPE
           
static int INT_ARRAY_TYPE
           
static int INT_TYPE
           
static int INTEGER_ARRAY_TYPE
           
static int INTEGER_TYPE
           
static int RANGE_ARRAY_TYPE
           
static int RANGE_TYPE
           
static int STRING_ARRAY_TYPE
           
static int STRING_TYPE
           
 
Constructor Summary
PropertyDefinition(java.lang.String name, int type)
          Creates a PropertyDefinition object with the specified name and type, with no restrictions on value.
PropertyDefinition(java.lang.String name, int type, int[] values)
          Creates a PropertyDefinition object of type int, with the specified name.
PropertyDefinition(java.lang.String name, int type, java.lang.Object[] values)
          Creates a PropertyDefinition object with the specified name and type.
 
Method Summary
 java.lang.String getPropertyName()
          Returns the name of the property as a String.
 int getPropertyType()
          Returns the type of the property as one of the constants from the list above.
 boolean isValid(boolean value)
          Returns true if boolean is a valid type for this property, otherwise it returns false.
 boolean isValid(int value)
          Returns true if the int is a valid type for this property, and has a valid value.
 boolean isValid(java.lang.Object value)
          Returns true if the value is a valid type for this property, and has a valid value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BOOLEAN_TYPE

public static final int BOOLEAN_TYPE
See Also:
Constant Field Values

STRING_TYPE

public static final int STRING_TYPE
See Also:
Constant Field Values

INT_TYPE

public static final int INT_TYPE
See Also:
Constant Field Values

INTEGER_TYPE

public static final int INTEGER_TYPE
See Also:
Constant Field Values

RANGE_TYPE

public static final int RANGE_TYPE
See Also:
Constant Field Values

BOOLEAN_ARRAY_TYPE

public static final int BOOLEAN_ARRAY_TYPE
See Also:
Constant Field Values

STRING_ARRAY_TYPE

public static final int STRING_ARRAY_TYPE
See Also:
Constant Field Values

INT_ARRAY_TYPE

public static final int INT_ARRAY_TYPE
See Also:
Constant Field Values

INTEGER_ARRAY_TYPE

public static final int INTEGER_ARRAY_TYPE
See Also:
Constant Field Values

RANGE_ARRAY_TYPE

public static final int RANGE_ARRAY_TYPE
See Also:
Constant Field Values
Constructor Detail

PropertyDefinition

public PropertyDefinition(java.lang.String name,
                          int type)
Creates a PropertyDefinition object with the specified name and type, with no restrictions on value. If the property is of type boolean, only this constructor can be used. boolean values cannot be restriced more than the implicit 'true' and 'false'. type has to be one of the member constants listed above.

Parameters:
name - The name of the property
type - The type of the property

PropertyDefinition

public PropertyDefinition(java.lang.String name,
                          int type,
                          java.lang.Object[] values)
Creates a PropertyDefinition object with the specified name and type. The valid values will be interpreted according to the type of the property.

Parameters:
name - The name of the property
type - The type of the property
validValues - The valid values of the property

PropertyDefinition

public PropertyDefinition(java.lang.String name,
                          int type,
                          int[] values)
Creates a PropertyDefinition object of type int, with the specified name. The valid values will be interpreted accordingly.

Parameters:
name - The name of the property
type - The type of the property
validValues - The valid values of the property
Method Detail

getPropertyName

public java.lang.String getPropertyName()
Returns the name of the property as a String.

Returns:
The name of the property

getPropertyType

public int getPropertyType()
Returns the type of the property as one of the constants from the list above.

Returns:
The type of the property

isValid

public boolean isValid(java.lang.Object value)
Returns true if the value is a valid type for this property, and has a valid value. Otherwise it returns false.

Parameters:
value - The value to check.
Returns:
True if the value is valid, false if it's not.

isValid

public boolean isValid(int value)
Returns true if the int is a valid type for this property, and has a valid value. Otherwise, it returns false.

Parameters:
value - The value to check.
Returns:
True if the value is valid, false if it's not.

isValid

public boolean isValid(boolean value)
Returns true if boolean is a valid type for this property, otherwise it returns false.

Parameters:
value - The value to check.
Returns:
True if the value is valid, false if it's not.


Copyright © 1998-2006 The Jgroup/ARM development team. All Rights Reserved.