Annotation Type AutoFactory


  • @Target({TYPE,CONSTRUCTOR})
    public @interface AutoFactory
    An annotation to be applied to elements for which a factory should be automatically generated.

    Visibility

    The visibility of the generated factories will always be either public or default visibility. The visibility of any given factory method is determined by the visibility of the type being created. The generated factory is public if any of the factory methods are. Any method that implements an interface method is necessarily public and any method that overrides an abstract method has the same visibility as that method.

    Author:
    Gregory Kick
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      boolean allowSubclasses
      Whether or not the generated factory should be final.
      String className
      The simple name of the generated factory; the factory is always generated in the same package as the annotated type.
      Class<?> extending
      The type that the generated factory is require to extend.
      Class<?>[] implementing
      A list of interfaces that the generated factory is required to implement.
    • Element Detail

      • className

        String className
        The simple name of the generated factory; the factory is always generated in the same package as the annotated type. The default value (the empty string) will result in a factory with the name of the type being created with Factory appended to the end. For example, the default name for a factory for MyType will be MyTypeFactory.

        If the annotated type is nested, then the generated factory's name will start with the enclosing type names, separated by underscores. For example, the default name for a factory for Outer.Inner.ReallyInner is Outer_Inner_ReallyInnerFactory. If className is Foo, then the factory name is Outer_Inner_Foo.

        Default:
        ""
      • implementing

        Class<?>[] implementing
        A list of interfaces that the generated factory is required to implement.
        Default:
        {}
      • extending

        Class<?> extending
        The type that the generated factory is require to extend.
        Default:
        java.lang.Object.class
      • allowSubclasses

        boolean allowSubclasses
        Whether or not the generated factory should be final. Defaults to disallowing subclasses (generating the factory as final).
        Default:
        false