diff options
author | gjoranv <gv@oath.com> | 2018-11-22 12:09:02 +0100 |
---|---|---|
committer | gjoranv <gv@oath.com> | 2019-01-21 15:09:28 +0100 |
commit | 48ec139ba2d75545be4654b71740ce7745a6ec75 (patch) | |
tree | 5f62b2c634d868582e7712276010359d96942267 /component/src | |
parent | 1ac7c6fd57d85b7dfe028faf430c7afa75b3c9bc (diff) |
Add comments to AbstractComponent constructors.
Diffstat (limited to 'component/src')
-rw-r--r-- | component/src/main/java/com/yahoo/component/AbstractComponent.java | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/component/src/main/java/com/yahoo/component/AbstractComponent.java b/component/src/main/java/com/yahoo/component/AbstractComponent.java index 41d4c0dc6e9..fb093c7e24c 100644 --- a/component/src/main/java/com/yahoo/component/AbstractComponent.java +++ b/component/src/main/java/com/yahoo/component/AbstractComponent.java @@ -24,7 +24,17 @@ public class AbstractComponent implements Component { protected final boolean isDeconstructable; /** + * Creates a new component which is invalid until {@link #initId} is called on it. + * The dependency injection framework (DI) will always set the id, so components to be created + * via DI do not have to implement other constructors, and should not set the id themselves. + */ + protected AbstractComponent() { + isDeconstructable = setIsDeconstructable(); + } + + /** * Creates a new component with an id. + * Only for testing and components that are not created via dependency injection. * * @throws NullPointerException if the given id is null */ @@ -33,11 +43,6 @@ public class AbstractComponent implements Component { isDeconstructable = setIsDeconstructable(); } - /** Creates a new component which is invalid until {@link #initId} is called on it. */ - protected AbstractComponent() { - isDeconstructable = setIsDeconstructable(); - } - /** Initializes this. Always called from a constructor or the framework. Do not call. */ public final void initId(ComponentId id) { if (this.id != null && !this.id.equals(id)) |