Beans Package
The org.apache.juneau.commons.bean package provides Juneau's bean-modeling layer — the annotations and introspection engine that describe how Java beans are recognized, read, written, and mapped, independently of any particular marshalling format. The marshalling modules build on this layer through a small set of SPI seams so the bean model stays decoupled from serialization concerns.
Bean Modeling Annotations
Annotations that control how classes and their properties are introspected.
BeanType
Applied to a class to control bean introspection and modeling — property inclusion/order, read-only/write-only properties, a custom PropertyNamer, a stop class, and more.
@BeanType(properties="id,name,city", propertyNamer=PropertyNamerDLC.class)
public class Address {
public String id, name, city;
}
BeanProp
Applied to fields, getters/setters, or constructor parameters to control property modeling — most commonly to override the property name via its value()/name().
public class Person {
@BeanProp("full-name")
public String getName() { ... }
}
BeanCtor
Maps constructor arguments to property names on beans with read-only properties.
public class Point {
public final int x, y;
@BeanCtor(properties="x,y")
public Point(int x, int y) { this.x = x; this.y = y; }
}
BeanIgnore
Excludes a class, field, method, or constructor from bean introspection.
public class Account {
public String username;
@BeanIgnore
public String getPasswordHash() { ... } // never treated as a bean property
}
Name
Specifies the parameter name used for bean property mapping (e.g. on a constructor parameter).
public Point(@Name("x") int x, @Name("y") int y) { ... }
BeanConfig
Specifies bean-modeling config properties (visibility rules, property-namer, not-bean packages/classes, etc.) on REST classes and methods.
Bean Introspection Runtime
The runtime types that hold and expose bean metadata.
BeanMeta
Encapsulates all access to the properties of a bean class (like a souped-up java.beans.BeanInfo). Obtained via the static factory.
BeanMeta<Address> bm = BeanMeta.of(Address.class);
BeanInfo
SPI seam exposing the type-classification surface (is-bean, element/key/value types, instantiation) that the bean-runtime types need without coupling the bean-modeling layer to the marshalling layer.
BeanMap
A Map-style wrapper around a Java bean, exposing its properties as map entries backed by BeanMeta.
BeanMap<Address> m = BeanMap.of(new Address());
m.put("city", "Portland");
Object city = m.get("city");
BeanMapEntry
Represents a single entry in a BeanMap.
BeanPropertyMeta
Contains metadata about a single bean property.
BeanPropertyValue
Represents a simple bean property value together with the metadata associated with it.
BeanSession
The minimum runtime surface the bean-modeling layer needs from a marshalling session.
BeanConfigContext
Immutable runtime configuration for the bean-modeling layer, built via its nested Builder.
Property Naming
Converts conventional bean property names into other conventions.
PropertyNamer
Defines the API for converting a conventional bean property name to some other form.
public interface PropertyNamer {
String getPropertyName(String name);
}
BasicPropertyNamer
The default namer — returns property names unchanged.
PropertyNamerDLC
Converts property names to dashed-lower-case format (fooBar → foo-bar).
PropertyNamerDUCS
Converts property names to dashed-upper-case-start format.
PropertyNamerULC
Converts property names to underscore-lower-case format (fooBar → foo_bar).
Property Validation
Optional schema-driven validation of bean-property values.
PropertyValidator
Validates a bean-property value against a schema, throwing SchemaValidationException on failure.
void validate(Object value) throws SchemaValidationException;
PropertyValidatorFactory
Builds PropertyValidator instances from a JSON-Schema-shaped map of constraints.
PropertyValidators
Discovery helper that locates a PropertyValidatorFactory via ServiceLoader.
Extension Points (SPI)
Seams that let the marshalling layer plug into the bean model without the bean-modeling package depending on marshalling.
BeanInterceptor
Intercepts bean property reads and writes, allowing values to be transformed during introspection. BeanInterceptor.Void is the non-existent (no-op) placeholder.
BeanFilter
Exposes the per-class filter surface the bean-runtime types need, decoupled from the marshalling-side filter.
BeanMetaInitializer
Exposes marshalling-aware BeanMeta construction hooks.
BeanPropertyPostProcessor
Applies marshalling-side post-processing to a BeanPropertyMeta.Builder after its validation succeeds.
BeanRegistryLookup
Exposes the dictionary-lookup surface the bean-runtime types need, decoupled from the marshalling-side bean registry.
BeanTypeResolver
Exposes the type-resolution operations that the bean-property validation pass needs from the marshalling layer.
Delegate
Marks an object that represents (wraps) another object.
BeanProxyInvocationHandler
Provides an InvocationHandler for creating dynamic proxy instances of bean interfaces.