Class Property.Builder<T,V>

java.lang.Object
org.apache.juneau.commons.reflect.Property.Builder<T,V>
Type Parameters:
T - The object type.
V - The value type.
Enclosing class:
Property<T,V>

public static class Property.Builder<T,V> extends Object
Builder for constructing Property instances.
  • Constructor Details

  • Method Details

    • getter

      public Property.Builder<T,V> getter(ThrowingFunction<T,V> producer)
      Sets the producer (getter) using a function.
      Parameters:
      producer - The producer function. Can be null.
      Returns:
      This object.
    • setter

      Sets the consumer (setter) using a throwing consumer.
      Parameters:
      consumer - The consumer function. Can be null.
      Returns:
      This object.
    • field

      public Property.Builder<T,V> field(FieldInfo field)
      Sets both getter and setter from a FieldInfo.

      This is a convenience method that creates both producer and consumer from a field.

      Parameters:
      field - The field info. Must not be null.
      Returns:
      This object.
    • getter

      public Property.Builder<T,V> getter(MethodInfo method)
      Sets the producer (getter) from a MethodInfo.

      The method should take no parameters and return the property value.

      Parameters:
      method - The method info. Must not be null.
      Returns:
      This object.
    • setter

      public Property.Builder<T,V> setter(MethodInfo method)
      Sets the consumer (setter) from a MethodInfo.

      The method should take one parameter (the value to set) and return void.

      Parameters:
      method - The method info. Must not be null.
      Returns:
      This object.
    • build

      public Property<T,V> build()
      Builds the property instance.
      Returns:
      A new property instance.