Class MongoFriendshipId
java.lang.Object
dev.getelements.elements.dao.mongo.model.MongoFriendshipId
- All Implemented Interfaces:
HexableId
Represents a unique id between two
MongoUser
instances, forming a MongoFriendship
. This derives the
ID value itself as a compound value-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
-
Constructor Summary
ConstructorsConstructorDescriptionMongoFriendshipId
(String hexStringRepresentation) MongoFriendshipId
(org.bson.types.ObjectId userA, org.bson.types.ObjectId userB) -
Method Summary
Modifier and TypeMethodDescriptionboolean
org.bson.types.ObjectId
org.bson.types.ObjectId
org.bson.types.ObjectId
getOpposite
(org.bson.types.ObjectId objectId) static org.bson.types.ObjectId
greater
(org.bson.types.ObjectId a, org.bson.types.ObjectId b) int
hashCode()
static org.bson.types.ObjectId
lesser
(org.bson.types.ObjectId a, org.bson.types.ObjectId b) static <ExceptionT extends Exception>
MongoFriendshipIdparseOrThrow
(String hexStringRepresentation, Function<Throwable, ExceptionT> exceptionSupplier) Attempts to parse the supplied string into aMongoFriendshipId
.byte[]
Converts the object to a Hex string.
-
Field Details
-
VERSION
public static final int VERSION- See Also:
-
VERSION_LENGTH
public static final int VERSION_LENGTH- See Also:
-
LENGTH_BYTES
public static final int LENGTH_BYTES- See Also:
-
-
Constructor Details
-
MongoFriendshipId
public MongoFriendshipId() -
MongoFriendshipId
public MongoFriendshipId(org.bson.types.ObjectId userA, org.bson.types.ObjectId userB) -
MongoFriendshipId
-
-
Method Details
-
parseOrThrow
public static <ExceptionT extends Exception> MongoFriendshipId parseOrThrow(String hexStringRepresentation, Function<Throwable, ExceptionT> exceptionSupplier) throws ExceptionTAttempts to parse the supplied string into aMongoFriendshipId
. If parsing fails, then the suppliedFunction<Throwable,
will be used to generate anExceptionT extends Exception> Exception
to throw.- Type Parameters:
ExceptionT
- the exception type- Parameters:
hexStringRepresentation
- the hex string representation of theMongoFriendshipId
exceptionSupplier
- theFunction<Throwable,
to generate an exception if necessaryExceptionT extends Exception> - 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
Description copied from interface:HexableId
Converts the object to a Hex string.- Specified by:
toHexString
in interfaceHexableId
- Returns:
- the hex string representation.
-
equals
-
hashCode
public int hashCode()
-