JBG Features

JBG supports the features listed in this document. The features follow from the XSD file.

Settings on multiple beans

  • beans:keep-collections-not-null (yes | no): when set to yes, all collection properties are guaranteed to never be null
  • beans:to-string-properties (own | all): when set to own, only properties of simple types are included in toString() method; otherwise all properties are included
  • beans:chainable-setters (yes | no): when set to yes, the setter methods are chainable, i.e. each setter returns this (the current instance of the bean)
  • beans:final-accessors (no | yes): when set to no, the getter/setter methods are not declared final

Settings on a bean

  • bean:class: specifies the class of the bean
  • bean:extends: the class that the bean extends
  • bean:implements: the interfaces (comma-separated) that the bean implements
  • bean:final (yes | no): when set to yes, the bean class is declared final
  • bean:assume-instance-of: type to which instance of the bean is cast to when required
  • bean:serializable-with-id: Make the bean serializable (implement java.io.Serializable) with the given serialVersionUID.
  • description: a set of descriptions of the bean; propagates to JavaDoc and report
  • annotation: A set of Java annotations of the bean
  • property: bean has a set of properties
  • additional-code: an arbitrary additional piece of Java source code to be included in the bean; this is provided as extension point for other generators making use of JBG

Settings on a property

  • property:name: the name of the property
  • property:status (default | business-key | supplementary):
    Set the status of a property to business-key to include it in hashCode() and equals().
    Set it to supplementary to exclude it from these methods.
    By default, all properties are included.
  • description: a set of descriptions of the property; propagates to JavaDoc and report
  • A property is of one of the following types:
    • simple-type: The property is of one of the simple types.
    • bean-type: The property relates to another bean.
    • sequence: The property relates to a sequence of other beans.
  • annotation: A set of Java annotations of the property

Simple types

  • simple-type:type: one of the following:
    • string: corresponds to java.lang.String
    • byte: corresponds to byte
    • int: corresponds to java.lang.Integer
    • long: corresponds to java.lang.Long
    • float: corresponds to java.lang.Float
    • double: corresponds to java.lang.Double
    • boolean: corresponds to java.lang.Boolean
    • date: corresponds to java.util.Date with timestamp semantics, e.g. prints in toString() like 2009-12-31T12:59:58.123+0100
    • calendar: corresponds to java.util.Calendar with timestamp semantics, e.g. prints in toString() like 2009-12-31T12:59:58.123+0100
    • enum: corresponds either to java.lang.Enum<?> if no simple-type:class is specified, or to the class provided in simple-type:class
  • simple-type:class: specifies the class of the enum simple type

Bean type

  • bean-type:type: the Java type of the property
  • bean-type:reverse-property-name: when this property is one side of a two-way relation between beans, specify the name of the reverse property on the related bean to accomplish automatic maintenance of consistent values on both sides of the relation.
  • bean-type:treat-as-simple: Set to 'true' to treat the property as a simple one. When set, the property is included in equals, hasCode and toString and also in the constructor for simple properties.
  • bean-type:separate-reverse-setter: Set to 'false' to include the setting of the reverse side property within default setter. By default, a separate setter is generated.

Sequence type

  • sequence:type (collection | list | array): either java.util.Collection, java.util.List or Java array
  • Sequence consists of either:
    • bean-type: specification of the bean type contained in the sequence
    • simple-type: specification of the simple type contained in the sequence