Class JavaBeanAttributesCollector

java.lang.Object
org.immutables.value.processor.meta.JavaBeanAttributesCollector

final class JavaBeanAttributesCollector extends Object
Collects attributes by scanning for getters/setters/fields in a class definition.

Current logic is as follows:

  1. Collect getters (no-arg, non-static, non-void methods). Infer attribute names using JavaBean spec.
  2. Collect setters (single-arg, non-static, void methods). Infer attribute names using JavaBean spec.
  3. Collect (non-static) fields including from parent classes. Add alternative field names using primitive heuristics like underscore '_' removal or first letter decapitalization.
Intersection between getter / setter and field names is final attribute set. Created ValueAttribute will point to field element. For now we don't allow "derived" attributes and require fields to be present.

It is important that attributes are serialized otherwise using criteria on non-marshalable attribute(s) doesn't make sense (we may provide attribute renaming strategies in future). For each getFoo method (without parameters) create attribute foo.

See Also: