| java.lang.Object org.netbeans.modules.mashup.db.common.Property
Property | public class Property implements Cloneable,Comparable(Code) | | Simple class to bind property key, type, current value, required flag and (optional)
default value information for a key-value property.
author: Jonathan Giron version: $Revision$ |
Constructor Summary | |
public | Property() | public | Property(String myKey, Class myType, boolean isRequired) Creates a new instance of Property with the given key name, type, and required
value flag. | public | Property(String myKey, Class myType, String myDefault, boolean isRefreshRequired) Creates a new instance of Property with the given key name, type, default value,
and required value flag. | public | Property(String myKey, Class myType, String myDefault) |
Method Summary | |
public Object | clone() Overrides default implementation to allow cloning of this instance. | public int | compareTo(Object o) Compares this object with the specified object for order. | public static Map | createKeyValueMapFrom(Map properties) Creates a Map of pure key-value mappings from the given Map of keys to Property
instances. | public boolean | equals(Object o) Overrides default implementation.
Parameters: o - Object to compare for equality against this instance. | public Object | getDefault() Gets default value, if any, for this property. | public String | getKeyValuePair() Gets key-value pair in canonical Java properties format, e.g., "key=value". | public String | getName() Gets name of this property. | public Class | getType() | public Object | getValue() | public boolean | getValueFrom(Map aMap) Gets key-value information from the given Map, provided that the value in the map
would be a valid value. | public int | hashCode() Overrides default implementation to compute its value based on member variables. | public boolean | isRefreshRequired() | public boolean | isRequired() Indicates whether this property requires a non-null, valid value. | public boolean | isValid() Indicates whether the current value of this property is valid, based on its type. | public boolean | isValidValue(Object aValue) Indicates whether the given value would be a valid value for this property. | public boolean | putValueTo(Map aMap) Puts key-value information to the given Map, provided that the value is valid. | public void | setDefault(String def) Sets default value, if any, for this property. | public void | setName(String newName) Sets name of this property. | public void | setRefresh(boolean isRefreshRequired) | public void | setRequired(String required) Sets whether this property requires a non-null, valid value. | public void | setType(String newType) Sets Java type of this property's value object. | public void | setValue(Object newValue) Sets current value of property to the given object. | public String | toString() Overrides default implementation to return value, if any, of this property. |
Property | public Property()(Code) | | Creates a new default instance of Property
|
Property | public Property(String myKey, Class myType, boolean isRequired)(Code) | | Creates a new instance of Property with the given key name, type, and required
value flag.
Parameters: myKey - key name Parameters: myType - value type Parameters: isRequired - true if required, false otherwise |
Property | public Property(String myKey, Class myType, String myDefault, boolean isRefreshRequired)(Code) | | Creates a new instance of Property with the given key name, type, default value,
and required value flag.
Parameters: myKey - key name Parameters: myType - value type Parameters: myDefault - default value Parameters: isRefreshRequired - true if required, false otherwise |
clone | public Object clone()(Code) | | Overrides default implementation to allow cloning of this instance.
clone of this instance |
compareTo | public int compareTo(Object o)(Code) | | Compares this object with the specified object for order. Returns a negative
integer, zero, or a positive integer as this object is less than, equal to, or
greater than the specified object.
Note: this class has a natural ordering that is inconsistent with equals.
Parameters: o - the Object to be compared. a negative integer, zero, or a positive integer as this object is lessthan, equal to, or greater than the specified object. throws: ClassCastException - if the specified object's type prevents it from beingcompared to this Object. |
createKeyValueMapFrom | public static Map createKeyValueMapFrom(Map properties)(Code) | | Creates a Map of pure key-value mappings from the given Map of keys to Property
instances. All other object classes are ignored.
Parameters: properties - Map of Property instances to be transformed new Map of simple key-value mappings, based on contents of properties |
equals | public boolean equals(Object o)(Code) | | Overrides default implementation.
Parameters: o - Object to compare for equality against this instance. true if o is equivalent to this, false otherwise |
getDefault | public Object getDefault()(Code) | | Gets default value, if any, for this property.
default value, or null if none is set. |
getKeyValuePair | public String getKeyValuePair()(Code) | | Gets key-value pair in canonical Java properties format, e.g., "key=value".
key-value pair in canonical Java properties format, or empty string ifcurrent value is invalid |
getName | public String getName()(Code) | | Gets name of this property.
name of this property |
getType | public Class getType()(Code) | | Gets property type
type |
getValue | public Object getValue()(Code) | | Gets current value of property
current value |
getValueFrom | public boolean getValueFrom(Map aMap)(Code) | | Gets key-value information from the given Map, provided that the value in the map
would be a valid value.
Parameters: aMap - Map from which to get this instance's key-value information true if key-value information is valid and get succeeded, false otherwise. |
hashCode | public int hashCode()(Code) | | Overrides default implementation to compute its value based on member variables.
computed hash code |
isRefreshRequired | public boolean isRefreshRequired()(Code) | | |
isRequired | public boolean isRequired()(Code) | | Indicates whether this property requires a non-null, valid value.
true if valid value is required, false otherwise |
isValid | public boolean isValid()(Code) | | Indicates whether the current value of this property is valid, based on its type.
true if valid, false otherwise. |
isValidValue | public boolean isValidValue(Object aValue)(Code) | | Indicates whether the given value would be a valid value for this property.
Parameters: aValue - value to test true if valid, false otherwise. |
putValueTo | public boolean putValueTo(Map aMap)(Code) | | Puts key-value information to the given Map, provided that the value is valid.
Parameters: aMap - Map to receive this instance's key-value information true if key-value information is valid and put succeeded, false otherwise. |
setDefault | public void setDefault(String def)(Code) | | Sets default value, if any, for this property.
Parameters: def - default value, or null for no default |
setName | public void setName(String newName)(Code) | | Sets name of this property.
Parameters: newName - new name of this property |
setRefresh | public void setRefresh(boolean isRefreshRequired)(Code) | | |
setRequired | public void setRequired(String required)(Code) | | Sets whether this property requires a non-null, valid value.
Parameters: required - true if valid value is required, false otherwise |
setType | public void setType(String newType)(Code) | | Sets Java type of this property's value object.
Parameters: newType - new type (e.g., Foo.class.getName() for instance of Foo) |
setValue | public void setValue(Object newValue)(Code) | | Sets current value of property to the given object. If newValue is null and this is
a required property, an IllegalArgumentException is thrown unless a default value
is defined. If newValue cannot be converted to this Property's given type, a
ClassCastException is thrown.
Parameters: newValue - new value of property. |
toString | public String toString()(Code) | | Overrides default implementation to return value, if any, of this property.
value of property, or null if no value currently exists |
|
|