@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
Deprecated.
Use
dictionary() . |
String |
bpi
Bean property includes.
|
String |
bpro
Read-only bean properties.
|
String |
bpwo
Write-only bean properties.
|
String |
bpx
Bean property excludes.
|
Class<?>[] |
dictionary
Bean dictionary.
|
String |
excludeProperties
Deprecated.
Use
bpx() |
boolean |
fluentSetters
Find fluent setters.
|
Class<?> |
interfaceClass
Identifies a class to be used as the interface class for this and all subclasses.
|
String |
properties
Deprecated.
Use
bpi() |
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.
|
@Deprecated public abstract Class<?>[] beanDictionary
dictionary()
.The list of classes that make up the bean dictionary for all properties in this class and all subclasses.
public abstract String bpi
The set and order of names of properties associated with a bean class.
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 String bpx
Specifies a list of properties that should be excluded from BeanMap.entrySet()
.
public abstract String bpro
Specifies one or more properties on a bean that are read-only despite having valid getters. Serializers will serialize such properties as usual, but parsers will silently ignore them.
public abstract String bpwo
Specifies one or more properties on a bean that are write-only despite having valid setters. Parsers will parse such properties as usual, but serializers will silently ignore them.
public abstract Class<?>[] dictionary
The list of classes that make up the bean dictionary for all properties in this class and all subclasses.
@Deprecated public abstract String excludeProperties
bpx()
BeanMap.entrySet()
.public abstract boolean fluentSetters
When
Fluent setters
Fluent setters must have the following attributes:
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.
@Deprecated public abstract String properties
bpi()
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
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
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 © 2016–2019 The Apache Software Foundation. All rights reserved.