Annotation Interface LogConfigurable


Used to generate Rainbow Gum config builder objects that once built will call the method annotated with the properties from the generated builder on build. The method annotated is essentially a factory method that a builder will be generated to configure each parameter in the factory method. The build call on the builder will call the annotated factory method.

While there exist many annotation processors that generate builders (Immutables for example) the builders generated by this annotation (and corresponding processor) are LogProperties aware such that the builder can extract its arguments from LogProperties.

Here is an example:

class final SomeFactory {
	@LogConfigurable(name="MyPluginBuilder", prefix="logging.myplugin.{name}.")
	static MyPlugin of(@KeyParameter String name, Integer myParameter) {
		// do some additional logic.
		return new MyPlugin(name, myParameter);
	}
 }
The above will create a builder called MyPluginBuilder with a setter of myParameter and its constructor will take a String name argument.
MyPlugin plugin = new MyPluginBuilder("example").myParameter(80).fromProperties(properties).build();
The builder will try the property logging.myplugin.example.myParameter and use it if it exists to override the 80 value.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static @interface 
    Wall call a static method on the factory class (the class that contains the annotated LogConfigurable method) with the property value as a string to be converted.
    static @interface 
    Use to set static defaults to parameters.
    static @interface 
    Use as parameter to property keys with parameters.
    static @interface 
    A parameter not to be configured with properties that will just pass through to the build method.
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Property prefix to use for property lookup.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Name of builder.
  • Element Details

    • name

      Name of builder.
      Returns:
      name of builder by default if not set Builder will be suffixed to targetType.
      Default:
      ""
    • prefix

      Property prefix to use for property lookup. Usually these come from LogProperties string constants and have a parameter of "name". If the prefix has parameters they can be specified with LogConfigurable.KeyParameter as arguments on the static factory method.

      An example might be: "logging.component.{name}." which has a parameter of "name".

      Returns:
      prefix in general should end in ".".
      See Also: