Interface DatatypeRegistry

All Known Implementing Classes:
DatatypeRegistryImpl

public interface DatatypeRegistry
Registry for Datatypes
  • Method Details

    • get

      Datatype<?> get(String id)
      Get Datatype instance by its unique id
      Returns:
      Datatype instance
      Throws:
      IllegalArgumentException - if no datatype with the given name found
    • find

      @Nullable Datatype<?> find(String id)
      Get Datatype instance by id.
      Returns:
      Datatype instance or null if not found
    • find

      @Nullable <T> Datatype<T> find(Class<T> javaClass)
      Get Datatype instance by the corresponding Java class. This method tries to find matching supertype too.
      Returns:
      Datatype instance or null if not found
    • get

      <T> Datatype<T> get(Class<T> javaClass)
      Get Datatype instance by the corresponding Java class. This method tries to find matching supertype too.
      Returns:
      Datatype instance
      Throws:
      IllegalArgumentException - if no datatype suitable for the given type found
    • getId

      String getId(Datatype<?> datatype)
      Returns an ID of the given datatype in the registry.
      Throws:
      IllegalArgumentException - if the datatype is not registered
    • getIdOptional

      Optional<String> getIdOptional(Datatype<?> datatype)
      Returns:
      the ID of the given datatype wrapped in Optional if it found in the registry, otherwise an empty Optional.
    • getIdByJavaClass

      String getIdByJavaClass(Class<?> javaClass)
      Returns an ID of a first datatype handling the given Java class.
      Throws:
      IllegalArgumentException - if no datatypes handle the given Java class
    • getIdByJavaClassOptional

      Optional<String> getIdByJavaClassOptional(Class<?> javaClass)
      Returns:
      the ID of a first datatype handling the given Java class wrapped in Optional if it found, otherwise an empty Optional.
    • getIds

      Set<String> getIds()
      Returns:
      all registered datatype identifiers.
    • register

      void register(Datatype<?> datatype, String id, boolean defaultForJavaClass)
      Register a datatype instance
      Parameters:
      datatype - datatype instance
      id - unique registration id
      defaultForJavaClass - true if the datatype should be default for a Java class handled by this datatype