Enum ModelProp.Option

    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      DoNotHash
      By default every prop's hashCode and equals method is called when determining the model's state.
      GenerateStringOverloads
      Setters with a type of CharSequence can add this option to have StringRes and PluralsRes overload methods generated on the model, so users can set the string via a resource.
      IgnoreRequireHashCode
      This is meant to be used in conjunction with PackageEpoxyConfig.requireHashCode().
      NullOnRecycle
      Setters with a param annotated with @Nullable can use this to have null set when the view is recycled.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static ModelProp.Option valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static ModelProp.Option[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • DoNotHash

        public static final ModelProp.Option DoNotHash
        By default every prop's hashCode and equals method is called when determining the model's state. This option can be used to exclude an prop's hashCode/equals from contributing to the state.

        This is useful for props 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 prop 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 prop is, "If this is the only prop 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 ModelProp.Option IgnoreRequireHashCode
        This is meant to be used in conjunction with PackageEpoxyConfig.requireHashCode(). When that is enabled every prop must implement hashCode/equals. However, there are some valid cases where the prop 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 prop 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 prop at runtime correctly implements hashCode/equals. If you don't want the prop to contribute to model state you should use DoNotHash instead.

      • GenerateStringOverloads

        public static final ModelProp.Option GenerateStringOverloads
        Setters with a type of CharSequence can add this option to have StringRes and PluralsRes overload methods generated on the model, so users can set the string via a resource.
      • NullOnRecycle

        public static final ModelProp.Option NullOnRecycle
        Setters with a param annotated with @Nullable can use this to have null set when the view is recycled.
    • Method Detail

      • values

        public static ModelProp.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 (ModelProp.Option c : ModelProp.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 ModelProp.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 name
        java.lang.NullPointerException - if the argument is null