Package org.apache.juneau
Class BeanMeta<T>
java.lang.Object
org.apache.juneau.BeanMeta<T>
- Type Parameters:
- T- The class type that this metadata applies to.
- Direct Known Subclasses:
- BeanMetaFiltered
Encapsulates all access to the properties of a bean class (like a souped-up 
BeanInfo).
 Description
Uses introspection to find all the properties associated with this class. If the@Bean annotation
   is present on the class, then that information is used to determine the properties on the class.
 Otherwise, the BeanInfo functionality in Java is used to determine the properties on the class.
 Bean property ordering
The order of the properties are as follows:- 
      If @Beanannotation is specified on class, then the order is the same as the list of properties in the annotation.
- 
      If @Beanannotation is not specified on the class, then the order is based on the following.- Public fields (same order as Class.getFields()).
- Properties returned by BeanInfo.getPropertyDescriptors().
- Non-standard getters/setters with @Beanpannotation defined on them.
 
- Public fields (same order as 
See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected final BeanFilterOptional bean filter associated with the target class.The target class that this meta object describes.The target class type that this meta object describes.protected final ConstructorInfoThe constructor for this bean.protected final String[]For beans with constructors with Beanc annotation, this is the list of constructor arg properties.protected final BeanContextThe bean context that created this metadata object.The getter properties on the target class.protected final Map<String,BeanPropertyMeta> The hidden properties on the target class.protected final Map<String,BeanPropertyMeta> The properties on the target class.protected final BeanPropertyMeta[]The properties on the target class.The setter properties on the target class.Type variables implemented by this bean.
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedBeanMeta(ClassMeta<T> classMeta, BeanContext ctx, BeanFilter beanFilter, String[] pNames, ConstructorInfo implClassConstructor) Constructor.
- 
Method SummaryModifier and TypeMethodDescriptionboolean<T2> Optional<T2>firstProperty(Predicate<BeanPropertyMeta> filter, Function<BeanPropertyMeta, T2> function) Performs a function on the first property that matches the specified filter.voidforEachProperty(Predicate<BeanPropertyMeta> filter, Consumer<BeanPropertyMeta> action) Performs an action on all matching properties.Returns theClassMetaof this bean.final StringReturns the dictionary name for this bean as defined through the@Bean(typeName)annotation.getPropertyMeta(String name) Returns metadata about the specified property.Returns the metadata on all properties associated with this bean.final BeanPropertyMetaReturns a mock bean property that resolves to the name"_type" and whose value always resolves to the dictionary name of the bean.inthashCode()protected TCreates a new instance of this bean.onReadProperty(Object bean, String name, Object value) Property read interceptor.onWriteProperty(Object bean, String name, Object value) Property write interceptor.toString()
- 
Field Details- 
classMetaThe target class type that this meta object describes.
- 
cThe target class that this meta object describes.
- 
propertiesThe properties on the target class.
- 
propertyArrayThe properties on the target class.
- 
getterPropsThe getter properties on the target class.
- 
setterPropsThe setter properties on the target class.
- 
ctxThe bean context that created this metadata object.
- 
beanFilterOptional bean filter associated with the target class.
- 
typeVarImplsType variables implemented by this bean.
- 
constructorThe constructor for this bean.
- 
constructorArgsFor beans with constructors with Beanc annotation, this is the list of constructor arg properties.
 
- 
- 
Constructor Details- 
BeanMetaprotected BeanMeta(ClassMeta<T> classMeta, BeanContext ctx, BeanFilter beanFilter, String[] pNames, ConstructorInfo implClassConstructor) Constructor.- Parameters:
- classMeta- The target class.
- ctx- The bean context that created this object.
- beanFilter- Optional bean filter associated with the target class. Can be- null .
- pNames- Explicit list of property names and order of properties. If- null , determine automatically.
- implClassConstructor- The constructor to use if one cannot be found. Can be- null .
 
 
- 
- 
Method Details- 
getClassMetaReturns theClassMetaof this bean.- Returns:
- The ClassMetaof this bean.
 
- 
getDictionaryNameReturns the dictionary name for this bean as defined through the@Bean(typeName)annotation.- Returns:
- The dictionary name for this bean, or null if it has no dictionary name defined.
 
- 
getTypePropertyReturns a mock bean property that resolves to the name"_type" and whose value always resolves to the dictionary name of the bean.- Returns:
- The type name property.
 
- 
getPropertyMetasReturns the metadata on all properties associated with this bean.- Returns:
- Metadata on all properties associated with this bean.
 
- 
forEachPropertyPerforms an action on all matching properties.- Parameters:
- filter- The filter to apply.
- action- The action to apply.
 
- 
firstPropertypublic <T2> Optional<T2> firstProperty(Predicate<BeanPropertyMeta> filter, Function<BeanPropertyMeta, T2> function) Performs a function on the first property that matches the specified filter.- Type Parameters:
- T2- The type to convert the property to.
- Parameters:
- filter- The filter to apply.
- function- The function to apply to the matching property.
- Returns:
- The result of the function.  Never null .
 
- 
getPropertyMetaReturns metadata about the specified property.- Parameters:
- name- The name of the property on this bean.
- Returns:
- The metadata about the property, or null if no such property exists on this bean.
 
- 
newBeanCreates a new instance of this bean.- Parameters:
- outer- The outer object if bean class is a non-static inner member class.
- Returns:
- A new instance of this bean if possible, or null if not.
- Throws:
- ExecutableException- Exception occurred on invoked constructor/method/field.
 
- 
onReadPropertyProperty read interceptor.Called immediately after calling the getter to allow the value to be overridden. - Parameters:
- bean- The bean from which the property was read.
- name- The property name.
- value- The value just extracted from calling the bean getter.
- Returns:
- The value to serialize. Default is just to return the existing value.
 
- 
onWritePropertyProperty write interceptor.Called immediately before calling theh setter to allow value to be overwridden. - Parameters:
- bean- The bean from which the property was read.
- name- The property name.
- value- The value just parsed.
- Returns:
- The value to serialize. Default is just to return the existing value.
 
- 
toString
- 
hashCode
- 
equals
 
-