it.negro.jajb.annotation
Annotation Type FieldAnnotation


@Retention(value=RUNTIME)
@Target(value=METHOD)
public @interface FieldAnnotation

This Annotation can be used to describe the properties of the JavaObjects that you would use for JSON binding. FieldAnnotation is a Method annotation and can be use only for Method. If you don't use the EntityAnnotation for the "container" Bean, all of used FieldAnnotation will be ignored and there will be a mirror binding between json and bean.

Author:
Gabriele Negro

Required Element Summary
 java.lang.String name
          This is the name of the property of the correspondent JSONObject.
 
Optional Element Summary
 java.lang.Class<?> collectionType
          If the property is an array, or collection, or set, you can use "collectionType".
 java.lang.Class<?> converter
          With converter you can specify a particular Converter implementation for the property.
 java.lang.Class<?> factory
          With factory you can specify a particular it.dangelo.javabinding.factory.BindingFactory implementation for the property.
 java.lang.String getter
          With getter you can specify a getter with different name respect to property.
 java.lang.String property
          You can initialize property, if you want use different name for JSONObject attribute name if is different the Bean property name.
 java.lang.String refId
          If the property is another bean, you should initialize refId with the id of the bean that you should have described.
 java.lang.String setter
          Setter have to functions: 1) You can specify a setter with different name respect to property.
 java.lang.Class<?> type
          This is the Class of the property.
 

Element Detail

name

public abstract java.lang.String name
This is the name of the property of the correspondent JSONObject. It's mandatory.

Returns:

type

public abstract java.lang.Class<?> type
This is the Class of the property. It's mandatory.

Returns:
Default:
it.negro.jajb.annotation.Default.class

property

public abstract java.lang.String property
You can initialize property, if you want use different name for JSONObject attribute name if is different the Bean property name. If not initialized, it will be the same of "name". It's optional.

Returns:
Default:
""

refId

public abstract java.lang.String refId
If the property is another bean, you should initialize refId with the id of the bean that you should have described. If you don't describe the bean, refId will be automatically initialize with Class name of the Bean. It's optional

Returns:
Default:
""

collectionType

public abstract java.lang.Class<?> collectionType
If the property is an array, or collection, or set, you can use "collectionType". You can initialize it using the Class of the collection you want (for example LinkedList.class, String[].class, int[].class, etc.). It's optional.

Returns:
Default:
it.negro.jajb.annotation.Default.class

factory

public abstract java.lang.Class<?> factory
With factory you can specify a particular it.dangelo.javabinding.factory.BindingFactory implementation for the property. You have to initialize it with the Class of your factory (MyFactory.class). It's optional

Returns:
Default:
it.negro.jajb.annotation.Default.class

converter

public abstract java.lang.Class<?> converter
With converter you can specify a particular Converter implementation for the property. You have to initialize it with the Class of your converter (for example MyConverter.class) It's optional

Returns:
Default:
it.negro.jajb.annotation.Default.class

setter

public abstract java.lang.String setter
Setter have to functions: 1) You can specify a setter with different name respect to property.
2) You can use "%N", where N may be 0, 1, 2, 3,.... a number; in this case, it means that the property in accessible (for setting) only through a constructor, and you must implement a constructor with correct type and order of parameters. It's optional.

Returns:
Default:
""

getter

public abstract java.lang.String getter
With getter you can specify a getter with different name respect to property. It's optional.

Returns:
Default:
""


Copyright © 2008. All Rights Reserved.