io.sphere.sdk.attributes.AttributeGetterSetter Maven / Gradle / Ivy
package io.sphere.sdk.attributes;
/**
* Type-safe attribute access
*
* Style A: Declare attribute description by providing a static method
* This style is useful if you have a few product types.
*
*
* The usage:
*
* {@include.example io.sphere.sdk.products.attributeaccess.staticmethodstyle.Usage#demo()}
* The declaration:
*
* {@include.example io.sphere.sdk.products.attributeaccess.staticmethodstyle.TShirt}
*
*
*
*
*
* Style B: Declare attribute description by providing a static field
* This style is useful if you have a few product types.
*
* The usage:
*
* {@include.example io.sphere.sdk.products.attributeaccess.staticattributestyle.Usage#demo()}
*
*
* The declaration:
*
* {@include.example io.sphere.sdk.products.attributeaccess.staticattributestyle.TShirt}
*
*
*
*
* Style C: Declare attribute description by providing interfaces and static accessors
* This is useful if you have a hierarchy of product types. It uses default implementations for interfaces to simulate multiple inheritance.
*
*
* The usage:
*
* {@include.example io.sphere.sdk.products.attributeaccess.interfacesstaticmethodstyle.Usage#demo()}
*
* The declaration:
*
* Create groups of attributes:
* {@include.example io.sphere.sdk.products.attributeaccess.interfacesstaticmethodstyle.WithLongDescription}
* {@include.example io.sphere.sdk.products.attributeaccess.interfacesstaticmethodstyle.WithColor}
* {@include.example io.sphere.sdk.products.attributeaccess.interfacesstaticmethodstyle.WithPromoMoney}
*
* Mixin the the attributes:
* {@include.example io.sphere.sdk.products.attributeaccess.interfacesstaticmethodstyle.TShirt}
*
*/
public interface AttributeGetterSetter extends AttributeGetter, AttributeSetter {
public static AttributeGetterSetter of(final String name, final AttributeMapper mapper) {
return new AttributeGetterSetterImpl<>(name, mapper);
}
}