Package org.hippoecm.frontend.types
Class JavaTypeDescriptor
java.lang.Object
org.hippoecm.frontend.types.JavaTypeDescriptor
- All Implemented Interfaces:
Serializable
,org.apache.wicket.model.IDetachable
,org.apache.wicket.util.io.IClusterable
,IObservable
,ITypeDescriptor
- Direct Known Subclasses:
BuiltinTypeDescriptor
public class JavaTypeDescriptor
extends Object
implements ITypeDescriptor, org.apache.wicket.model.IDetachable
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addField
(IFieldDescriptor field) Add a field to the type.void
addValidator
(String validator) protected void
void
detach()
The map of fields that are declared in this type.Retrieve the field associated with a key.The map of fields that are declared in this type of any of its super types.getName()
The name of the type.Retrieve all types that descend from the type.The super types of the type.getType()
The name of the underlying type can be different if this is a "pseudo" type.The symbolic names for validators associated with this type.boolean
isMixin()
Does the type correspond to a mixin, i.e.boolean
boolean
isNode()
Is the type a compound or mixin type, corresponding to a node type.boolean
Returns true if this type istypeName
or a subtype oftypeName
, otherwise returnsfalse
.boolean
Returns true if validation is cascaded, i.e.void
removeField
(String name) Remove a field from the type.void
setIsMixin
(boolean isMixin) void
setIsNode
(boolean isNode) void
setIsValidationCascaded
(boolean isCascaded) void
setMutable
(boolean mutable) void
setObservationContext
(IObservationContext context) Before observation is started on the observable, an observation context is injected by the observer registry.void
setPrimary
(String name) Declare one of the fields to be the primary item.void
setSuperTypes
(List<String> superTypes) Set the super types of the type.void
When the firstIObserver
of this observable is registered with the observer registry, observation is started.void
When the lastIObserver
unregisters, observation is stopped.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.hippoecm.frontend.model.event.IObservable
equals, hashCode
-
Constructor Details
-
JavaTypeDescriptor
-
-
Method Details
-
getName
Description copied from interface:ITypeDescriptor
The name of the type. It can be used to retrieve the type from a type store.- Specified by:
getName
in interfaceITypeDescriptor
- Returns:
- name of the type
-
getType
Description copied from interface:ITypeDescriptor
The name of the underlying type can be different if this is a "pseudo" type. This can be used to impose additional conditions on the original type, or to associate different templates with the type.For type descriptors that do not correspond to current or draft versions of a namespace, the prefix will be the JCR prefix. (E.g. myproject_0_0 when version 0.1 is current)
- Specified by:
getType
in interfaceITypeDescriptor
- Returns:
- the name of the real (JCR) type
-
getSuperTypes
Description copied from interface:ITypeDescriptor
The super types of the type. The type inherits fields from these types and the primary item, if it is defined in any of them. If the type is primitive, null will be returned.- Specified by:
getSuperTypes
in interfaceITypeDescriptor
- Returns:
- an immutable list of super types.
-
getSubTypes
Description copied from interface:ITypeDescriptor
Retrieve all types that descend from the type.- Specified by:
getSubTypes
in interfaceITypeDescriptor
- Returns:
- an immutable list of sub types.
-
setSuperTypes
Description copied from interface:ITypeDescriptor
Set the super types of the type. If the type is a mixin type, then all of the super types must be mixin types too. This should not include nt:base for node types.- Specified by:
setSuperTypes
in interfaceITypeDescriptor
- Parameters:
superTypes
- the list of super types
-
getDeclaredFields
Description copied from interface:ITypeDescriptor
The map of fields that are declared in this type. This does not include the fields that are declared in any of the super types. If the type is primitive, null will be returned.- Specified by:
getDeclaredFields
in interfaceITypeDescriptor
- Returns:
- the list of fields declared in the type
-
getFields
Description copied from interface:ITypeDescriptor
The map of fields that are declared in this type of any of its super types. If the type is primitive, null will be returned.- Specified by:
getFields
in interfaceITypeDescriptor
- Returns:
- an immutable list of fields in the type
-
getField
Description copied from interface:ITypeDescriptor
Retrieve the field associated with a key.- Specified by:
getField
in interfaceITypeDescriptor
- Returns:
- the field descriptor
-
addField
Description copied from interface:ITypeDescriptor
Add a field to the type.- Specified by:
addField
in interfaceITypeDescriptor
- Parameters:
field
- the field that is added to the type
-
removeField
Description copied from interface:ITypeDescriptor
Remove a field from the type.- Specified by:
removeField
in interfaceITypeDescriptor
- Parameters:
name
- the name of the field that is removed
-
setPrimary
Description copied from interface:ITypeDescriptor
Declare one of the fields to be the primary item. This is only valid when the field has been declared in the type, not in any of its super types. Additionally, none of the super types may have defined a primary item.- Specified by:
setPrimary
in interfaceITypeDescriptor
-
isNode
public boolean isNode()Description copied from interface:ITypeDescriptor
Is the type a compound or mixin type, corresponding to a node type. False for the primitive types or any of their pseudo variants.- Specified by:
isNode
in interfaceITypeDescriptor
- Returns:
- whether the type corresponds to a node type
-
setIsNode
public void setIsNode(boolean isNode) - Specified by:
setIsNode
in interfaceITypeDescriptor
-
isMixin
public boolean isMixin()Description copied from interface:ITypeDescriptor
Does the type correspond to a mixin, i.e. can it be added dynamically to a Node.- Specified by:
isMixin
in interfaceITypeDescriptor
- Returns:
- whether the type corresponds to a mixin node type
-
setIsMixin
public void setIsMixin(boolean isMixin) - Specified by:
setIsMixin
in interfaceITypeDescriptor
-
getValidators
Description copied from interface:ITypeDescriptor
The symbolic names for validators associated with this type.- Specified by:
getValidators
in interfaceITypeDescriptor
- Returns:
- the names of applicable validators
-
addValidator
- Specified by:
addValidator
in interfaceITypeDescriptor
-
isValidationCascaded
public boolean isValidationCascaded()Description copied from interface:ITypeDescriptor
Returns true if validation is cascaded, i.e. whether fields with this type are automatically validated. When false, the field needs the "required" validator to get the field value validated.- Specified by:
isValidationCascaded
in interfaceITypeDescriptor
- Returns:
- whether fields of the type are automatically validated
-
setIsValidationCascaded
public void setIsValidationCascaded(boolean isCascaded) - Specified by:
setIsValidationCascaded
in interfaceITypeDescriptor
- Parameters:
isCascaded
- are fields of this type always validated
-
setObservationContext
Description copied from interface:IObservable
Before observation is started on the observable, an observation context is injected by the observer registry. This context can be used to notify listeners.- Specified by:
setObservationContext
in interfaceIObservable
-
startObservation
public void startObservation()Description copied from interface:IObservable
When the firstIObserver
of this observable is registered with the observer registry, observation is started. Implementations must notify observers until observation is stopped.An implementation should register listeners with external data sources, when appropriate. It is possible for an observable to register as an observer for another observable.
- Specified by:
startObservation
in interfaceIObservable
-
stopObservation
public void stopObservation()Description copied from interface:IObservable
When the lastIObserver
unregisters, observation is stopped. Any listeners or observers registered by the observable must be unregistered by the implementation.- Specified by:
stopObservation
in interfaceIObservable
-
isType
Description copied from interface:ITypeDescriptor
Returns true if this type istypeName
or a subtype oftypeName
, otherwise returnsfalse
.- Specified by:
isType
in interfaceITypeDescriptor
- Parameters:
typeName
- the name of a node type.- Returns:
- a boolean
-
checkMutable
protected void checkMutable() -
isMutable
public boolean isMutable() -
setMutable
public void setMutable(boolean mutable) -
detach
public void detach()- Specified by:
detach
in interfaceorg.apache.wicket.model.IDetachable
-