Example usage for java.util.regex Pattern equals

List of usage examples for java.util.regex Pattern equals

Introduction

In this page you can find the example usage for java.util.regex Pattern equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Indicates whether some other object is "equal to" this one.

Usage

From source file:org.apache.olingo.commons.core.edm.primitivetype.AbstractGeospatialType.java

private Matcher getMatcher(final Pattern pattern, final String value) throws EdmPrimitiveTypeException {
    final Matcher matcher = pattern.matcher(value);
    if (!matcher.matches()) {
        throw new EdmPrimitiveTypeException(
                "EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value)");
    }//ww w .  j  a  v  a2 s  .c  o  m

    Geospatial.Dimension _dimension = null;
    Geospatial.Type _type = null;
    try {
        _dimension = Geospatial.Dimension.valueOf(matcher.group(1).toUpperCase());
        _type = Geospatial.Type.valueOf(matcher.group(3).toUpperCase());
    } catch (IllegalArgumentException e) {
        throw new EdmPrimitiveTypeException(
                "EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value)", e);
    }
    if (_dimension != this.dimension || (!pattern.equals(COLLECTION_PATTERN) && _type != this.type)) {
        throw new EdmPrimitiveTypeException(
                "EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value)");
    }

    return matcher;
}