T - the type of the beanMetaBean, TypedMetaBean<T>public final class MinimalMetaBean<T extends Bean> extends java.lang.Object implements TypedMetaBean<T>
| Modifier and Type | Method | Description |
|---|---|---|
java.lang.Class<T> |
beanType() |
Get the type of the bean, represented as a
Class. |
BeanBuilder<T> |
builder() |
Creates a bean builder that can be used to create an instance of this bean.
|
boolean |
equals(java.lang.Object obj) |
|
int |
hashCode() |
|
boolean |
isBuildable() |
Checks whether this bean is buildable or not.
|
<R> MetaProperty<R> |
metaProperty(java.lang.String propertyName) |
Gets a meta-property by name.
|
java.util.Map<java.lang.String,MetaProperty<?>> |
metaPropertyMap() |
Gets the map of meta-properties, keyed by property name.
|
static <B extends Bean> |
of(java.lang.Class<B> beanType,
java.lang.String[] fieldNames,
java.util.function.Supplier<BeanBuilder<B>> builderSupplier,
java.util.function.Function<B,java.lang.Object>... getters) |
Obtains an instance of the meta-bean for immutable beans.
|
static <B extends Bean> |
of(java.lang.Class<B> beanType,
java.lang.String[] fieldNames,
java.util.function.Supplier<BeanBuilder<B>> builderSupplier,
java.util.List<java.util.function.Function<B,java.lang.Object>> getters,
java.util.List<java.util.function.BiConsumer<B,java.lang.Object>> setters) |
Obtains an instance of the meta-bean for mutable beans.
|
static <B extends Bean> |
of(java.lang.Class<B> beanType,
java.util.function.Supplier<BeanBuilder<B>> builderSupplier,
java.util.function.Function<B,java.lang.Object>... getters) |
Deprecated.
Use version that takes the field names
|
static <B extends Bean> |
of(java.lang.Class<B> beanType,
java.util.function.Supplier<BeanBuilder<B>> builderSupplier,
java.util.List<java.util.function.Function<B,java.lang.Object>> getters,
java.util.List<java.util.function.BiConsumer<B,java.lang.Object>> setters) |
Deprecated.
Use version that takes the field names
|
java.lang.String |
toString() |
Returns a string that summarises the meta-bean.
|
MinimalMetaBean<T> |
withAlias(java.lang.String alias,
java.lang.String realName) |
Adds an alias to the meta-bean.
|
annotation, annotations, beanName, metaPropertyCount, metaPropertyExists, metaPropertyIterable, of, register@Deprecated @SafeVarargs public static <B extends Bean> MinimalMetaBean<B> of(java.lang.Class<B> beanType, java.util.function.Supplier<BeanBuilder<B>> builderSupplier, java.util.function.Function<B,java.lang.Object>... getters)
The properties will be determined using reflection to find the
PropertyDefinition annotation.
B - the type of the beanbeanType - the bean type, not nullbuilderSupplier - the supplier of bean builders, not nullgetters - the getter functions, not null@SafeVarargs public static <B extends Bean> MinimalMetaBean<B> of(java.lang.Class<B> beanType, java.lang.String[] fieldNames, java.util.function.Supplier<BeanBuilder<B>> builderSupplier, java.util.function.Function<B,java.lang.Object>... getters)
The properties will be determined using reflection to find the
PropertyDefinition annotation.
The field names must be specified as reflection does not return fields in source code order.
B - the type of the beanbeanType - the bean type, not nullfieldNames - the field names, not nullbuilderSupplier - the supplier of bean builders, not nullgetters - the getter functions, not null@Deprecated public static <B extends Bean> MinimalMetaBean<B> of(java.lang.Class<B> beanType, java.util.function.Supplier<BeanBuilder<B>> builderSupplier, java.util.List<java.util.function.Function<B,java.lang.Object>> getters, java.util.List<java.util.function.BiConsumer<B,java.lang.Object>> setters)
The properties will be determined using reflection to find the
PropertyDefinition annotation.
B - the type of the beanbeanType - the bean type, not nullbuilderSupplier - the supplier of bean builders, not nullgetters - the getter functions, not nullsetters - the setter functions, not nullpublic static <B extends Bean> MinimalMetaBean<B> of(java.lang.Class<B> beanType, java.lang.String[] fieldNames, java.util.function.Supplier<BeanBuilder<B>> builderSupplier, java.util.List<java.util.function.Function<B,java.lang.Object>> getters, java.util.List<java.util.function.BiConsumer<B,java.lang.Object>> setters)
The properties will be determined using reflection to find the
PropertyDefinition annotation.
The field names must be specified as reflection does not return fields in source code order.
B - the type of the beanbeanType - the bean type, not nullfieldNames - the field names, not nullbuilderSupplier - the supplier of bean builders, not nullgetters - the getter functions, not nullsetters - the setter functions, not nullpublic MinimalMetaBean<T> withAlias(java.lang.String alias, java.lang.String realName)
When using metaProperty(String), the alias will return the
meta-property of the real name.
alias - the aliasrealName - the real namejava.lang.IllegalArgumentException - if the realName is invalidpublic boolean isBuildable()
MetaBean
A buildable bean can be constructed using MetaBean.builder().
If this method returns true then builder() must return a valid builder.
If this method returns false then builder() must throw UnsupportedOperationException.
isBuildable in interface MetaBeanpublic BeanBuilder<T> builder()
MetaBeanThe builder is used in two main ways. The first is to allow immutable beans to be constructed. The second is to enable automated tools like serialization/deserialization.
The builder can be thought of as a Map of MetaProperty to value.
Note that the implementation is not necessarily an actual map.
public java.lang.Class<T> beanType()
MetaBeanClass.
A MetaBean can be thought of as the equivalent of Class but for beans.
This method allows the actual Class instance of the bean to be obtained.
public <R> MetaProperty<R> metaProperty(java.lang.String propertyName)
MetaBeanEach meta-bean manages a single bean with a known set of properties. This method returns the property with the specified name.
The base interface throws an exception if the name is not recognised.
By contrast, the DynamicMetaBean subinterface creates the property on demand.
metaProperty in interface MetaBeanR - the property type, optional, enabling auto-castingpropertyName - the property name to retrieve, not nullpublic java.util.Map<java.lang.String,MetaProperty<?>> metaPropertyMap()
MetaBean
Where possible, use MetaBean.metaPropertyIterable() instead as it typically has better performance.
metaPropertyMap in interface MetaBeanpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2007–2018 Joda.org. All rights reserved.