nl.gx.webmanager.jcr.annotation
Annotation Type Property


@Retention(value=RUNTIME)
@Target(value=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
 java.lang.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.
 java.lang.String name
          Specifies the name of this property for in the repository.
 int type
          Specifies the JCR-170 property type to use.
 

name

public abstract java.lang.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

public abstract 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

public abstract 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

public abstract 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

public abstract java.lang.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:
{}


Copyright © 2007-2011 GX Software BV. All Rights Reserved.