Annotation Type Attribute


  • @Retention(RUNTIME)
    @Target({FIELD,METHOD})
    public @interface Attribute
    Indicates that this property or the field value must be injected from an XML attribute in a configuration file.
    Author:
    Kohsuke Kawaguchi
    See Also:
    Element
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      Class dataType
      Specifies the data type.
      String defaultValue
      Specifies the default value of the attribute.
      boolean key
      Indicates that this property becomes the name of the component.
      boolean reference
      Indicates that this property is a reference to another configured inhabitant.
      boolean required
      Indicates that this attribute is required.
      String value
      Attribute name.
      boolean variableExpansion
      Indicates that the variable expansion should be performed on this proeprty.
    • Element Detail

      • value

        String value
        Attribute name.

        Default Name

        If this value is omitted, the default name is inferred from the field/method name. First, if this is a method and the name starts with "set", then "set" will be trimmed off.

        Then names are tokenized according to the camel case word separator, then tokens are combined with '-', then finally the whole thing is converted to the lower case.

        Therefore, for example, a field name "httpBufferSize" would yield "http-buffer-size", and a method name "setThreadCount" would yield "thread-count"

        Default:
        ""
      • key

        boolean key
        Indicates that this property becomes the name of the component. There can be only one key on a class.
        Default:
        false
      • required

        boolean required
        Indicates that this attribute is required.

        To specify the default value, simply use the field initializer to set it to a certain value. The field/method values are only set when the value is present.

        Default:
        false
      • reference

        boolean reference
        Indicates that this property is a reference to another configured inhabitant. See Element.reference() for more details of the semantics.

        When a reference property is a collection/array, then the key values are separated by ',' with surrounding whitespaces ignored. That is, it can be things like " foo , bar " (which would mean the same thing as "foo,bar".)

        Default:
        false
      • variableExpansion

        boolean variableExpansion
        Indicates that the variable expansion should be performed on this proeprty. See Element.variableExpansion() for more details.
        Default:
        true
      • defaultValue

        String defaultValue
        Specifies the default value of the attribute.
        Returns:
        default value as String
        Default:
        "\u0000"
      • dataType

        Class dataType
        Specifies the data type. It should be the fully qualified name of the class that identifies the real data type. For attributes that are of type defined by basic Java primitives (or wrappers), there is no need to specify this field. The default value is derived from method/field declaration.
        Returns:
        String specifying the name of the data type for the values of this attribute
        Default:
        java.lang.String.class