org.enhydra.zeus.binding
Interface Property

All Known Implementing Classes:
BaseProperty, ContainerProperty

public interface Property
extends Binding

Property implements the Binding interface and defines behavior for a property of a Java class. These properties have modifiers, types, and names, as well as a value.

Author:
Brett McLaughlin
Version: 1.0

Field Summary
 final static intACCESS_PRIVATE
          Access Modifier: private
 final static intACCESS_PROTECTED
          Access Modifier: private
 final static intACCESS_PUBLIC
          Access Modifier: public

Method Summary
 intgetAccessModifier()
           This will return the access level modifier for a property.
 StringgetAccessModifierString()
           This will return the Java String representation of this Property's access modifier.
 ObjectgetDefaultValue()
           This will retrieve the default value associated with this property, or null if there is not one.
 booleanisCollection()
           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).
 voidsetAccessModifier(int accessModifier)
           This will set the access level modifier for a property.
 voidsetDefaultValue(Object defaultValue)
           This will set the default value of the property.
 voidsetIsCollection(boolean isCollection)
           This will whether or not this Property is a Collection (in other words, the property represents a collection of values).

Methods inherited from interface org.enhydra.zeus.Binding
getJavaType, getName, setJavaType, setName

Field Detail

ACCESS_PRIVATE

public final static int ACCESS_PRIVATE
Access Modifier: private

ACCESS_PROTECTED

public final static int ACCESS_PROTECTED
Access Modifier: private

ACCESS_PUBLIC

public final static int ACCESS_PUBLIC
Access Modifier: public
Method Detail

getAccessModifier

public int getAccessModifier()

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 (ACCESS_PRIVATE, ACCESS_PROTECTED, or ACCESS_PUBLIC.

Returns: int - constant for access level modifier.
See Also:
ACCESS_PRIVATE, ACCESS_PROTECTED, ACCESS_PUBLIC

getAccessModifierString

public String getAccessModifierString()

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

Returns: String - Java representation
See Also:
ACCESS_PRIVATE, ACCESS_PROTECTED, ACCESS_PUBLIC

getDefaultValue

public 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(java.lang.Object).

Returns: Object - default value of the property.

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

Returns: boolean - whether or not this Property represents a Collection.

setAccessModifier

public void setAccessModifier(int accessModifier)

This will set the access level modifier for a property. The value submitted must be in the form of an int, which should correspond to one of the constants defined (ACCESS_PRIVATE, ACCESS_PROTECTED, or ACCESS_PUBLIC. By default, all properties will be private (ACCESS_PRIVATE).

Parameters:
modifier - int constant for access level.
See Also:
ACCESS_PRIVATE, ACCESS_PROTECTED, ACCESS_PUBLIC

setDefaultValue

public void setDefaultValue(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!

Parameters:
defaultValue - Object to be used as default value.

setIsCollection

public void setIsCollection(boolean isCollection)

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

Parameters:
isCollection - true is multiple values can be stored, or else false.