Package org.bson

Class BsonRegularExpression

java.lang.Object
org.bson.BsonValue
org.bson.BsonRegularExpression

public final class BsonRegularExpression extends BsonValue
A holder class for a BSON regular expression, so that we can delay compiling into a Pattern until necessary.
Since:
3.0
  • Constructor Details

    • BsonRegularExpression

      public BsonRegularExpression(String pattern, String options)
      Creates a new instance
      Parameters:
      pattern - the regular expression Pattern
      options - the options for the regular expression
    • BsonRegularExpression

      public BsonRegularExpression(String pattern)
      Creates a new instance with no options set.
      Parameters:
      pattern - the regular expression Pattern
  • Method Details

    • getBsonType

      public BsonType getBsonType()
      Description copied from class: BsonValue
      Gets the BSON type of this value.
      Specified by:
      getBsonType in class BsonValue
      Returns:
      the BSON type, which may not be null (but may be BSONType.NULL)
    • getPattern

      public String getPattern()
      Gets the regex pattern.
      Returns:
      the regular expression pattern
    • getOptions

      public String getOptions()
      Gets the options for the regular expression
      Returns:
      the options.
    • equals

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

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

      public String toString()
      Overrides:
      toString in class Object