Class MongoFriendshipId

java.lang.Object
dev.getelements.elements.dao.mongo.model.MongoFriendshipId
All Implemented Interfaces:
HexableId

@Embedded public class MongoFriendshipId extends Object implements HexableId
Represents a unique id between two MongoUser instances, forming a MongoFriendship. This derives the ID value itself as a compound value
  • Field Details

  • Constructor Details

    • MongoFriendshipId

      public MongoFriendshipId()
    • MongoFriendshipId

      public MongoFriendshipId(org.bson.types.ObjectId userA, org.bson.types.ObjectId userB)
    • MongoFriendshipId

      public MongoFriendshipId(String hexStringRepresentation)
  • Method Details

    • parseOrThrow

      public static <ExceptionT extends Exception> MongoFriendshipId parseOrThrow(String hexStringRepresentation, Function<Throwable,ExceptionT> exceptionSupplier) throws ExceptionT
      Attempts to parse the supplied string into a MongoFriendshipId. If parsing fails, then the supplied Function<Throwable,ExceptionT extends Exception> will be used to generate an Exception to throw.
      Type Parameters:
      ExceptionT - the exception type
      Parameters:
      hexStringRepresentation - the hex string representation of the MongoFriendshipId
      exceptionSupplier - the Function<Throwable,ExceptionT extends Exception> to generate an exception if necessary
      Returns:
      the MongoFriendshipId instance (never null).
      Throws:
      ExceptionT - if parsing fails
    • lesser

      public static org.bson.types.ObjectId lesser(org.bson.types.ObjectId a, org.bson.types.ObjectId b)
    • greater

      public static org.bson.types.ObjectId greater(org.bson.types.ObjectId a, org.bson.types.ObjectId b)
    • getLesser

      public org.bson.types.ObjectId getLesser()
    • getGreater

      public org.bson.types.ObjectId getGreater()
    • getOpposite

      public org.bson.types.ObjectId getOpposite(org.bson.types.ObjectId objectId)
    • toByteArray

      public byte[] toByteArray()
    • toHexString

      public String toHexString()
      Description copied from interface: HexableId
      Converts the object to a Hex string.
      Specified by:
      toHexString in interface HexableId
      Returns:
      the hex string representation.
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object