net.sf.jameleon.bean
Class Attribute

java.lang.Object
  extended by net.sf.jameleon.bean.Attribute
All Implemented Interfaces:
Serializable, Cloneable, XMLable

public class Attribute
extends Object
implements XMLable, Cloneable

See Also:
Serialized Form

Field Summary
protected  String contextName
          The name of this attribute's instance variable in the function tag.
protected  String defaultValue
          The default value of the attribute
protected  String description
          A description about how the attribute is used
protected  boolean instanceVariable
          Describes whether this attribute represents an instance variable or set method.
protected  String name
          The attribute's name
protected  boolean required
          Whether this attribute is required or not
protected  String type
          The type of the attribute
protected  Object value
          The value of the attribute
protected  boolean valueSet
          Used to keep track if whether the value of this attribute was set or not
 
Constructor Summary
Attribute()
          Default constructor only used to initialize variables
 
Method Summary
 Object clone()
           
 String getContextName()
          Gets the name of the context variable that the value of the this attribute will be bound to
 String getDefaultValue()
           
 String getDescription()
           
 String getDisplayedValue()
           
 String getName()
           
 String getType()
           
 Object getValue()
           
 boolean isContextVariable()
          Tells if this attribute represents something that is bound to a context variable
 boolean isInstanceVariable()
          Tells if this attribute represents an instance variable or set method
 boolean isRequired()
           
 boolean isValueSet()
           
 void setContextName(String contextName)
          Sets the name of the context variable that the value of the this attribute will be bound to
 void setDefaultValue(String defaultValue)
          Sets the attribute's default value
 void setDescription(String description)
          Sets the description about how the attribute is used
 void setInstanceVariable(boolean instanceVariable)
          Sets this attribute to an instance variable true or a set method false
 void setName(String name)
          Sets the attribute's name
 void setRequired(boolean required)
          Sets the attribute to a required or non-required attribute
 void setType(String type)
          Sets the type of the attribute
 void setValue(Object value)
          Sets the attribute's value
 String toString()
           
 String toXML()
          Implement this method the same way the toString method would be implemented, except the object's information should be in a valid XML format.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected String name
The attribute's name


description

protected String description
A description about how the attribute is used


type

protected String type
The type of the attribute


required

protected boolean required
Whether this attribute is required or not


value

protected Object value
The value of the attribute


defaultValue

protected String defaultValue
The default value of the attribute


contextName

protected String contextName
The name of this attribute's instance variable in the function tag. Used with reflection to magically set the instance variable


instanceVariable

protected boolean instanceVariable
Describes whether this attribute represents an instance variable or set method. If both a set method and instance variable exist for this attribute, then the set method should be called, and this should be set to false


valueSet

protected boolean valueSet
Used to keep track if whether the value of this attribute was set or not

Constructor Detail

Attribute

public Attribute()
Default constructor only used to initialize variables

Method Detail

getName

public String getName()
Returns:
The attribute's name

setName

public void setName(String name)
Sets the attribute's name

Parameters:
name - - The attribute's name

getDescription

public String getDescription()
Returns:
A description about how the attribute is used

setDescription

public void setDescription(String description)
Sets the description about how the attribute is used

Parameters:
description - - The description about how the attribute is used

getType

public String getType()
Returns:
The type of the attribute

setType

public void setType(String type)
Sets the type of the attribute

Parameters:
type - - The type of the attribute

isRequired

public boolean isRequired()
Returns:
true if this attribute is required

isValueSet

public boolean isValueSet()
Returns:
true if the value of the attribute was set

setRequired

public void setRequired(boolean required)
Sets the attribute to a required or non-required attribute

Parameters:
required - - true if this attribute is required

getValue

public Object getValue()
Returns:
The attribute's value

setValue

public void setValue(Object value)
Sets the attribute's value

Parameters:
value - - The attribute's value

getDefaultValue

public String getDefaultValue()
Returns:
The attribute's default value

setDefaultValue

public void setDefaultValue(String defaultValue)
Sets the attribute's default value

Parameters:
defaultValue - - The attribute's default value

getDisplayedValue

public String getDisplayedValue()
Returns:
The displayable value of the attribute

getContextName

public String getContextName()
Gets the name of the context variable that the value of the this attribute will be bound to

Returns:
The name of context variable that the value of this attribute will be bound to

setContextName

public void setContextName(String contextName)
Sets the name of the context variable that the value of the this attribute will be bound to

Parameters:
contextName - - The name of context variable that the value of this attribute will be bound to

isInstanceVariable

public boolean isInstanceVariable()
Tells if this attribute represents an instance variable or set method

Returns:
true if this attribute represents an instance variable and false if it represents a set method. If both a set method and instance variable exist for this attribute, then the set method should be called, and this should return false

isContextVariable

public boolean isContextVariable()
Tells if this attribute represents something that is bound to a context variable

Returns:
true if the contextName is set

setInstanceVariable

public void setInstanceVariable(boolean instanceVariable)
Sets this attribute to an instance variable true or a set method false

Parameters:
instanceVariable - - Set to true if an instance variable or false if this attribute represents a set method. If both a set method and instance variable exist for this attribute, then the set method should be called, and this should be set to false

toXML

public String toXML()
Description copied from interface: XMLable
Implement this method the same way the toString method would be implemented, except the object's information should be in a valid XML format.

Specified by:
toXML in interface XMLable

toString

public String toString()
Overrides:
toString in class Object

clone

public Object clone()
             throws CloneNotSupportedException
Overrides:
clone in class Object
Throws:
CloneNotSupportedException


Copyright © 2003-2008 Christian Hargraves. All Rights Reserved.