Annotation Interface PostConstructionInitializer.InitializedParam
- Enclosing class:
PostConstructionInitializer
@Target(PARAMETER)
@Retention(RUNTIME)
public static @interface PostConstructionInitializer.InitializedParam
Marks a specific parameter in a static initializer method as being the initialized object. This
disambiguates situations where static initializer methods accept multiple arguments of the same
initialize-required type; for example:
class Foo {
@PostConstructionInitializer
static void copy(Foo src, @InitializedParam Foo dst) {
// ...
}
}
Static initializer methods must have a parameter of the exact type that defines the static method.
interface I {
@PostConstructionInitializer
static void init(I object) { ... }
}
class Foo implements I {
@PostConstructionInitializer
static void initFoo(Foo foo) { ... } // OK
@PostConstructionInitializer
static void initI(I object) { ... } // ERROR: I is not Foo
@PostConstructionInitializer
static void initOther(SomeOtherType o) { ... } // ERROR: SomeOtherType is not Foo
}