Annotation Type Property


  • @Retention(RUNTIME)
    @Target(METHOD)
    public @interface Property
    Mark a getter as JCR property. The return type of the method is used to determine the datatype of this property in the repository. If the return type is an array, then the property will automatically be marked as multiple in the repository. Non-primitive types (e.g. classes) are mapped to JCR references and a constraint is created to automatically limit the target node type to that specified by the annotated method's return type. This annotation can not be used in combination with @child. See JSR-170 specification section 4.7.
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      String[] constraints
      Add constraints for this item.
      boolean mandatory
      Specifies whether the property is mandatory.
      boolean multiple
      Specifies whether the property can have more than one value.
      String name
      Specifies the name of this property for in the repository.
      int type
      Specifies the JCR-170 property type to use.
    • Element Detail

      • name

        String name
        Specifies the name of this property for in the repository. Defaults to the name of the method without the prefix "set" or "get" if present, and using the same namespace as the @nodetype annotation.
        Default:
        ""
      • type

        int type
        Specifies the JCR-170 property type to use. This can be one of the constants defined in javax.jcr.PropertyType. If this is not specified, then the property type used is derived from the return type. Java primitive types are mapped to their corresponding JCR-170 type.
        Default:
        0
      • mandatory

        boolean mandatory
        Specifies whether the property is mandatory. Defaults to false. If using in conjunction with multiple beware a mandatory property can have zero values.
        Default:
        false
      • multiple

        boolean multiple
        Specifies whether the property can have more than one value. Defaults to whether the method returns an array. Useful for setting to true when the method's return type is a container type (e.g. List), instead of an Java array.
        Default:
        false
      • constraints

        String[] constraints
        Add constraints for this item. The exact meaning of the values of this variable is described in the JSR-170 specification section 6.7.16.
        Default:
        {}