aboutsummaryrefslogtreecommitdiffstats
path: root/component
diff options
context:
space:
mode:
authorgjoranv <gv@oath.com>2018-11-22 12:09:02 +0100
committergjoranv <gv@oath.com>2019-01-21 15:09:28 +0100
commit48ec139ba2d75545be4654b71740ce7745a6ec75 (patch)
tree5f62b2c634d868582e7712276010359d96942267 /component
parent1ac7c6fd57d85b7dfe028faf430c7afa75b3c9bc (diff)
Add comments to AbstractComponent constructors.
Diffstat (limited to 'component')
-rw-r--r--component/src/main/java/com/yahoo/component/AbstractComponent.java15
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))