From 37197abf87d75b6071b2645f4b76c682895030a2 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Tue, 15 May 2012 12:56:34 +0000
Subject: [PATCH] Minor simplifications and cleanup.
---
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Filter.java | 29 ++++++++---------------------
1 files changed, 8 insertions(+), 21 deletions(-)
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Filter.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Filter.java
index 309194c..45b14c8 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Filter.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Filter.java
@@ -534,9 +534,7 @@
* @return The newly created {@code approximate match} filter.
*/
public static Filter approx(final String attributeDescription, final Object assertionValue) {
- Validator.ensureNotNull(attributeDescription, assertionValue);
- return new Filter(new ApproxMatchImpl(attributeDescription, ByteString
- .valueOf(assertionValue)));
+ return approx(attributeDescription, ByteString.valueOf(assertionValue));
}
/**
@@ -568,9 +566,7 @@
* @return The newly created {@code equality match} filter.
*/
public static Filter equality(final String attributeDescription, final Object assertionValue) {
- Validator.ensureNotNull(attributeDescription, assertionValue);
- return new Filter(new EqualityMatchImpl(attributeDescription, ByteString
- .valueOf(assertionValue)));
+ return equality(attributeDescription, ByteString.valueOf(assertionValue));
}
/**
@@ -617,11 +613,8 @@
*/
public static Filter extensible(final String matchingRule, final String attributeDescription,
final Object assertionValue, final boolean dnAttributes) {
- Validator.ensureTrue((matchingRule != null) || (attributeDescription != null),
- "matchingRule and/or " + "attributeDescription must not be null");
- Validator.ensureNotNull(assertionValue);
- return new Filter(new ExtensibleMatchImpl(matchingRule, attributeDescription, ByteString
- .valueOf(assertionValue), dnAttributes));
+ return extensible(matchingRule, attributeDescription, ByteString.valueOf(assertionValue),
+ dnAttributes);
}
/**
@@ -655,9 +648,7 @@
*/
public static Filter greaterOrEqual(final String attributeDescription,
final Object assertionValue) {
- Validator.ensureNotNull(attributeDescription, assertionValue);
- return new Filter(new GreaterOrEqualImpl(attributeDescription, ByteString
- .valueOf(assertionValue)));
+ return greaterOrEqual(attributeDescription, ByteString.valueOf(assertionValue));
}
/**
@@ -690,9 +681,7 @@
* @return The newly created {@code less or equal} filter.
*/
public static Filter lessOrEqual(final String attributeDescription, final Object assertionValue) {
- Validator.ensureNotNull(attributeDescription, assertionValue);
- return new Filter(new LessOrEqualImpl(attributeDescription, ByteString
- .valueOf(assertionValue)));
+ return lessOrEqual(attributeDescription, ByteString.valueOf(assertionValue));
}
/**
@@ -943,8 +932,7 @@
}
} else {
// We tolerate the top level filter component not being
- // surrounded
- // by parentheses.
+ // surrounded by parentheses.
return valueOf0(string, 0, string.length());
}
} catch (final LocalizedIllegalArgumentException liae) {
@@ -1016,8 +1004,7 @@
}
// Finally, see if there is anything after the last asterisk, which
- // would be
- // the subFinal value.
+ // would be the subFinal value.
ByteString subFinal;
if (firstPos == (valueBytes.length - 1)) {
subFinal = null;
--
Gitblit v1.10.0