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 Details

  • Method Details

    • getName

      public String 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 interface ITypeDescriptor
      Returns:
      name of the type
    • getType

      public String 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 interface ITypeDescriptor
      Returns:
      the name of the real (JCR) type
    • getSuperTypes

      public List<String> 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 interface ITypeDescriptor
      Returns:
      an immutable list of super types.
    • getSubTypes

      public List<ITypeDescriptor> getSubTypes()
      Description copied from interface: ITypeDescriptor
      Retrieve all types that descend from the type.
      Specified by:
      getSubTypes in interface ITypeDescriptor
      Returns:
      an immutable list of sub types.
    • setSuperTypes

      public void setSuperTypes(List<String> superTypes)
      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 interface ITypeDescriptor
      Parameters:
      superTypes - the list of super types
    • getDeclaredFields

      public Map<String,IFieldDescriptor> 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 interface ITypeDescriptor
      Returns:
      the list of fields declared in the type
    • getFields

      public Map<String,IFieldDescriptor> 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 interface ITypeDescriptor
      Returns:
      an immutable list of fields in the type
    • getField

      public IFieldDescriptor getField(String key)
      Description copied from interface: ITypeDescriptor
      Retrieve the field associated with a key.
      Specified by:
      getField in interface ITypeDescriptor
      Returns:
      the field descriptor
    • addField

      public void addField(IFieldDescriptor field)
      Description copied from interface: ITypeDescriptor
      Add a field to the type.
      Specified by:
      addField in interface ITypeDescriptor
      Parameters:
      field - the field that is added to the type
    • removeField

      public void removeField(String name)
      Description copied from interface: ITypeDescriptor
      Remove a field from the type.
      Specified by:
      removeField in interface ITypeDescriptor
      Parameters:
      name - the name of the field that is removed
    • setPrimary

      public void setPrimary(String name)
      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 interface ITypeDescriptor
    • 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 interface ITypeDescriptor
      Returns:
      whether the type corresponds to a node type
    • setIsNode

      public void setIsNode(boolean isNode)
      Specified by:
      setIsNode in interface ITypeDescriptor
    • 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 interface ITypeDescriptor
      Returns:
      whether the type corresponds to a mixin node type
    • setIsMixin

      public void setIsMixin(boolean isMixin)
      Specified by:
      setIsMixin in interface ITypeDescriptor
    • getValidators

      public Set<String> getValidators()
      Description copied from interface: ITypeDescriptor
      The symbolic names for validators associated with this type.
      Specified by:
      getValidators in interface ITypeDescriptor
      Returns:
      the names of applicable validators
    • addValidator

      public void addValidator(String validator)
      Specified by:
      addValidator in interface ITypeDescriptor
    • 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 interface ITypeDescriptor
      Returns:
      whether fields of the type are automatically validated
    • setIsValidationCascaded

      public void setIsValidationCascaded(boolean isCascaded)
      Specified by:
      setIsValidationCascaded in interface ITypeDescriptor
      Parameters:
      isCascaded - are fields of this type always validated
    • setObservationContext

      public void setObservationContext(IObservationContext context)
      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 interface IObservable
    • startObservation

      public void startObservation()
      Description copied from interface: IObservable
      When the first IObserver 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 interface IObservable
    • stopObservation

      public void stopObservation()
      Description copied from interface: IObservable
      When the last IObserver unregisters, observation is stopped. Any listeners or observers registered by the observable must be unregistered by the implementation.
      Specified by:
      stopObservation in interface IObservable
    • isType

      public boolean isType(String typeName)
      Description copied from interface: ITypeDescriptor
      Returns true if this type is typeName or a subtype of typeName, otherwise returns false.
      Specified by:
      isType in interface ITypeDescriptor
      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 interface org.apache.wicket.model.IDetachable