1. Michael Ludwig
  2. entreri

Commits

Michael Ludwig  committed 86513e2

Document Requires annotation

  • Participants
  • Parent commits 1bd1dcd
  • Branches default

Comments (0)

Files changed (1)

File src/main/java/com/lhkbob/entreri/Requires.java

View file
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
 
+/**
+ * <p>
+ * The Requires annotation can be used to specify dependencies within a package
+ * of components. If one component requires the use of another, such as a scene
+ * or light component needing a transform, this can be a convenient way to
+ * specify this relationship and reduce the amount of explicit configuration
+ * during entity initialization.
+ * <p>
+ * When a component type that has been annotated with this annotation is added
+ * to an entity, all required component types that are not already attached to
+ * the entity are added. All newly added components have their owner set to the
+ * initial component so that when it's removed, the required components are
+ * cleaned up as well.
+ * 
+ * @author Michael Ludwig
+ * 
+ */
 @Documented
 @Target(ElementType.TYPE)
 @Retention(RetentionPolicy.RUNTIME)
 public @interface Requires {
+    /**
+     * @return All ComponentData types required by the annotated component type
+     */
     Class<? extends ComponentData<?>>[] value();
 }