|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
com.threerings.antidote.field.BaseComponent
abstract class BaseComponent
A base class for all Ant fields providing useful functionality, such as Violation
management.
Ideally this class would extend from ProjectComponent
. However, Task
objects
act as fields and end up benefiting greatly from this classes functionality. Use the BaseTask
functionality if the implementing class requires Task
functionality, otherwise, use
BaseField
.
Package private. Use one of the subclasses.
BaseField
,
BaseTask
Field Summary |
---|
Fields inherited from class org.apache.tools.ant.Task |
---|
target, taskName, taskType, wrapper |
Fields inherited from class org.apache.tools.ant.ProjectComponent |
---|
description, location, project |
Constructor Summary | |
---|---|
BaseComponent()
|
Method Summary | |
---|---|
protected void |
appendViolation(Violation violation)
Add a violation to the list of violations returned when this Field is validated. |
protected void |
appendViolationList(List<Violation> violations)
Add a list of violations to the list of violations returned when this Field is validated. |
Object |
getReferencedField()
Returns the Object that this ReferenceField holds a reference to. |
boolean |
isReference()
Returns true if this Field is a reference, false otherwise. |
protected void |
registerField(Class<? extends Field> clazz)
Register a given Field class as a data type for this Project . |
protected void |
reportConflictingProperties(Property<?> property,
Property<?>... conflicts)
If the supplied property is set, e.g. |
protected void |
reportUnsetDependentFields(FieldWrapper<?> field,
FieldWrapper<?>... depends)
If the supplied FieldWrapper is unset then report a violation that the field cannot be
unset if any of the supplied list of FieldWrapper objects are set. |
protected void |
reportUnsetDependentProperties(Property<?> property,
Property<?>... dependents)
If the supplied property is unset, then report a violation that the property cannot be unset if any of the supplied list of Property objects are set. |
protected void |
reportUnsetField(FieldWrapper<?> field)
Report as a violation if the supplied FieldWrapper is unset. |
protected void |
setReference(Reference reference)
A protected setter meant for concrete classes to optionally support Ant reference setting by using a public setter method which calls this, e.g. |
List<Violation> |
validate()
Implement validate() in the base abstract class ensuring correct behavior. |
protected ValidStatus |
validateChildFields(FieldWrapper<?>... childFields)
Validate a varargs list of FieldWrapper objects that are children of this Field . |
protected ValidStatus |
validateChildFields(List<? extends FieldWrapper<?>> childFields)
Validate a List of FieldWrapper objects that are children of this Field . |
protected abstract void |
validateField()
Give each subclass a chance to do field specific validation. |
protected ValidStatus |
validateOptionalProperties(Property<?>... properties)
Validate a list of Property objects that are optional. |
protected ValidStatus |
validateProperties(List<Property<?>> properties)
Validate a list of Property objects. |
protected ValidStatus |
validateProperties(Property<?>... properties)
Validate a varargs list of Property objects. |
Methods inherited from class org.apache.tools.ant.Task |
---|
bindToOwner, execute, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType |
Methods inherited from class org.apache.tools.ant.ProjectComponent |
---|
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.threerings.antidote.field.Field |
---|
getFieldName, getLocation |
Constructor Detail |
---|
BaseComponent()
Method Detail |
---|
public final List<Violation> validate()
validate
in interface RequiresValidation
appendViolation(Violation)
public Object getReferencedField()
ReferenceField
Object
that this ReferenceField
holds a reference to. This is
not type safe. Use FieldWrapper.getField()
which is type safe.
Should not be called before ReferenceField.isReference()
is checked. If the Reference
has
not been set, a UnsetReferenceException
will be thrown.
getReferencedField
in interface ReferenceField
public boolean isReference()
ReferenceField
Field
is a reference, false otherwise.
isReference
in interface ReferenceField
protected void setReference(Reference reference)
protected abstract void validateField()
protected void appendViolation(Violation violation)
Field
is validated.
protected void appendViolationList(List<Violation> violations)
Field
is validated.
protected ValidStatus validateChildFields(FieldWrapper<?>... childFields)
FieldWrapper
objects that are children of this Field
.
validateChildFields(List)
protected ValidStatus validateChildFields(List<? extends FieldWrapper<?>> childFields)
List
of FieldWrapper
objects that are children of this Field
.
Return a ValidStatus
enum describing the valid state of the list.
IllegalArgumentException
- If the supplied FieldWrapper
is null.protected ValidStatus validateProperties(Property<?>... properties)
Property
objects.
validateProperties(List)
protected ValidStatus validateProperties(List<Property<?>> properties)
Property
objects.
Return a ValidStatus
enum describing the valid state of the list.
protected ValidStatus validateOptionalProperties(Property<?>... properties)
Property
objects that are optional. If they are unset, nothing
will happen. Returns the ValidStatus
of the set properties. If no properties are set,
ALL_VALID is returned.
protected void reportUnsetDependentProperties(Property<?> property, Property<?>... dependents)
Property
objects are set.
protected void reportConflictingProperties(Property<?> property, Property<?>... conflicts)
Property
objects are set.
protected void reportUnsetDependentFields(FieldWrapper<?> field, FieldWrapper<?>... depends)
FieldWrapper
is unset then report a violation that the field cannot be
unset if any of the supplied list of FieldWrapper
objects are set.
protected void reportUnsetField(FieldWrapper<?> field)
FieldWrapper
is unset.
protected void registerField(Class<? extends Field> clazz)
Field
class as a data type for this Project
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |