Class specification

java.lang.Object
name.moore.kevin.ze.components.specification
All Implemented Interfaces:
com.simsilica.es.EntityComponent, iEntityReference

public class specification extends Object implements com.simsilica.es.EntityComponent, iEntityReference
An entity with this component has a specification available and this component points to it.

An example would be a planet, it has a specification that describes the physical characteristics of that planet (a planetSpec) This component provides a reference to that planetSpec entity.

Also stored are some useful data that we typically want access to through the reference. Since we have that data at the point of creating this component, store it here rather than having to follow through the reference every time. Since specifications are not altered at runtime the data won't become stale.

Author:
Kevin Moore <dev@kevin.moore.name>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private String
    Unique String identity of the spec eg "E01".
    private com.simsilica.es.EntityId
     
    private Class
    The class of things with this specification eg "engine.class"
  • Constructor Summary

    Constructors
    Constructor
    Description
    specification​(com.simsilica.es.EntityId ref, String key, Class type)
    Set the EntityId of this specification.
  • Method Summary

    Modifier and Type
    Method
    Description
     
    com.simsilica.es.EntityId
    The EntityId of the entity referred to.
    The class of things with this specification eg "engine.class"
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • reference

      private com.simsilica.es.EntityId reference
    • key

      private String key
      Unique String identity of the spec eg "E01".
    • type

      private final Class type
      The class of things with this specification eg "engine.class"
  • Constructor Details

    • specification

      public specification(com.simsilica.es.EntityId ref, String key, Class type)
      Set the EntityId of this specification.
      Parameters:
      ref -
      key -
      type - engine.class
  • Method Details

    • getReference

      public com.simsilica.es.EntityId getReference()
      Description copied from interface: iEntityReference
      The EntityId of the entity referred to.

      This may be EntityId.NULL_ID if the entity has not yet been located.

      Specified by:
      getReference in interface iEntityReference
      Returns:
    • getKey

      public String getKey()
      Returns:
    • getType

      public Class getType()
      The class of things with this specification eg "engine.class"
      Returns:
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Returns: