org.enhydra.zeus.binding
Class ContainerProperty

java.lang.Object
  |
  +--org.enhydra.zeus.binding.BaseBinding
        |
        +--org.enhydra.zeus.binding.ContainerProperty
All Implemented Interfaces:
Binding, Container, Property

public class ContainerProperty
extends BaseBinding
implements Property, Container

ContainerProperty implements the Binding, Property, and Container interfaces, and provides for a complex object that is itself a property.

A ContainerProperty will most commonly represent a Java Object that has properties of its own (like any other ContainerObject.

Author:
Brett McLaughlin

Field Summary
protected  java.lang.Object defaultValue
          The default value for this Property
protected  boolean isCollection
          Whether this Property represents a Collection
protected  java.util.BitSet modifier
          The access level modifier for this Property
protected  java.util.List properties
          The Property objects this Container holds.
 
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
ContainerProperty(java.lang.String xmlName, java.lang.String xmlType)
           This will create a new ContainerProperty with the specified information, and set the access level to "private", as well as setting both the XML name and XML type namespace URIs to "", the equivalent of no namespace.
ContainerProperty(java.lang.String xmlName, java.lang.String xmlNamespaceURI, java.lang.String xmlType, java.lang.String xmlTypeNamespaceURI)
           This will create a new ContainerProperty with the specified information, and set the access level to "private".
ContainerProperty(java.lang.String xmlName, java.lang.String xmlNamespaceURI, java.lang.String xmlType, java.lang.String xmlTypeNamespaceURI, java.util.BitSet modifier)
           This will create a new ContainerProperty with the specified information.
 
Method Summary
 void addProperty(Property property)
           This will add a Property to the member variables of this Container.
 void clearProperties()
           This will clear all the properties for this Container.
 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 modifiers.
 java.util.List getProperties()
           This will return a list of all the Property objects that this Container has.
 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).
 boolean removeProperty(java.lang.String javaName)
           This will remove a Property from this Container, given the property's name.
 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 set 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.
 void setProperties(java.util.List properties)
           This does a wholesale replacement of this binding's current properties, removing all current ones and replacing with the supplied List of new properties.
 
Methods inherited from class org.enhydra.zeus.binding.BaseBinding
getJavaCollectionClass, getJavaImplementationPackage, getJavaInterfacePackage, getJavaName, getJavaType, getJavaVariableName, getXMLName, getXMLNamespaceURI, getXMLParentType, getXMLParentTypeNamespaceURI, getXMLType, getXMLTypeNamespaceURI, isJavaSerializable, isXMLRootElement, setIsJavaSerializable, setIsXMLRootElement, setJavaCollectionClass, setJavaImplementationPackage, setJavaInterfacePackage, setJavaName, setJavaType, setJavaVariableName, setXMLName, setXMLNamespaceURI, setXMLParentType, setXMLParentTypeNamespaceURI, setXMLType, setXMLTypeNamespaceURI
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.enhydra.zeus.Binding
getJavaCollectionClass, getJavaImplementationPackage, getJavaInterfacePackage, getJavaName, getJavaType, getJavaVariableName, getXMLName, getXMLNamespaceURI, getXMLParentType, getXMLParentTypeNamespaceURI, getXMLType, getXMLTypeNamespaceURI, isJavaSerializable, isXMLRootElement, setIsJavaSerializable, setIsXMLRootElement, setJavaCollectionClass, setJavaImplementationPackage, setJavaInterfacePackage, setJavaName, setJavaType, setJavaVariableName, setXMLName, setXMLNamespaceURI, setXMLParentType, setXMLParentTypeNamespaceURI, setXMLType, setXMLTypeNamespaceURI
 

Field Detail

modifier

protected java.util.BitSet modifier
The access level modifier for this Property

isCollection

protected boolean isCollection
Whether this Property represents a Collection

defaultValue

protected java.lang.Object defaultValue
The default value for this Property

properties

protected java.util.List properties
The Property objects this Container holds.
Constructor Detail

ContainerProperty

public ContainerProperty(java.lang.String xmlName,
                         java.lang.String xmlNamespaceURI,
                         java.lang.String xmlType,
                         java.lang.String xmlTypeNamespaceURI,
                         java.util.BitSet modifier)

This will create a new ContainerProperty with the specified information.

Parameters:
xmlName - the XML local name associated with the property.
xmlNamespaceURI - the XML namespace URI associated with the property's XML name.
xmlType - the XML type associated with the property.
xmlTypeNamespaceURI - the XML namespace URI associated with the property's XML type.
modifier - the BitSet representing the property's modifier(s).
See Also:
{@link Property#ACCESS_PRIVATE}, {@link Property#ACCESS_PROTECTED}, {@link Property#ACCESS_PUBLIC}

ContainerProperty

public ContainerProperty(java.lang.String xmlName,
                         java.lang.String xmlNamespaceURI,
                         java.lang.String xmlType,
                         java.lang.String xmlTypeNamespaceURI)

This will create a new ContainerProperty with the specified information, and set the access level to "private".

Parameters:
xmlName - the XML local name associated with the property.
xmlNamespaceURI - the XML namespace URI associated with the property's XML name.
xmlType - the XML type associated with the property.
xmlTypeNamespaceURI - the XML namespace URI associated with the property's XML type.
See Also:
{@link Property#ACCESS_PRIVATE}, {@link Property#ACCESS_PROTECTED}, {@link Property#ACCESS_PUBLIC}

ContainerProperty

public ContainerProperty(java.lang.String xmlName,
                         java.lang.String xmlType)

This will create a new ContainerProperty with the specified information, and set the access level to "private", as well as setting both the XML name and XML type namespace URIs to "", the equivalent of no namespace.

Parameters:
xmlName - the XML local name associated with the property.
xmlType - the XML type associated with the property.
See Also:
{@link Property#ACCESS_PRIVATE}, {@link Property#ACCESS_PROTECTED}, {@link Property#ACCESS_PUBLIC}
Method Detail

setModifier

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, Property.MUTABILITY_VOLATILE, or Property.MUTABILITY_FINAL. By default, all properties will be private (ACCESS_PRIVATE).

Specified by:
setModifier in interface Property
Parameters:
modifier - BitSetrepresenting modifiers.
See Also:
Property.ACCESS_PRIVATE, Property.ACCESS_PROTECTED, Property.ACCESS_PUBLIC, Property.STORAGE_STATIC, Property.MUTABILITY_VOLATILE, Property.MUTABILITY_FINAL

getModifier

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, Property.STORAGE_STATIC, or Property.MUTABILITY_FINAL.

Specified by:
getModifier in interface Property
Returns:
BitSet - modifiers.
See Also:
Property.ACCESS_PRIVATE, Property.ACCESS_PROTECTED, Property.ACCESS_PUBLIC, Property.STORAGE_STATIC, Property.MUTABILITY_VOLATILE, Property.MUTABILITY_FINAL

getModifierString

public java.lang.String getModifierString()

This will return the Java String representation of this Property's modifiers. For example, Property.ACCESS_PRIVATE would be converted to "private".

Specified by:
getModifierString in interface Property
Returns:
String - Java representation
See Also:
Property.ACCESS_PRIVATE, Property.ACCESS_PROTECTED, Property.ACCESS_PUBLIC, Property.STORAGE_STATIC, Property.MUTABILITY_VOLATILE, Property.MUTABILITY_FINAL

setIsCollection

public void setIsCollection(boolean isCollection)

This will set 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.

Specified by:
setIsCollection in interface Property
Parameters:
isCollection - true is multiple values can be stored, or else false.

isCollection

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).

Specified by:
isCollection in interface Property
Returns:
boolean - whether or not this Property represents a Collection.

hasDefaultValue

public boolean hasDefaultValue()

This indicates whether or not this Property has a a default value set.

Specified by:
hasDefaultValue in interface Property
Returns:
boolean - whether there is a default value set.

setDefaultValue

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!

Specified by:
setDefaultValue in interface Property
Parameters:
defaultValue - Object to be used as default value.

getDefaultValue

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).

Specified by:
getDefaultValue in interface Property
Returns:
Object - default value of the property.

hasEnumeration

public boolean hasEnumeration()

This will indicate if this Property has a set of allowed values (an enumeration) specified for it. For ContainerProperty implementations, this will always be false.

Specified by:
hasEnumeration in interface Property
Returns:
boolean - whether an enumeration is specified.

setEnumeration

public void setEnumeration(java.util.Vector enumeration)

This will set a list (enumeration) of allowed values for this Property. This complies with the Property interface, but does nothing for containers.

Specified by:
setEnumeration in interface Property
Parameters:
enumeration - the Vector of allowed values.

getEnumeration

public java.util.Vector getEnumeration()

This returns the Vector of allowed values for this Property, or null if there is none. For a ContainerProperty, this will always return null.

Specified by:
getEnumeration in interface Property
Returns:
Vector - the allowed values.

addProperty

public void addProperty(Property property)

This will add a Property to the member variables of this Container.

It is important to note that this is simply an instance variable being added to (in most cases) a custom Java class definition. That variable/property doesn't have a value (although it might have a default value) until marshalling and unmarshalling occurs.

Specified by:
addProperty in interface Container
Parameters:
property - Property to add.

removeProperty

public boolean removeProperty(java.lang.String javaName)

This will remove a Property from this Container, given the property's name. If a successful removal occurs, the boolean value true is retruned. If no Property is found with the supplied Java name, the boolean value false is returned.

Specified by:
removeProperty in interface Container
Parameters:
javaName - String name of Property to remove.
Returns:
boolean - indicates whether the specified named Property was found and removed.

setProperties

public void setProperties(java.util.List properties)

This does a wholesale replacement of this binding's current properties, removing all current ones and replacing with the supplied List of new properties.

Specified by:
setProperties in interface Container
Parameters:
properties - List of properties to use for this container.

getProperties

public java.util.List getProperties()

This will return a list of all the Property objects that this Container has. If there are none, this will return an empty List.

Specified by:
getProperties in interface Container
Returns:
List - properties for this Container.

clearProperties

public void clearProperties()

This will clear all the properties for this Container.

Specified by:
clearProperties in interface Container


Copyright © 2002 Enhydra. All Rights Reserved.