Class JdbiImmutables

    • Constructor Summary

      Constructors 
      Constructor Description
      JdbiImmutables()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private static <S> java.lang.Class<? extends S> classByPrefix​(java.lang.String prefix, java.lang.Class<S> spec)  
      private static <S> java.util.function.Supplier<S> constructorOf​(java.lang.Class<S> impl)  
      JdbiImmutables createCopy()
      Returns a copy of this configuration object.
      private static java.util.Optional<java.util.function.Supplier<?>> nullaryMethodOf​(java.lang.Class<?> impl, java.lang.String methodName)  
      private JdbiImmutables register​(java.lang.Class<?> spec, java.lang.Class<?> impl, PojoPropertiesFactory factory)  
      JdbiImmutables registerImmutable​(java.lang.Class<?>... specs)
      Convenience method for registering many immutable types.
      <S> JdbiImmutables registerImmutable​(java.lang.Class<S> spec)
      Register bean arguments and row mapping for an Immutable* value class, expecting the default generated class and builder names.
      <S,​I extends S>
      JdbiImmutables
      registerImmutable​(java.lang.Class<S> spec, java.lang.Class<I> impl, java.util.function.Supplier<?> builder)
      Register bean arguments and row mapping for an Immutable* value class, using a supplied implementation and builder.
      JdbiImmutables registerImmutable​(java.lang.Iterable<java.lang.Class<?>> specs)
      Convenience method for registering many immutable types.
      JdbiImmutables registerModifiable​(java.lang.Class<?>... specs)
      Convenience method for registering many modifiable types.
      <S> JdbiImmutables registerModifiable​(java.lang.Class<S> spec)
      Register bean arguments and row mapping for an Modifiable* value class, expecting the default generated class and public nullary constructor.
      <S,​M extends S>
      JdbiImmutables
      registerModifiable​(java.lang.Class<S> spec, java.lang.Class<M> impl, java.util.function.Supplier<?> constructor)
      Register bean arguments and row mapping for an Modifiable* value class, using a supplied implementation and constructor.
      JdbiImmutables registerModifiable​(java.lang.Iterable<java.lang.Class<?>> specs)
      Convenience method for registering many modifiable types.
      void setRegistry​(ConfigRegistry registry)
      The registry will inject itself into the configuration object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JdbiImmutables

        public JdbiImmutables()
    • Method Detail

      • setRegistry

        public void setRegistry​(ConfigRegistry registry)
        Description copied from interface: JdbiConfig
        The registry will inject itself into the configuration object. This can be useful if you need to look up dependencies. You will get a new registry after being copied.
        Specified by:
        setRegistry in interface JdbiConfig<JdbiImmutables>
        Parameters:
        registry - the registry that owns this configuration object
      • registerImmutable

        public <S> JdbiImmutables registerImmutable​(java.lang.Class<S> spec)
        Register bean arguments and row mapping for an Immutable* value class, expecting the default generated class and builder names.
        Type Parameters:
        S - the specification class
        Parameters:
        spec - the specification interface or abstract class
        Returns:
        a plugin that configures type mapping for the given class
      • registerImmutable

        public JdbiImmutables registerImmutable​(java.lang.Iterable<java.lang.Class<?>> specs)
        Convenience method for registering many immutable types.
        See Also:
        registerImmutable(Class)
      • registerImmutable

        public <S,​I extends S> JdbiImmutables registerImmutable​(java.lang.Class<S> spec,
                                                                      java.lang.Class<I> impl,
                                                                      java.util.function.Supplier<?> builder)
        Register bean arguments and row mapping for an Immutable* value class, using a supplied implementation and builder.
        Type Parameters:
        S - the specification class
        I - the implementation class
        Parameters:
        spec - the specification interface or abstract class
        impl - the generated implementation class
        builder - a supplier of new Builder instances
        Returns:
        a plugin that configures type mapping for the given class
      • registerModifiable

        public JdbiImmutables registerModifiable​(java.lang.Iterable<java.lang.Class<?>> specs)
        Convenience method for registering many modifiable types.
        See Also:
        registerModifiable(Class)
      • registerModifiable

        public <S> JdbiImmutables registerModifiable​(java.lang.Class<S> spec)
        Register bean arguments and row mapping for an Modifiable* value class, expecting the default generated class and public nullary constructor.
        Type Parameters:
        S - the specification class
        Parameters:
        spec - the specification interface or abstract class
        Returns:
        a plugin that configures type mapping for the given class
      • registerModifiable

        public <S,​M extends S> JdbiImmutables registerModifiable​(java.lang.Class<S> spec,
                                                                       java.lang.Class<M> impl,
                                                                       java.util.function.Supplier<?> constructor)
        Register bean arguments and row mapping for an Modifiable* value class, using a supplied implementation and constructor.
        Type Parameters:
        S - the specification class
        M - the modifiable class
        Parameters:
        spec - the specification interface or abstract class
        impl - the modifiable class
        constructor - a supplier of new Modifiable instances
        Returns:
        a plugin that configures type mapping for the given class
      • nullaryMethodOf

        private static java.util.Optional<java.util.function.Supplier<?>> nullaryMethodOf​(java.lang.Class<?> impl,
                                                                                          java.lang.String methodName)
      • constructorOf

        private static <S> java.util.function.Supplier<S> constructorOf​(java.lang.Class<S> impl)
      • classByPrefix

        private static <S> java.lang.Class<? extends S> classByPrefix​(java.lang.String prefix,
                                                                      java.lang.Class<S> spec)
      • createCopy

        public JdbiImmutables createCopy()
        Description copied from interface: JdbiConfig
        Returns a copy of this configuration object. Changes to the copy should not modify the original, and vice-versa.
        Specified by:
        createCopy in interface JdbiConfig<JdbiImmutables>
        Returns:
        a copy of this configuration object.