Class StorageObject

java.lang.Object
com.codingchili.core.testing.StorageObject
All Implemented Interfaces:
Storable, io.vertx.core.shareddata.Shareable, Serializable, Cloneable, Comparable

public class StorageObject extends Object implements Storable
Test class to simulate a stored object.
See Also:
Serialized Form
  • Field Details

  • Constructor Details

    • StorageObject

      public StorageObject()
    • StorageObject

      public StorageObject(String name, Integer level)
  • Method Details

    • getLevel

      public Integer getLevel()
    • setLevel

      public StorageObject setLevel(Integer level)
    • getId

      public String getId()
      Description copied from interface: Storable
      Get the id of the storable item, used as a key to the map api. This field is not included when serializing to JSON. When serializing to json the id must be kept separately.

      instead of implementing this method, to avoid duplicate values in values as keys; implement hashCode based on an unique attribute combination.

      Specified by:
      getId in interface Storable
      Returns:
      an id that is unique to this storable item.
    • getName

      public String getName()
    • setName

      public StorageObject setName(String name)
    • getNested

      public NestedObject getNested()
    • setNested

      public void setNested(NestedObject nested)
    • getKeywords

      public List<String> getKeywords()
    • setKeywords

      public void setKeywords(List<String> keywords)
    • toString

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

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

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • compareToAttribute

      public int compareToAttribute(Storable other, String attribute)
      Description copied from interface: Storable
      compares this storable to another storable, with an attribute specified. this method must be implemented by the storable to allow ordering. Only required for storages utilizing comparators for ordering. The implementation may be based on attribute names mapped to getter lambdas, or a simple switch.

      Only required when ordering by attribute with HazelMap

      Specified by:
      compareToAttribute in interface Storable
      Parameters:
      other - the other object to compare to.
      attribute - handler of the attribute that should be tested.
      Returns:
      integer that matches implementation of @see Comparable#compareTo(Object)