antsnest.antinfo
Class DefinitionBasics

java.lang.Object
  extended by antsnest.antinfo.DefinitionBasics
All Implemented Interfaces:
Comparable
Direct Known Subclasses:
DefaultTaskDefinition, DefaultTypeDefinition

public abstract class DefinitionBasics
extends Object
implements Comparable

Ways in which a task/type definition are similar

Author:
Chris Clohosy

Field Summary
protected  List attributes
          A list of attributes
protected  String classname
          The classname of the task/type
protected  boolean deprecated
          Whether this task/type is deprecated
protected  String name
          The name of the task/type
protected  List nestedElements
          A list of nested elements
 
Constructor Summary
DefinitionBasics()
          Constructs the basics for a new definition
 
Method Summary
 void addAttribute(AttributeDefinition attribute)
          Adds an attribute to this task/type
 void addNestedElement(TypeDefinition element)
          Adds a nested element to this task/type
 int compareTo(Object other)
          Compares two definitions for ordering
 boolean equals(Object obj)
          Whether two definitions are equal
 AttributeDefinition getAttribute(String name)
          Gets an attribute by name
 AttributeDefinition[] getAttributes()
          Gets all the attributes belonging to this type/task
 String getClassname()
          Gets the classname of this task/type
 String getName()
          Gets the name of this task/type
 TypeDefinition getNestedElement(String name)
          Gets a nested element by name
 TypeDefinition[] getNestedElements()
          Gets all the nested elements this task/type accepts
 boolean isDeprecated()
          Whether this task/type is deprecated
 void setClassname(String classname)
          Sets the classname of this task/type
 void setDeprecated(boolean deprecated)
          Sets whether this task/type is deprecated
 String toString()
          Displays the definition as a string
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected String name
The name of the task/type


classname

protected String classname
The classname of the task/type


attributes

protected List attributes
A list of attributes


nestedElements

protected List nestedElements
A list of nested elements


deprecated

protected boolean deprecated
Whether this task/type is deprecated

Constructor Detail

DefinitionBasics

public DefinitionBasics()
Constructs the basics for a new definition

Method Detail

isDeprecated

public boolean isDeprecated()
Whether this task/type is deprecated

Returns:
a boolean, whether it is deprecated

setDeprecated

public void setDeprecated(boolean deprecated)
Sets whether this task/type is deprecated

Parameters:
deprecated - whether it is deprecated

addAttribute

public void addAttribute(AttributeDefinition attribute)
Adds an attribute to this task/type

Parameters:
attribute - the attribute to add

addNestedElement

public void addNestedElement(TypeDefinition element)
Adds a nested element to this task/type

Parameters:
element - the nested element this task/type accepts

getName

public String getName()
Gets the name of this task/type

Returns:
a String, the name

getClassname

public String getClassname()
Gets the classname of this task/type

Returns:
a String, the classname

setClassname

public void setClassname(String classname)
Sets the classname of this task/type

Parameters:
classname - the classname

equals

public boolean equals(Object obj)
Whether two definitions are equal

Overrides:
equals in class Object
Parameters:
obj - the object to compare to
Returns:
a boolean, whether they are equal

getAttributes

public AttributeDefinition[] getAttributes()
Gets all the attributes belonging to this type/task

Returns:
an AttributeDefinition[], the attributes

getNestedElements

public TypeDefinition[] getNestedElements()
Gets all the nested elements this task/type accepts

Returns:
a TypeDefinition[], the elements

getAttribute

public AttributeDefinition getAttribute(String name)
Gets an attribute by name

Parameters:
name - the name of the attribute to get
Returns:
an AttributeDefinition, the attribute

getNestedElement

public TypeDefinition getNestedElement(String name)
Gets a nested element by name

Parameters:
name - the name of the element to get
Returns:
a TypeDefinition, the nested element

toString

public String toString()
Displays the definition as a string

Overrides:
toString in class Object
Returns:
a String, the definition as a string

compareTo

public int compareTo(Object other)
Compares two definitions for ordering

Specified by:
compareTo in interface Comparable
Parameters:
other - the object to compare this definition to
Returns:
an int, the result