Interface HasCode<T>

  • Type Parameters:
    T - type of code
    All Superinterfaces:
    java.io.Serializable
    All Known Subinterfaces:
    LanguageInfo, TranslationInfo
    All Known Implementing Classes:
    Language, TextFormat

    public interface HasCode<T>
    extends java.io.Serializable
    Interface which indicates that class should have code.
    • Method Detail

      • code

        @Nonnull
        T code()
        Get code value.
        Returns:
        code
      • findByCode

        @Nonnull
        static <T,​E extends HasCode<T>> java.util.Optional<E> findByCode​(@Nullable
                                                                               java.util.Collection<E> collection,
                                                                               @Nullable
                                                                               T code)
        Find find corresponding HasCode element from collection by code.
        Type Parameters:
        T - type of code value
        E - kind of HasCode elements
        Parameters:
        collection - collection with HasCode instances.
        code - code value
        Returns:
        element from collection with the corresponding code or null otherwise