Current uses of JavaBeans
This document is an attempt to capture as many uses of JavaBeans v1.0 as possible. If you know of an open source project (or an interesting closed source one) that makes use of the JavaBeans v1.0 spec in some way, we’d love to have it listed here.
Serialization tools
- General purpose, widely used, serialization, originally JSON, but now many formats.
- Getter/setter pattern for basic data binding.
- Annotations can be used for extra control.
- Can use getters for collections as effective setters.
- Direct field access can be used.
- Non public getters/setters can be used.
- Constructors/factories handled using annotations. See creators.
- Can generate bytecode to avoid reflection. See afterburner.
- Has “property missing” support.
- Uses getter/setter pattern and no-args constructors.
- Also uses fields.
- Non public getters/setters/fields can be used.
- Can use constructors, handling immutable objects, either by annotation or bytecode analysis. source
- Can use factories, handling immutable objects, by annotation.
- Serialize/deserialize to/from bean source.
- Property mutator and accessor.
- Property.
JSR-353
- Does not appear to use JavaBeans.
JAXB
- General purpose XML serialization.
- Getter/setter pattern.
- Direct field access can be used.
- TODO
- TODO
- Support for XML, CSV, delimited and fixed length stream formats
- XML, Java annotations or builder API based field mapping
- General abstraction over beans and properties
- Property accessor works on PropertyDescriptor, constructor parameters, fields and maps
public interface Property { int type(); // simple, complex, array, collection, map, aggregation array/collection String getName(); void clearValue(ParsingContext context); Object createValue(ParsingContext context); Object getValue(ParsingContext context); void setValue(ParsingContext context, Object value); boolean defines(Object value); boolean isIdentifier(); void setIdentifier(boolean identifier); PropertyAccessor getAccessor(); void setAccessor(PropertyAccessor accessor); Class<?> getType(); void setType(Class<?> type); }
public interface PropertyAccessor { Object getValue(Object bean); void setValue(Object bean, Object value); boolean isConstructorArgument(); int getConstructorArgumentIndex(); }
Database tools
Hibernate
- Tool to generate JPA metamodel
- TODO
- Key-Value
- TODO
JPA
DevWorks on JPA metamodel
Bean mapping tools
- General purpose mapper, operating by annotation processor.
- Uses getter/setter pattern and no-args constructors.
- Can use getters for collections as effective setters.
- Can use adders for collections as effective setters.
- Can match simple plural property names for collections.
- Additional coding handles immutable objects.
- General purpose mapper, operating by Javassist.
- Uses java.beans Introspector, with additional handling. Code.
- Has own Property class.
- Uses getter/setter pattern.
- Can be specified to use constructors, using Paranamer.
- Has plugin point for factories and unusual constructors.
- Can access list indices and map keys.
- Can use non-standard methods via stringly-typed syntax or builder.
- General purpose mapper, operating by Commons BeanUtils.
- Eclipse GUI for editing XML based mapping files, annotation/Java config too.
- Uses getter/setter pattern and no-args constructors.
- Support for factories, details unclear.
- Can access private fields.
- Handles custom getter/setter names.
- Handles adder methods.
- Property access source code
- General purpose mapper, operating by Javassist.
- Uses getter/setter pattern and no-args constructors.
- Unable to find source code for introspecting.
- General purpose mapper, operating by Commons BeanUtils.
- Handles DynaBeans.
- Uses getter/setter pattern and no-args constructors.
- Little documentation, last release 2008.
- Property access source code
- General purpose mapper, with abstraction of bean access.
- Uses getter/setter pattern and no-args constructors, and other approaches.
- Has a BeanReflector
- Also has a ContainerReflector
- Many reflector implementations
- The JavaBean reflector
- Simulates java.beans introspector
- Reflector has similarities to Beans v2.0.
- Last release 2008.
- General purpose mapper.
- Uses getter/setter pattern and no-args constructors.
- Providers allow for other object creation approaches, but still needs setters.
- Can match non-public methods and fields.
- Can read data from non-beans using ValueReader.
- Has PropertyInfo.
- General purpose mapper, operating by reflection.
- Uses getter/setter pattern and no-args constructors. source
- Simulates java.beans introspector
- Can map bean to/from Map.
- Little documentation, last release 2013.
- General purpose mapper.
- GUI tool that generates Java source code.
- Uses getter/setter pattern and no-args constructors.
- Uses java.beans Introspector.
- Little documentation, last commit 2005.
- General purpose data event based data transformation.
- Uses getter/setter pattern and no-args constructors.
- Support for factory methods to create objects.
- Some support for setting fields directly.
Web GUIs
- Beans to web GUI (naked objects)
- Supports standard getters and setters
- Supports collections and lists but not maps
- Uses annotations to add some additional control of what is exposed
- Beans to JavaFX GUI
- Relies on reflection of Field instances
- Property class
- interface over type 2 or 3, implementations provided to access bean via methods or to hold state
public interface Property<T> { getType() getValue() isReadOnly() setReadOnly(boolean flag) setValue(T value) }
- Can generate getter/setter by annotation
- Property interface
- interface of type 1
- implementations for getter/setter pair, field, one parameter (in a constructor or method), and a stateful one?
- also has type conversion
- located in an advanced package, not for general use
public interface Property { Property createChild(int index) // access nested generic type info of List<Map<String, Integer>> String getName() Class<?> getPropertyType() Object getValue(Object bean) void setValue(Object bean, Object value) }
Templating tools
- Abstracts data access, one implementation is based on JavaBeans.
- Uses getters.
- Uses java.beans Introspector. source
Velocity
- TODO
Utilities
OGNL
Bean validation
- Solution must work with bean validation
- Package to replace java.beans
- Includes type 1 property
- Javadoc
Other
- type 2/3 property interface
public interface Property { void addPropertyChangeListener(PropertyChangeListener listener) void addVetoableChangeListener(VetoableChangeListener listener) void clearValue() String getName() Object getSourceBean() Object getValue() boolean isReporting() boolean isVetoable() void notifyListeners() void removePropertyChangeListener(PropertyChangeListener listener) void removeVetoableChangeListener(VetoableChangeListener listener) void setReporting(boolean reportChanges) void setValue(Object newValue) void setValueAndNotifyListeners(Object newValue) }
- type 2/3 property interface
public interface Property { String[] getAllowedValues() String getDescription() Editor getEditor() IndexedProperty getIndexedProperty() String getName() Class getType() Object getValue() boolean isExpert() boolean isHidden() boolean isPreferred() boolean isReadOnly() void setValue(Object arg) }