{8.1.0-updated, 8.1.2-updated} @Beanp Annotation
The {@link oaj.annotation.Beanp @Beanp} annotation is used to tailor how individual bean properties are interpreted by the framework.
The {@link oaj.annotation.Beanp#name() @Beanp(name)} annotation is used to override the name of the bean property.
The {@link oaj.annotation.Name @Name} annotation is a shortcut for specifying a bean property name:
If the {@link oaj.BeanContext#BEAN_beanFieldVisibility} setting on the bean context excludes this field (e.g. the visibility is set to the default of PUBLIC, but the field is PROTECTED), this annotation can be used to force the field to be identified as a property.
The bean property named
The following shows various ways of using dynamic bean properties.
Similar rules apply for value types and swaps. The property values optionally can be any serializable type or use swaps.
The {@link oaj.annotation.Beanp#value() @Beanp(value)} annotation is a synonym for {@link oaj.annotation.Beanp#name() @Beanp(name)}. Use it in cases where you're only specifying a name so that you can shorten your annotation.
The following annotations are equivalent:
The {@link oaj.annotation.Beanp#type() @Beanp(type)} annotation is used to identify a specialized class type for a generalized property. Normally the type is inferred through reflection of the field type or getter return type. However, you'll want to specify this value if you're parsing beans where the bean property class is an interface or abstract class to identify the bean type to instantiate. Otherwise, you may cause an {@link java.lang.InstantiationException} when trying to set these fields.
This property must denote a concrete class with a no-arg constructor.
The {@link oaj.annotation.BeanProperty#params() @Beanp(params)} annotation is for bean properties of type map or collection. It's used to identify the class types of the contents of the bean property object when the general parameter types are interfaces or abstract classes.
The {@link oaj.annotation.Beanp#properties() @Beanp(properties)} annotation is used to limit which child properties are rendered by the serializers. It can be used on any of the following bean property types:
The {@link oaj.annotation.Beanp#format() @Beanp(format)} annotation specifies a String format for converting a bean property value to a formatted string.