com.aptana.sax
Class SchemaElement

java.lang.Object
  extended by com.aptana.sax.SchemaElement

public class SchemaElement
extends java.lang.Object

Author:
Kevin Lindsey

Constructor Summary
SchemaElement(Schema owningSchema, java.lang.String name)
          Create a new instance of SchemaNode
 
Method Summary
 void addAttribute(java.lang.String name, java.lang.String usage)
          Add an attribute to this element
 void addTransition(SchemaElement node)
          Add a transition out of this node to another node
 java.lang.String getName()
          Get the name associated with this Schema node
 java.lang.reflect.Method getOnEnterMethod()
          Return the Method to call when entering this element
 java.lang.reflect.Method getOnExitMethod()
          Return the Method to call when exiting this element
 SchemaElement[] getTransitionElements()
          getTransitionElements
 boolean hasAttribute(java.lang.String name)
          Determine if this element has a definition for the specified attribute name
 boolean hasOnEnterMethod()
          Determine if this element has an associated OnEnter handler
 boolean hasOnExitMethod()
          Determine if this element has an associated OnExit handler
 boolean hasTransitions()
          hasTransitions
 boolean isDeprecatedAttribute(java.lang.String name)
          Determine if the specified attribute name is optional on this element
 boolean isOptionalAttribute(java.lang.String name)
          Determine if the specified attribute name is optional on this element
 boolean isRequiredAttribute(java.lang.String name)
          Determine if the specified attribute name is required on this element
 boolean isValidAttribute(java.lang.String name)
          Determine if the specified attribute name is allowed on this element
 boolean isValidTransition(java.lang.String name)
          Determine if this node can transition to another node using the given name
 SchemaElement moveTo(java.lang.String name)
          Get the named SchemaElement that transitions from this element
 void setOnEnter(java.lang.String onEnterMethod)
          Set the method to call after entering this element
 void setOnExit(java.lang.String onExitMethod)
          Set the method to call before exiting this element
 java.lang.String toString()
           
 void validateAttributes(org.xml.sax.Attributes attributes)
          Validate the list of attributes against this element's definition.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SchemaElement

public SchemaElement(Schema owningSchema,
                     java.lang.String name)
Create a new instance of SchemaNode

Parameters:
owningSchema - The schema that owns this element
name - The name of this node
Method Detail

getName

public java.lang.String getName()
Get the name associated with this Schema node

Returns:
this node's name

getOnEnterMethod

public java.lang.reflect.Method getOnEnterMethod()
Return the Method to call when entering this element

Returns:
The Method to invoke. This value can be null if there is no OnEnter event handler associated with this element

setOnEnter

public void setOnEnter(java.lang.String onEnterMethod)
                throws java.lang.SecurityException,
                       java.lang.NoSuchMethodException
Set the method to call after entering this element

Parameters:
onEnterMethod - The name of the method to call on the schema's handler object when we enter this element
Throws:
java.lang.NoSuchMethodException
java.lang.SecurityException

getOnExitMethod

public java.lang.reflect.Method getOnExitMethod()
Return the Method to call when exiting this element

Returns:
The Method to invoke. This value can be null if there is no OnExit event handler associated with this element

setOnExit

public void setOnExit(java.lang.String onExitMethod)
               throws java.lang.SecurityException,
                      java.lang.NoSuchMethodException
Set the method to call before exiting this element

Parameters:
onExitMethod - The name of the method to call on the schema's handler object when we exit this element
Throws:
java.lang.NoSuchMethodException
java.lang.SecurityException

getTransitionElements

public SchemaElement[] getTransitionElements()
getTransitionElements

Returns:
Returns an array of schema elements to which this element can transition.

hasAttribute

public boolean hasAttribute(java.lang.String name)
Determine if this element has a definition for the specified attribute name

Parameters:
name - The name of the attribute to test
Returns:
Returns true if this element has an entry for the specified attribute name

hasOnEnterMethod

public boolean hasOnEnterMethod()
Determine if this element has an associated OnEnter handler

Returns:
Returns true if this element has an OnEnter handler

hasOnExitMethod

public boolean hasOnExitMethod()
Determine if this element has an associated OnExit handler

Returns:
Returns true if this element has an OnExit handler

hasTransitions

public boolean hasTransitions()
hasTransitions

Returns:
Returns true if this element has transitions

isDeprecatedAttribute

public boolean isDeprecatedAttribute(java.lang.String name)
Determine if the specified attribute name is optional on this element

Parameters:
name - The name of the attribute to test
Returns:
Returns true if the specified attribute name does not have to exist on this element

isOptionalAttribute

public boolean isOptionalAttribute(java.lang.String name)
Determine if the specified attribute name is optional on this element

Parameters:
name - The name of the attribute to test
Returns:
Returns true if the specified attribute name does not have to exist on this element

isRequiredAttribute

public boolean isRequiredAttribute(java.lang.String name)
Determine if the specified attribute name is required on this element

Parameters:
name - The name of the attribute to test
Returns:
Returns true if the specified attribute name must exist on this element

isValidAttribute

public boolean isValidAttribute(java.lang.String name)
Determine if the specified attribute name is allowed on this element

Parameters:
name - The name of the attribute to test
Returns:
Returns true if the specified attribute name is allowed on this element

isValidTransition

public boolean isValidTransition(java.lang.String name)
Determine if this node can transition to another node using the given name

Parameters:
name - The name of the node to test as a possible transition target
Returns:
Returns true if this node can transition to the given node name

addAttribute

public void addAttribute(java.lang.String name,
                         java.lang.String usage)
Add an attribute to this element

Parameters:
name - The name of the attribute
usage - The usage requirements for the attribute

addTransition

public void addTransition(SchemaElement node)
Add a transition out of this node to another node

Parameters:
node - The node to which this node can transition

moveTo

public SchemaElement moveTo(java.lang.String name)
Get the named SchemaElement that transitions from this element

Parameters:
name - The name of the SchemaElement to transition to
Returns:
The new SchemaElement

validateAttributes

public void validateAttributes(org.xml.sax.Attributes attributes)
                        throws org.xml.sax.SAXException
Validate the list of attributes against this element's definition. Required attributes must exist and no attributes can be in the list that have not been defined for this element.

Parameters:
attributes - The list of attributes to test
Throws:
org.xml.sax.SAXException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()