Class MetaBean<T>

java.lang.Object
org.apache.activemq.artemis.utils.bean.MetaBean<T>

public class MetaBean<T> extends Object
Receives a metadata about a class with methods to read, write and certain gates. And provides a generic logic to convert to and from JSON.

As a historical context the first try to make a few objects more dynamic (e.g. AddressSettings) was around BeanUtils however there was some implicit logic on when certain settings were Null or default values. for that reason I decided for a meta-data approach where extra semantic could be applied for each individual attributes rather than a generic BeanUtils parser.

  • Constructor Details

    • MetaBean

      public MetaBean()
  • Method Details

    • add

      public MetaBean add(Class type, String name, BiConsumer<T,? extends Object> setter, Function<T,? extends Object> getter, Predicate<T> gate)
      Accepted types:
      • String.class
      • SimpleString.class
      • Integer.class
      • Long.class
      • Double.class
      • Float.class
      • Enumerations
    • add

      public <Z> MetaBean add(Class<Z> type, String name, BiConsumer<T,Z> setter, Function<T,Z> getter)
    • toJSON

      public JsonObject toJSON(T object, boolean ignoreNullAttributes)
    • parseToJSON

      public void parseToJSON(T object, JsonObjectBuilder builder, boolean ignoreNullAttributes)
    • setRandom

      public void setRandom(T randomObject)
      Generates a random Object using the setters for testing purposes.
    • copy

      public void copy(T source, T target)
    • forEach

      public void forEach(MetaBean.MetadataListener listener)
    • fromJSON

      public void fromJSON(T resultObject, String jsonString)