Class GraphEntity

java.lang.Object
redis.clients.jedis.graph.entities.GraphEntity
Direct Known Subclasses:
Edge, Node

public abstract class GraphEntity extends Object
This is an abstract class for representing a graph entity. A graph entity has an id and a set of properties. The properties are mapped and accessed by their names.
  • Field Details

    • id

      protected long id
    • propertyMap

      protected final Map<String,Property<?>> propertyMap
  • Constructor Details

    • GraphEntity

      public GraphEntity()
    • GraphEntity

      public GraphEntity(int propertiesCapacity)
      Use this constructor to reduce memory allocations when properties are added to the edge
      Parameters:
      propertiesCapacity - preallocate the capacity for the properties
  • Method Details

    • getId

      public long getId()
      Returns:
      entity id
    • setId

      public void setId(long id)
      Parameters:
      id - - entity id to be set
    • addProperty

      public void addProperty(String name, Object value)
      Adds a property to the entity, by composing name, type and value to a property object
      Parameters:
      name -
      value -
    • getEntityPropertyNames

      public Set<String> getEntityPropertyNames()
      Returns:
      Entity's property names, as a Set
    • addProperty

      public void addProperty(Property property)
      Add a property to the entity
      Parameters:
      property -
    • getNumberOfProperties

      public int getNumberOfProperties()
      Returns:
      number of properties
    • getProperty

      public Property getProperty(String propertyName)
      Parameters:
      propertyName - - property name as lookup key (String)
      Returns:
      property object, or null if key is not found
    • removeProperty

      public void removeProperty(String name)
      Parameters:
      name - - the name of the property to be removed
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

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