Annotation Type FieldDeclaration


@Target(METHOD)
@Retention(RUNTIME)
public @interface FieldDeclaration

Marks a method as a field declaration. New field's name becomes this annotation's name() parameter or the annotated method's name if the name() is empty.

The annotated method must be non-void and have a single argument. The argument's type denotes the fact type that we want to declare a new field on. The method's return type becomes the field's type.

The annotated method can use both instance and static class members to compute field value.

  • Optional Element Summary

    Optional Elements
    Modifier and Type Optional Element Description
    String name  
  • Element Details

    • name

      String name
      Default:
      ""