Annotation Interface InjectedValue


@Target(FIELD) @Retention(RUNTIME) @Documented public @interface InjectedValue
This annotations is intended to be placed on NamedConfigValue elements to emulate key-value pairs in configuration schemas.

Therefore, this annotation induces the following constraints:

  1. Must be placed on a field of a configuration schema that represents a Named List element;
  2. Must be the only field in the configuration schema, apart from the one marked with InjectedName.

In all other aspects it behaves exactly like the Value annotation.

For example, this annotation can be used to declare a configuration schema with arbitrary String properties:

 @Config
 class PropertyConfigurationSchema {
    @NamedConfigValue
     public PropertyEntryConfigurationSchema properties;
 }
 @Config
 class PropertyEntryConfigurationSchema {
    @InjectedName
     public String propertyName;

    @InjectedValue
     public String propertyValue;
 }

This will allow to use the following HOCON to represent this configuration:


     root.properties {
         property1: "value1",
         property2: "value2",
         property3: "value3"
     }
 
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Indicates that the current configuration value has a default value.
  • Element Details

    • hasDefault

      boolean hasDefault
      Indicates that the current configuration value has a default value. Value itself is derived from the instantiated object of a corresponding schema type. This means that the default is not necessarily a constant value.
      Returns:
      hasDefault flag value.
      Default:
      false