Class ConfigurationFactory<SOURCE extends ConfigureSource<?,​?,​SOURCE>,​HOLDER extends ConfigurationHolder<SOURCE>,​SELF>

  • Type Parameters:
    SOURCE - The ConfigureSource type
    HOLDER - The ConfigurationHolder type.
    SELF - Self builder, for further implement support.

    public abstract class ConfigurationFactory<SOURCE extends ConfigureSource<?,​?,​SOURCE>,​HOLDER extends ConfigurationHolder<SOURCE>,​SELF>
    extends java.lang.Object
    ConfigurationFactory, used to create configuration holder.
    • Constructor Detail

      • ConfigurationFactory

        protected ConfigurationFactory()
    • Method Detail

      • self

        protected abstract SELF self()
      • adapter

        public <T> SELF adapter​(@NotNull
                                @NotNull ValueAdapter<T> adapter)
      • adapter

        public <FROM,​TO> SELF adapter​(@NotNull
                                            @NotNull java.lang.Class<FROM> from,
                                            @NotNull
                                            @NotNull java.lang.Class<TO> to,
                                            @NotNull
                                            @NotNull DataFunction<FROM,​TO> parser,
                                            @NotNull
                                            @NotNull DataFunction<TO,​FROM> serializer)
      • adapter

        public <FROM,​TO> SELF adapter​(@NotNull
                                            @NotNull ValueType<FROM> from,
                                            @NotNull
                                            @NotNull ValueType<TO> to,
                                            @NotNull
                                            @NotNull DataFunction<FROM,​TO> parser,
                                            @NotNull
                                            @NotNull DataFunction<TO,​FROM> serializer)
      • adapter

        public <T> SELF adapter​(@NotNull
                                @NotNull java.lang.Class<T> type,
                                @NotNull
                                @NotNull ValueSerializer<T> serializer,
                                @NotNull
                                @NotNull ValueParser<T> parser)
      • metadata

        public SELF metadata​(@NotNull
                             @NotNull java.util.function.Consumer<java.util.Map<java.lang.String,​ConfigurationMetaHolder>> handler)
      • metadata

        public SELF metadata​(@Nullable
                             @Nullable java.lang.String path,
                             @NotNull
                             @NotNull java.util.function.Consumer<ConfigurationMetaHolder> handler)
      • pathGenerator

        public SELF pathGenerator​(PathGenerator generator)
        Supply the base path generator for this configuration holder
        Parameters:
        generator - PathGenerator
        Returns:
        this
      • metaAnnotation

        public <M,​A extends java.lang.annotation.Annotation> SELF metaAnnotation​(@NotNull
                                                                                       @NotNull java.lang.Class<A> annotation,
                                                                                       @NotNull
                                                                                       @NotNull ConfigurationMetadata<M> metadata,
                                                                                       @NotNull
                                                                                       @NotNull java.util.function.Function<A,​M> extractor)
        Register a new annotation for metadata to the configuration loader
        Type Parameters:
        M - The metadata type
        A - The annotation type
        Parameters:
        annotation - The Annotation
        metadata - The ConfigurationMetadata type
        extractor - The Function to extract the metadata from the annotation
        Returns:
        this
      • validAnnotation

        public <A extends java.lang.annotation.Annotation> SELF validAnnotation​(@NotNull
                                                                                @NotNull java.lang.Class<A> annotation,
                                                                                @NotNull
                                                                                @NotNull java.util.function.Function<A,​ValueValidator<java.lang.Object>> builder)
        Register a new annotation for ValueValidator to the configuration loader
        Type Parameters:
        A - The annotation type
        Parameters:
        annotation - The Annotation
        builder - The Function to build the ValueValidator from the annotation
        Returns:
        this
      • build

        @NotNull
        public abstract HOLDER build()
        Build the configuration holder.
        Returns:
        The configuration holder