Enum EpoxyAttribute.Option
- java.lang.Object
-
- java.lang.Enum<EpoxyAttribute.Option>
-
- com.airbnb.epoxy.EpoxyAttribute.Option
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<EpoxyAttribute.Option>
- Enclosing class:
- EpoxyAttribute
public static enum EpoxyAttribute.Option extends java.lang.Enum<EpoxyAttribute.Option>
Options that can be included on the attribute to affect how the model's generated class is created.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description DoNotHashBy default every attribute's hashCode and equals method is called when determining the model's state.DoNotUseInToStringThis attribute is used inObject.toString()implementation by default.IgnoreRequireHashCodeThis is meant to be used in conjunction withPackageEpoxyConfig.requireHashCode().NoGetterA getter is generated for this attribute by default.NoSetterA setter is generated for this attribute by default.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static EpoxyAttribute.OptionvalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static EpoxyAttribute.Option[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
NoGetter
public static final EpoxyAttribute.Option NoGetter
A getter is generated for this attribute by default. Add this option to prevent a getter from being generated.
-
NoSetter
public static final EpoxyAttribute.Option NoSetter
A setter is generated for this attribute by default. Add this option to prevent a setter from being generated.
-
DoNotHash
public static final EpoxyAttribute.Option DoNotHash
By default every attribute's hashCode and equals method is called when determining the model's state. This option can be used to exclude an attribute's hashCode/equals from contributing to the state.This is useful for objects that may change without actually changing the model's state. A common case is an anonymous click listener that gets recreated with every bind call.
When this is used, the attribute will affect the model state solely based on whether it is null or non null.
A good rule of thumb for whether to use this on an attribute is, "If this is the only attribute that changed do I still need to rebind and update the view?" If the answer if no then you can use this to prevent the rebind.
-
IgnoreRequireHashCode
public static final EpoxyAttribute.Option IgnoreRequireHashCode
This is meant to be used in conjunction withPackageEpoxyConfig.requireHashCode(). When that is enabled every attribute must implement hashCode/equals. However, there are some valid cases where the attribute type does not implement hashCode/equals, but it should still be hashed at runtime and contribute to the model's state. Use this option on an attribute in that case to tell the processor to let it pass the hashCode/equals validation.An example case is AutoValue classes, where the generated class correctly implements hashCode/equals at runtime.
If you use this it is your responsibility to ensure that the object assigned to the attribute at runtime correctly implements hashCode/equals. If you don't want the attribute to contribute to model state you should use
DoNotHashinstead.
-
DoNotUseInToString
public static final EpoxyAttribute.Option DoNotUseInToString
This attribute is used inObject.toString()implementation by default. Add this option to prevent this attribute being used inObject.toString().
-
-
Method Detail
-
values
public static EpoxyAttribute.Option[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (EpoxyAttribute.Option c : EpoxyAttribute.Option.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static EpoxyAttribute.Option valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
-