|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.enhydra.zeus.binding.BaseBinding | +--org.enhydra.zeus.binding.BaseProperty
implements the Property
interface and defines behavior for a property of a Java class.
These properties have modifiers, types, and names, as well
as a value.
Binding
This base implementation of Property
defines the common
functionality for all Property
implementations, removing
a need for them to duplicate code for this functionality. All
implementations of Property
should extend this class
rather than directly implementing the Property
interface.
Field Summary | |
protected java.lang.Object |
defaultValue
The default value for this Property |
protected java.util.Vector |
enumeration
The allowed values for this Property |
protected boolean |
isCollection
Whether this Property is a Collection |
protected java.util.BitSet |
modifier
The access level modifier for this Property |
Fields inherited from class org.enhydra.zeus.binding.BaseBinding |
isJavaSerializable, isXMLRootElement, javaCollectionClass, javaImplementationPackage, javaInterfacePackage, javaName, javaType, javaVariableName, xmlName, xmlNamespaceURI, xmlParentType, xmlParentTypeNamespaceURI, xmlType, xmlTypeNamespaceURI |
Fields inherited from interface org.enhydra.zeus.binding.Property |
ACCESS_PRIVATE, ACCESS_PROTECTED, ACCESS_PUBLIC, MUTABILITY_FINAL, MUTABILITY_SYNCHRONIZED, MUTABILITY_TRANSIENT, MUTABILITY_VOLATILE, SOURCE_ATTLIST, SOURCE_ELEMENT, STORAGE_STATIC |
Constructor Summary | |
BaseProperty()
|
Method Summary | |
void |
BaseProperty()
Default constructor. |
java.lang.Object |
getDefaultValue()
This will retrieve the default value associated with this property, or null if there is not one. |
java.util.Vector |
getEnumeration()
This returns the Vector of allowed values for this
Property , or null if there is none. |
java.util.BitSet |
getModifier()
This will return the access level modifier for a property. |
java.lang.String |
getModifierString()
This will return the Java String representation
of this Property 's modifier(s). |
boolean |
hasDefaultValue()
This indicates whether or not this Property has a
a default value set. |
boolean |
hasEnumeration()
This will indicate if this Property has a set of
allowed values (an enumeration) specified for it. |
boolean |
isCollection()
This will indicate whether this Property represents
a Collection of values (resulting in a true
result from this method), or a singular value (resulting in a
false result). |
void |
setDefaultValue(java.lang.Object defaultValue)
This will set the default value of the property. |
void |
setEnumeration(java.util.Vector enumeration)
This will set a list (enumeration) of allowed values for this Property . |
void |
setIsCollection(boolean isCollection)
This will determine whether or not this Property
is a Collection (in other words, the property
represents a collection of values). |
void |
setModifier(java.util.BitSet modifier)
This will set the modifiers for a property. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.util.BitSet modifier
Property
protected boolean isCollection
Property
is a Collection
protected java.lang.Object defaultValue
Property
protected java.util.Vector enumeration
Property
Constructor Detail |
public BaseProperty()
Method Detail |
public void BaseProperty()
Default constructor.
public void setModifier(java.util.BitSet modifier)
This will set the modifiers for a property. The
value submitted must be in the form of an int
,
which should correspond to one of the constants defined
(
,
Property.ACCESS_PRIVATE
,
Property.ACCESS_PROTECTED
,
Property.ACCESS_PUBLIC
,
Property.STORAGE_STATIC
,
or Property.MUTABILITY_VOLATILE
. By default,
all properties will be Property.MUTABILITY_FINAL
private
(ACCESS_PRIVATE
).
setModifier
in interface Property
modifier
- BitSet
representing modifiers.Property.ACCESS_PRIVATE
,
Property.ACCESS_PROTECTED
,
Property.ACCESS_PUBLIC
,
Property.STORAGE_STATIC
,
Property.MUTABILITY_VOLATILE
,
Property.MUTABILITY_FINAL
public java.util.BitSet getModifier()
This will return the access level modifier for a property. The
value returned will be in the form of an int
,
which will correspond to one of the constants defined
(
,
Property.ACCESS_PRIVATE
,
Property.ACCESS_PROTECTED
,
Property.ACCESS_PUBLIC
,
or Property.STORAGE_STATIC
.
Property.MUTABILITY_FINAL
getModifier
in interface Property
BitSet
- modifiers.Property.ACCESS_PRIVATE
,
Property.ACCESS_PROTECTED
,
Property.ACCESS_PUBLIC
,
Property.STORAGE_STATIC
,
Property.MUTABILITY_VOLATILE
,
Property.MUTABILITY_FINAL
public java.lang.String getModifierString()
This will return the Java String
representation
of this Property
's modifier(s). For
example,
would be
converted to "private".
Property.ACCESS_PRIVATE
getModifierString
in interface Property
String
- Java representation of modifiersProperty.ACCESS_PRIVATE
,
Property.ACCESS_PROTECTED
,
Property.ACCESS_PUBLIC
,
Property.STORAGE_STATIC
,
Property.MUTABILITY_VOLATILE
,
Property.MUTABILITY_FINAL
public void setIsCollection(boolean isCollection)
This will determine whether or not this Property
is a Collection
(in other words, the property
represents a collection of values). By default, properties
are all singular values.
setIsCollection
in interface Property
isCollection
- true
is multiple values can be stored,
or else false
.public boolean isCollection()
This will indicate whether this Property
represents
a Collection
of values (resulting in a true
result from this method), or a singular value (resulting in a
false
result).
isCollection
in interface Property
boolean
- whether or not this Property
represents a Collection.
public boolean hasDefaultValue()
This indicates whether or not this Property
has a
a default value set.
hasDefaultValue
in interface Property
boolean
- whether there is a default value set.public void setDefaultValue(java.lang.Object defaultValue)
This will set the default value of the property. Since no typing
is available at this point, a simple Java Object
is allowed as the type supplied. As a result, any errors in
mismatches between object type and allowed paramater type will
occur at runtime, when class generation takes place. Supplying
a value here essentially results in:
public class Foo {
private String myString = "some default value";
public String getMyString() {
return myString;
}
public void setMyString(String myString) {
this.myString = myString;
}
// Other methods and properties
}
Also, note that data binding users who supply their own class implementations will LOSE THIS DEFAULT VALUE, as the interface alone cannot specify a default value. So use this carefully!
setDefaultValue
in interface Property
defaultValue
- Object
to be used as default value.public java.lang.Object getDefaultValue()
This will retrieve the default value associated with this property,
or null
if there is not one. For more information on
default property values, see
.
setDefaultValue(Object)
getDefaultValue
in interface Property
Object
- default value of the property.public boolean hasEnumeration()
This will indicate if this Property
has a set of
allowed values (an enumeration) specified for it.
hasEnumeration
in interface Property
boolean
- whether an enumeration is specified.public void setEnumeration(java.util.Vector enumeration)
This will set a list (enumeration) of allowed values for this
Property
. To allow any value, the null
value should be supplied (which is the default value).
setEnumeration
in interface Property
enumeration
- the Vector
of allowed values.public java.util.Vector getEnumeration()
This returns the Vector
of allowed values for this
Property
, or null
if there is none.
getEnumeration
in interface Property
Vector
- the allowed values.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |