public class ComponentSpecification extends LocatablePropertyHolder implements IComponentSpecification
A specification consists of
From this information, an actual component may be instantiated and initialized. Instantiating a component is usually a recursive process, since to initialize a container component, it is necessary to instantiate and initialize its contained components as well.
IComponent
,
IContainedComponent
,
IPageLoader
Modifier and Type | Field and Description |
---|---|
protected java.util.Map |
_assets
Keyed on asset name, value is
IAssetSpecification . |
protected java.util.Map |
_beans
Defines all helper beans.
|
protected java.util.Map |
_components
Keyed on component id, value is
IContainedComponent . |
protected java.util.Map |
_parameters
Defines all formal parameters.
|
protected java.util.Set |
_reservedParameterNames
The names of all reserved informal parameter names (as lower-case).
|
Constructor and Description |
---|
ComponentSpecification() |
Modifier and Type | Method and Description |
---|---|
void |
addAsset(java.lang.String name,
IAssetSpecification asset) |
void |
addBeanSpecification(java.lang.String name,
IBeanSpecification specification) |
void |
addComponent(java.lang.String id,
IContainedComponent component) |
void |
addInjectSpecification(InjectSpecification spec)
Adds a
InjectSpecification . |
void |
addParameter(IParameterSpecification spec)
Adds the parameter.
|
void |
addPropertySpecification(IPropertySpecification spec)
Adds a new property specification.
|
void |
addReservedParameterName(java.lang.String value)
Adds the value as a reserved name.
|
boolean |
getAllowBody()
Returns true if the component is allowed to wrap other elements (static HTML or other
components).
|
boolean |
getAllowInformalParameters()
Returns true if the component allows informal parameters (parameters not formally defined).
|
IAssetSpecification |
getAsset(java.lang.String name)
Returns the
IAssetSpecification with the given name, or null if no such specification
exists. |
java.util.List |
getAssetNames()
Returns a
List of the String names of all assets, in alphabetical order |
java.util.Collection |
getBeanNames()
Returns an unmodifiable collection of the names of all beans.
|
IBeanSpecification |
getBeanSpecification(java.lang.String name)
Returns the
IBeanSpecification for the given name, or null if not such specification
exists. |
IContainedComponent |
getComponent(java.lang.String id)
Returns the specification of a contained component with the given id, or null if no such
contained component exists.
|
java.lang.String |
getComponentClassName()
Returns the class name to be used when instantiating the component, or null if no class name
was provided in the specification (in which case, a system of defaults will be used to
determine the class name).
|
java.util.List |
getComponentIds()
Returns an
List of the String names of the IContainedComponent s for
this component. |
java.lang.String |
getDescription()
Returns the documentation for this component.
|
java.util.List |
getInjectSpecifications()
Returns the list of
InjectSpecification . |
IParameterSpecification |
getParameter(java.lang.String name)
Returns the specification of a parameter with the given name, or null if no such parameter
exists.
|
java.util.List |
getParameterNames()
Returns a List of of String names of all parameters.
|
IPropertySpecification |
getPropertySpecification(java.lang.String name)
Returns the named
IPropertySpecification , or null if no
such specification exist. |
java.util.List |
getPropertySpecificationNames()
Returns a sorted, immutable list of the names of all
IPropertySpecification s. |
java.lang.String |
getPublicId()
Returns the XML Public Id for the specification file, or null if not applicable.
|
java.util.Collection |
getRequiredParameters()
Returns an unordered collection of
IParameterSpecification , for all parameters that
are required. |
java.util.Set |
getReservedParameterNames()
Returns a Set of Strings; the reserved parameter names for the component.
|
org.apache.hivemind.Resource |
getSpecificationLocation() |
boolean |
isDeprecated()
Returns true if the component is deprecated.
|
boolean |
isPageSpecification()
Returns true if the specification is known to be a page specification and not a component
specification.
|
boolean |
isReservedParameterName(java.lang.String value)
Returns true if the value specified is in the reserved name list.
|
void |
setAllowBody(boolean value) |
void |
setAllowInformalParameters(boolean value) |
void |
setComponentClassName(java.lang.String value) |
void |
setDeprecated(boolean deprecated) |
void |
setDescription(java.lang.String description)
Sets the documentation for this component.
|
void |
setPageSpecification(boolean pageSpecification) |
void |
setPublicId(java.lang.String publicId) |
void |
setSpecificationLocation(org.apache.hivemind.Resource specificationLocation) |
java.lang.String |
toString() |
getLocation, setLocation
getProperty, getPropertyNames, removeProperty, setProperty
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getProperty, getPropertyNames, removeProperty, setProperty
protected java.util.Map _components
IContainedComponent
.protected java.util.Map _assets
IAssetSpecification
.protected java.util.Map _parameters
IParameterSpecification
.protected java.util.Map _beans
IBeanSpecification
.protected java.util.Set _reservedParameterNames
public ComponentSpecification()
public void addAsset(java.lang.String name, IAssetSpecification asset)
addAsset
in interface IComponentSpecification
org.apache.hivemind.ApplicationRuntimeException
- if the name already exists.public void addComponent(java.lang.String id, IContainedComponent component)
addComponent
in interface IComponentSpecification
org.apache.hivemind.ApplicationRuntimeException
- if the id is already defined.public void addParameter(IParameterSpecification spec)
addParameter
in interface IComponentSpecification
org.apache.hivemind.ApplicationRuntimeException
- if the name already exists.public boolean getAllowBody()
getAllowBody
in interface IComponentSpecification
setAllowBody(boolean)
public boolean getAllowInformalParameters()
The default value is true.
getAllowInformalParameters
in interface IComponentSpecification
setAllowInformalParameters(boolean)
public IAssetSpecification getAsset(java.lang.String name)
IAssetSpecification
with the given name, or null if no such specification
exists.getAsset
in interface IComponentSpecification
addAsset(String,IAssetSpecification)
public java.util.List getAssetNames()
List
of the String names of all assets, in alphabetical ordergetAssetNames
in interface IComponentSpecification
public IContainedComponent getComponent(java.lang.String id)
getComponent
in interface IComponentSpecification
addComponent(String, IContainedComponent)
public java.lang.String getComponentClassName()
IComponentSpecification
getComponentClassName
in interface IComponentSpecification
public java.util.List getComponentIds()
List
of the String names of the IContainedComponent
s for
this component.getComponentIds
in interface IComponentSpecification
addComponent(String, IContainedComponent)
public IParameterSpecification getParameter(java.lang.String name)
getParameter
in interface IComponentSpecification
#addParameter(String, IParameterSpecification)
public java.util.Collection getRequiredParameters()
IComponentSpecification
IParameterSpecification
, for all parameters that
are required. This includes only "real" parameters, not aliases.getRequiredParameters
in interface IComponentSpecification
public java.util.List getParameterNames()
getParameterNames
in interface IComponentSpecification
#addParameter(String, IParameterSpecification)
public void setAllowBody(boolean value)
setAllowBody
in interface IComponentSpecification
public void setAllowInformalParameters(boolean value)
setAllowInformalParameters
in interface IComponentSpecification
public void setComponentClassName(java.lang.String value)
setComponentClassName
in interface IComponentSpecification
public void addBeanSpecification(java.lang.String name, IBeanSpecification specification)
addBeanSpecification
in interface IComponentSpecification
org.apache.hivemind.ApplicationRuntimeException
- if the bean already has a specification.public IBeanSpecification getBeanSpecification(java.lang.String name)
IBeanSpecification
for the given name, or null if not such specification
exists.getBeanSpecification
in interface IComponentSpecification
public java.util.Collection getBeanNames()
getBeanNames
in interface IComponentSpecification
public void addReservedParameterName(java.lang.String value)
addReservedParameterName
in interface IComponentSpecification
public boolean isReservedParameterName(java.lang.String value)
isReservedParameterName
in interface IComponentSpecification
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getDescription()
getDescription
in interface IComponentSpecification
public void setDescription(java.lang.String description)
setDescription
in interface IComponentSpecification
public java.lang.String getPublicId()
This method exists as a convienience for the Spindle plugin. A previous method used an arbitrary version string, the public id is more useful and less ambiguous.
getPublicId
in interface IComponentSpecification
public void setPublicId(java.lang.String publicId)
setPublicId
in interface IComponentSpecification
public boolean isPageSpecification()
isPageSpecification
in interface IComponentSpecification
public void setPageSpecification(boolean pageSpecification)
setPageSpecification
in interface IComponentSpecification
public org.apache.hivemind.Resource getSpecificationLocation()
getSpecificationLocation
in interface IComponentSpecification
public void setSpecificationLocation(org.apache.hivemind.Resource specificationLocation)
setSpecificationLocation
in interface IComponentSpecification
public void addPropertySpecification(IPropertySpecification spec)
addPropertySpecification
in interface IComponentSpecification
public java.util.List getPropertySpecificationNames()
IPropertySpecification
s.getPropertySpecificationNames
in interface IComponentSpecification
public IPropertySpecification getPropertySpecification(java.lang.String name)
IPropertySpecification
, or null if no
such specification exist.getPropertySpecification
in interface IComponentSpecification
addPropertySpecification(IPropertySpecification)
public void addInjectSpecification(InjectSpecification spec)
IComponentSpecification
InjectSpecification
.addInjectSpecification
in interface IComponentSpecification
public java.util.List getInjectSpecifications()
IComponentSpecification
InjectSpecification
. Will return an empty list if no
specifications have been added.getInjectSpecifications
in interface IComponentSpecification
public boolean isDeprecated()
IComponentSpecification
isDeprecated
in interface IComponentSpecification
public void setDeprecated(boolean deprecated)
setDeprecated
in interface IComponentSpecification
public java.util.Set getReservedParameterNames()
IComponentSpecification
getReservedParameterNames
in interface IComponentSpecification