Interface EnumOf<T extends EnumValue<V>,​V>

  • Type Parameters:
    T - enum type
    V - internal value type of enum
    All Known Implementing Classes:
    RouteType, StopLocationType

    public interface EnumOf<T extends EnumValue<V>,​V>
    Interface that deals with injecting way to create an enum based on its internal enum value through EnumValue, e.g. and enum can implement this interface and EnumValue, then call createFromValues(Supplier, Object) where the supplier is its values() method and the value is some value that is attached to the enum instance. It will then find that matching instance and return it.
    • Method Detail

      • createFromValues

        default <T> T createFromValues​(Supplier<T[]> enumValuesSupplier,
                                       V value)
        Create an enum instance from a list of options based on its internal value
        Type Parameters:
        T - type of the supplier
        Parameters:
        enumValuesSupplier - the supplier to use
        value - internal value to extract enum for
        Returns:
        the corresponding enum found, null when not present