This class handles the common description attribute and provides a default implementation for reference handling and checking for circular references that is appropriate for types that can not be nested inside elements of the same type (i.e. <patternset> but not <path>).
Modifier and Type | Field and Description |
---|---|
protected boolean | checked
Are we sure we don't hold circular references? |
protected Reference | ref
Value to the refid attribute. |
Access | Constructor and Description |
---|---|
public |
Modifier and Type | Method and Description |
---|---|
protected void | |
protected void | |
protected BuildException | Returns: the exception to throwCreates an exception that indicates the user has generated a loop of data types referencing each other. |
public Object | Returns: a shallow copy of this DataType.Overrides org. |
protected void | |
protected void | dieOnCircularReference(Project
the Ant Project instance against which to resolve references. p)Convenience method. |
protected void | dieOnCircularReference(final Stack<Object>
the stack of references to check. stack, final Project the project to use to dereference the references. project)Check to see whether any DataType we hold references to is included in the Stack (which holds all DataType instances that directly or indirectly reference this instance, including this instance itself). |
private String | |
protected < required reference type T> T | Returns: the dereferenced object.
Deprecated
use getCheckedRef(Class)
Performs the check for circular references and returns the
referenced object.
|
protected < required reference type T> T | Returns: the dereferenced object.the class that this reference should be a subclass of. requiredClass)Performs the check for circular references and returns the referenced object. |
protected < required reference type T> T | Returns: the dereferenced object.the Ant Project instance against which to resolve references. p)
Deprecated
use getCheckedRef(Class)
Performs the check for circular references and returns the
referenced object.
|
protected < required reference type T> T | Returns: the dereferenced object.the class that this reference should be a subclass of. requiredClass, final String the name of the datatype that the reference should be
(error message use only). dataTypeName)Performs the check for circular references and returns the referenced object. |
protected < required reference type T> T | Returns: the dereferenced object.the class that this reference should be a subclass of. requiredClass, final String the name of the datatype that the reference should be
(error message use only). dataTypeName, final Project the fallback Project instance for dereferencing. project)Performs the check for circular references and returns the referenced object. |
protected String | Returns: String name.Gets as descriptive as possible a name used for this datatype instance. |
public Reference | |
public static void | invokeCircularReferenceCheck(DataType
the DataType to check. dt, Stack<Object> the stack of references to check. stk, Project the project to use to dereference the references. p)Allow DataTypes outside org.apache.tools.ant.types to indirectly call dieOnCircularReference on nested DataTypes. |
protected boolean | Returns: true if circular references have been checkedThe flag that is used to indicate that circular references have been checked. |
public boolean | Returns: true if the refid attribute has been setHas the refid attribute of this element been set? |
protected BuildException | Returns: the exception to throwCreates an exception that indicates that this XML element must not have child elements if the refid attribute is set. |
public static void | pushAndInvokeCircularReferenceCheck(DataType
the DataType to check. dt, Stack<Object> the stack of references to check. stk, Project the project to use to dereference the references. p)Allow DataTypes outside org.apache.tools.ant.types to indirectly call dieOnCircularReference on nested DataTypes. |
protected void | setChecked(final boolean
if true, if circular references have been checked checked)Set the flag that is used to indicate that circular references have been checked. |
public void | |
protected BuildException | Returns: the exception to throwCreates an exception that indicates that refid has to be the only attribute if it is set. |
public String | Returns: this DataType formatted as a String.Overrides java. |
checked | back to summary |
---|---|
protected boolean checked
Deprecated since 1.7.
The user should not be directly referencing
variable. Please use Are we sure we don't hold circular references? Subclasses are responsible for setting this value to false if we'd need to investigate this condition (usually because a child element has been added that is a subclass of DataType). |
ref | back to summary |
---|---|
protected Reference ref
Deprecated since 1.7.
The user should not be directly referencing
variable. Please use Value to the refid attribute. |
DataType | back to summary |
---|---|
public DataType() |
checkAttributesAllowed | back to summary |
---|---|
protected void checkAttributesAllowed() check that it is ok to set attributes, i.e that no reference is defined
|
checkChildrenAllowed | back to summary |
---|---|
protected void checkChildrenAllowed() check that it is ok to add children, i.e that no reference is defined
|
circularReference | back to summary |
---|---|
protected BuildException circularReference() Creates an exception that indicates the user has generated a loop of data types referencing each other.
|
clone | back to summary |
---|---|
public Object clone() throws CloneNotSupportedException Overrides org. Doc from java. Creates and returns a copy of this object. The precise meaning
of "copy" may depend on the class of the object. The general
intent is that, for any object will be true, and that the expression:x.clone() != x will bex.clone().getClass() == x.getClass() true , but these are not absolute requirements.
While it is typically the case that:
will bex.clone().equals(x) true , this is not an absolute requirement.
By convention, the returned object should be obtained by calling
By convention, the object returned by this method should be independent
of this object (which is being cloned). To achieve this independence,
it may be necessary to modify one or more fields of the object returned
by
|
dieOnCircularReference | back to summary |
---|---|
protected void dieOnCircularReference() Convenience method.
|
dieOnCircularReference | back to summary |
---|---|
protected void dieOnCircularReference(Project p) Convenience method.
|
dieOnCircularReference | back to summary |
---|---|
protected void dieOnCircularReference(final Stack<Object> stack, final Project project) throws BuildException Check to see whether any DataType we hold references to is included in the Stack (which holds all DataType instances that directly or indirectly reference this instance, including this instance itself). If one is included, throw a BuildException created by This implementation is appropriate only for a DataType that cannot hold other DataTypes as children. The general contract of this method is that it shouldn't do
anything if
|
displayName | back to summary |
---|---|
private String displayName(Class<?> clazz) |
getCheckedRef | back to summary |
---|---|
protected <T> T getCheckedRef()
Deprecated use getCheckedRef(Class) Performs the check for circular references and returns the referenced object.
|
getCheckedRef | back to summary |
---|---|
protected <T> T getCheckedRef(final Class<T> requiredClass) Performs the check for circular references and returns the referenced object.
|
getCheckedRef | back to summary |
---|---|
protected <T> T getCheckedRef(Project p)
Deprecated use getCheckedRef(Class) Performs the check for circular references and returns the referenced object.
|
getCheckedRef | back to summary |
---|---|
protected <T> T getCheckedRef(final Class<T> requiredClass, final String dataTypeName) Performs the check for circular references and returns the referenced object.
|
getCheckedRef | back to summary |
---|---|
protected <T> T getCheckedRef(final Class<T> requiredClass, final String dataTypeName, final Project project) Performs the check for circular references and returns the referenced object. This version allows the fallback Project instance to be specified.
|
getDataTypeName | back to summary |
---|---|
protected String getDataTypeName() Gets as descriptive as possible a name used for this datatype instance.
|
getRefid | back to summary |
---|---|
public Reference getRefid() get the reference set on this object
|
invokeCircularReferenceCheck | back to summary |
---|---|
public static void invokeCircularReferenceCheck(DataType dt, Stack<Object> stk, Project p) Allow DataTypes outside org.apache.tools.ant.types to indirectly call dieOnCircularReference on nested DataTypes.
|
isChecked | back to summary |
---|---|
protected boolean isChecked() The flag that is used to indicate that circular references have been checked.
|
isReference | back to summary |
---|---|
public boolean isReference() Has the refid attribute of this element been set?
|
noChildrenAllowed | back to summary |
---|---|
protected BuildException noChildrenAllowed() Creates an exception that indicates that this XML element must not have child elements if the refid attribute is set.
|
pushAndInvokeCircularReferenceCheck | back to summary |
---|---|
public static void pushAndInvokeCircularReferenceCheck(DataType dt, Stack<Object> stk, Project p) Allow DataTypes outside org.apache.tools.ant.types to indirectly call dieOnCircularReference on nested DataTypes. Pushes dt on the stack, runs dieOnCircularReference and pops it again.
|
setChecked | back to summary |
---|---|
protected void setChecked(final boolean checked) Set the flag that is used to indicate that circular references have been checked.
|
setRefid | back to summary |
---|---|
public void setRefid(final Reference ref) Set the value of the refid attribute. Subclasses may need to check whether any other attributes
have been set as well or child elements have been created and
thus override this method. if they do the must call
|
tooManyAttributes | back to summary |
---|---|
protected BuildException tooManyAttributes() Creates an exception that indicates that refid has to be the only attribute if it is set.
|
toString | back to summary |
---|---|
public String toString() Overrides java. Basic DataType toString(). |