@Target({TYPE,CONSTRUCTOR}) public @interface AutoFactory
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.
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.
|
String className
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
.
Class<?>[] implementing
Class<?> extending
Copyright © 2019 Google, Inc.. All rights reserved.