All Known Implementing Classes:
DefaultBinder

public interface Binder
Binds config nodes to Java objects.

Supports both field injection and constructor binding.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Builder for creating customized Binder instances.
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> @NotNull BindingResult<T>
    bind(@NotNull ConfigNode node, @NotNull Class<T> type, @NotNull NamingStrategy namingStrategy)
    Binds a config node to a new instance of the target type.
    <T> @NotNull BindingResult<T>
    bind(@NotNull ConfigNode node, T instance, @NotNull NamingStrategy namingStrategy)
    Binds config values onto an existing instance (field injection only).
    static @NotNull Binder.Builder
    Creates a binder builder with custom options.
    static @NotNull Binder
    Creates a default binder.
    <T> void
    unbind(T object, @NotNull MutableConfigNode node, @NotNull NamingStrategy namingStrategy)
    Serializes an object to a config node.
  • Method Details

    • bind

      @NotNull <T> @NotNull BindingResult<T> bind(@NotNull @NotNull ConfigNode node, @NotNull @NotNull Class<T> type, @NotNull @NotNull NamingStrategy namingStrategy)
      Binds a config node to a new instance of the target type.
      Type Parameters:
      T - the type parameter
      Parameters:
      node - the source node
      type - the target type
      namingStrategy - the naming strategy for field to config key conversion
      Returns:
      the binding result
    • bind

      @NotNull <T> @NotNull BindingResult<T> bind(@NotNull @NotNull ConfigNode node, @NotNull T instance, @NotNull @NotNull NamingStrategy namingStrategy)
      Binds config values onto an existing instance (field injection only).
      Type Parameters:
      T - the type parameter
      Parameters:
      node - the source node
      instance - the target instance
      namingStrategy - the naming strategy for field to config key conversion
      Returns:
      the binding result
    • unbind

      <T> void unbind(@NotNull T object, @NotNull @NotNull MutableConfigNode node, @NotNull @NotNull NamingStrategy namingStrategy)
      Serializes an object to a config node.
      Type Parameters:
      T - the type parameter
      Parameters:
      object - the object to serialize
      node - the target node
      namingStrategy - the naming strategy for field to config key conversion
    • builder

      @NotNull static @NotNull Binder.Builder builder()
      Creates a binder builder with custom options.
      Returns:
      a new builder
    • create

      @NotNull static @NotNull Binder create()
      Creates a default binder.
      Returns:
      a new binder