@Documented @Target(value=TYPE) @Retention(value=RUNTIME) @Inherited public @interface Bean
This annotation can be applied to classes and interfaces.
Modifier and Type | Optional Element and Description |
---|---|
Class<?>[] |
beanDictionary
Bean dictionary.
|
String |
excludeProperties
Specifies a list of properties that should be excluded from
BeanMap.entrySet() . |
Class<?> |
interfaceClass
Identifies a class to be used as the interface class for this and all subclasses.
|
String |
properties
The set and order of names of properties associated with a bean class.
|
Class<? extends PropertyFilter> |
propertyFilter
Property filter.
|
Class<? extends PropertyNamer> |
propertyNamer
Associates a
PropertyNamer with this bean to tailor the names of the bean properties. |
boolean |
sort
Sort bean properties in alphabetical order.
|
Class<?> |
stopClass
Identifies a stop class for the annotated class.
|
String |
typeName
An identifying name for this class.
|
String |
typePropertyName
The property name to use for representing the type name.
|
public abstract Class<?>[] beanDictionary
The list of classes that make up the bean dictionary for all properties in this class and all subclasses.
public abstract String excludeProperties
BeanMap.entrySet()
.
public abstract Class<?> interfaceClass
When specified, only the list of properties defined on the interface class will be used during serialization. Additional properties on subclasses will be ignored.
Note that this annotation can be used on the parent class so that it filters to all child classes, or can be set individually on the child classes.
public abstract String properties
The order specified is the same order that the entries will be returned by the BeanMap.entrySet()
and
related methods.
This value is entirely optional if you simply want to expose all the getters and public fields on
a class as bean properties.
However, it's useful if you want certain getters to be ignored or you want the properties to be
serialized in a particular order.
Note that on IBM JREs, the property order is the same as the order in the source code,
whereas on Oracle JREs, the order is entirely random.
public abstract Class<? extends PropertyFilter> propertyFilter
Property filters can be used to intercept calls to getters and setters and alter their values in transit.
public abstract Class<? extends PropertyNamer> propertyNamer
PropertyNamer
with this bean to tailor the names of the bean properties.
Property namers are used to transform bean property names from standard form to some other form.
public abstract boolean sort
When
Otherwise, the natural order of the bean properties is used which is dependent on the JVM vendor.
public abstract Class<?> stopClass
Identical in purpose to the stop class specified by Introspector.getBeanInfo(Class, Class)
.
Any properties in the stop class or in its base classes will be ignored during analysis.
For example, in the following class hierarchy, instances of C3
will include property p3
,
but not p1
or p2
.
public abstract String typeName
The name is used to identify the class type during parsing when it cannot be inferred through reflection.
For example, if a bean property is of type Object
, then the serializer will add the name to the
output so that the class can be determined during parsing.
It is also used to specify element names in XML.
public abstract String typePropertyName
This can be used to override the name used for the typeName()
setting.
The default value if not specified is
Copyright © 2018 Apache. All rights reserved.