Class BsonHelper
java.lang.Object
org.evomaster.client.java.controller.mongo.utils.BsonHelper
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidappendToDocument(Object bsonDocument, String fieldName, Object value) static StringbsonRegexGetOptions(Object value) Retrieves the options associated with a BSON regular expression.static StringbsonRegexGetPattern(Object value) Retrieves the pattern from a BSON regular expression object.static BooleandocumentContainsField(Object bsonDocument, String fieldName) documentKeys(Object bsonDocument) static longgetBsonTimestampValue(Object bsonTimestamp) Retrieves the value of a BSON BsonTimestamp as a long value.static Stringstatic ObjectgetTypeFromAlias(String alias) Retrieves the BSON type corresponding to the given alias string.static ObjectgetTypeFromNumber(Integer number) Retrieves the BSON type corresponding to the given integer value.static Objectstatic BooleanisBsonDocument(Object value) Checks if the given object represents a BSON document.static booleanisBsonRegularExpression(Object object) Checks if the given object is a BSON regular expression.static booleanisBsonTimestamp(Object obj) Determines whether the given object is a BSON BsonTimestamp.static booleanisObjectId(Object obj) Determines whether the given object is a BSON ObjectId.static ObjectnewDocument(Object bsonDocument)
-
Field Details
-
NULL_TYPE
- See Also:
-
BSON_TYPE_NULL
- See Also:
-
-
Constructor Details
-
BsonHelper
public BsonHelper()
-
-
Method Details
-
newDocument
-
appendToDocument
-
getValue
-
documentContainsField
-
documentKeys
-
isBsonDocument
Checks if the given object represents a BSON document.- Parameters:
value- the object to check; should be non-null to determine if it is a BSON document- Returns:
- true if the object is a BSON document, false otherwise
-
isObjectId
Determines whether the given object is a BSON ObjectId.- Parameters:
obj- the object to check; should be non-null to determine if it is a BSON ObjectId- Returns:
- true if the object is a BSON ObjectId, false otherwise
-
isBsonTimestamp
Determines whether the given object is a BSON BsonTimestamp.- Parameters:
obj- the object to check; should be non-null to determine if it is a BSON BsonTimestamp- Returns:
- true if the object is a BSON BsonTimestamp, false otherwise
-
getBsonTimestampValue
Retrieves the value of a BSON BsonTimestamp as a long value.- Parameters:
bsonTimestamp- the BSON BsonTimestamp object; should be non-null- Returns:
- the value of the BSON BsonTimestamp
- Throws:
IllegalArgumentException- if the argument is not a BSON BsonTimestamp
-
getType
-
getTypeFromNumber
Retrieves the BSON type corresponding to the given integer value.- Parameters:
number- the integer value representing the BSON type- Returns:
- the BSON type object, or null if not found
-
getTypeFromAlias
Retrieves the BSON type corresponding to the given alias string.- Parameters:
alias- the alias string representing the BSON type- Returns:
- the BSON type object, or null if not found
-
isBsonRegularExpression
Checks if the given object is a BSON regular expression.- Parameters:
object- the object to check; should be non-null to determine if it is a BSON regular expression- Returns:
- true if the object is a BSON regular expression, false otherwise
-
bsonRegexGetPattern
Retrieves the pattern from a BSON regular expression object.- Parameters:
value- the object representing a BSON regular expression. Must not be null and must be a valid BSON regular expression.- Returns:
- a String representing the pattern of the BSON regular expression.
- Throws:
NullPointerException- if the provided value is null.IllegalArgumentException- if the provided value is not a BSON regular expression.RuntimeException- if an error occurs while invoking the method to retrieve the pattern.
-
bsonRegexGetOptions
Retrieves the options associated with a BSON regular expression.- Parameters:
value- the object representing a BSON regular expression. Must not be null and must be a valid BSON regular expression.- Returns:
- a String representing the options associated with the BSON regular expression.
- Throws:
NullPointerException- if the provided value is null.IllegalArgumentException- if the provided value is not a BSON regular expression.
-