Class StaticAttribute<T,​R>

  • Type Parameters:
    T - the class of the item this attribute maps into.
    R - the class that the value of this attribute converts to.

    @ThreadSafe
    public final class StaticAttribute<T,​R>
    extends Object
    A class that represents an attribute that can be read from and written to an mapped item. A StaticTableSchema composes multiple attributes that map to a common item class.

    The recommended way to use this class is by calling StaticTableSchema.Builder.addAttribute(Class, Consumer). Example:

    
     StaticTableSchema.builder()
                      .addAttribute(String.class,
                                    a -> a.name("customer_name").getter(Customer::getName).setter(Customer::setName))
                      // ...
                      .build();
     

    It's also possible to construct this class on its own using the static builder. Example:

    
     StaticAttribute<Customer, ?> customerNameAttribute =
         StaticAttribute.builder(Customer.class, String.class)
                        .name("customer_name")
                        .getter(Customer::getName)
                        .setter(Customer::setName)
                        .build();