org.identityconnectors.framework.common.objects.filter
Class FilterBuilder

java.lang.Object
  extended by org.identityconnectors.framework.common.objects.filter.FilterBuilder

public final class FilterBuilder
extends Object

FilterBuilder creates a filter that will match any ConnectorObject that satisfies all of the selection criteria that were specified using this builder.

Since:
1.0
Version:
$Revision: 1.7 $
Author:
Will Droste

Constructor Summary
FilterBuilder()
           
 
Method Summary
static Filter and(Filter leftHandSide, Filter rightHandSide)
          Logically "ANDs" together the two specified instances of Filter.
static Filter contains(Attribute attr)
          Select only an input ConnectorObject with a value for the specified Attribute that contains as any substring the value of the specified Attribute.
static Filter containsAllValues(Attribute attr)
          Select only an input ConnectorObject with a value for the specified Attribute that contains all the values from the specified Attribute.
static Filter endsWith(Attribute attr)
          Select only an input ConnectorObject with a value for the specified Attribute that contains as a final substring the value of the specified Attribute.
static Filter equalTo(Attribute attr)
          Select only an input ConnectorObject with a value for the specified Attribute that is lexically equal to the value of the specified Attribute.
static Filter greaterThan(Attribute attr)
          Select only an input ConnectorObject with a value for the specified Attribute that is lexically greater than the value of the specified Attribute.
static Filter greaterThanOrEqualTo(Attribute attr)
          Select only an input ConnectorObject with a value for the specified Attribute that is lexically greater than or equal to the value of the specified Attribute.
static Filter lessThan(Attribute attr)
          Select only an input ConnectorObject with a value for the specified Attribute that is lexically less than the value of the specified Attribute.
static Filter lessThanOrEqualTo(Attribute attr)
          Select only an input ConnectorObject with a value for the specified Attribute that is lexically less than or equal to the value of the specified Attribute.
static Filter not(Filter filter)
          Logically negate the specified Filter.
static Filter or(Filter leftHandSide, Filter rightHandSide)
          Logically "OR" together the two specified instances of Filter.
static Filter startsWith(Attribute attr)
          Select only an input ConnectorObject with a value for the specified Attribute that contains as an initial substring the value of the specified Attribute.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilterBuilder

public FilterBuilder()
Method Detail

endsWith

public static Filter endsWith(Attribute attr)
Select only an input ConnectorObject with a value for the specified Attribute that contains as a final substring the value of the specified Attribute.

For example, if the specified Attribute were {"hairColor": "d"},
this would match any ConnectorObject with a value such as
     {"hairColor": "red"} or
     {"hairColor": "blond"}
but would not match any ConnectorObject that contains only values such as
     {"hairColor": "blonde"} or
     {"hairColor": "auburn"}.
This also would not match any ConnectorObject that contains only {"hairColor": null}
or that lacks the attribute "hairColor".

Parameters:
attr - Attribute containing exactly one value to test against each value of the corresponding ConnectorObject attribute.
Returns:
an instance of Filter whose accept() method will return true if at least one value of the corresponding attribute of the ConnectorObject contains as its last part the value of the specified Attribute; otherwise false.

startsWith

public static Filter startsWith(Attribute attr)
Select only an input ConnectorObject with a value for the specified Attribute that contains as an initial substring the value of the specified Attribute.

For example, if the specified Attribute were {"hairColor": "b"},
this would match any ConnectorObject with a value such as
     {"hairColor": "brown"} or
     {"hairColor": "blond"}
but would not match any ConnectorObject that contains only values such as
     {"hairColor": "red"} or
     {"hairColor": "auburn"}.
This also would not match any ConnectorObject that contains only {"hairColor": null}
or that lacks the attribute "hairColor".

Parameters:
attr - Attribute containing exactly one value to test against each value of the corresponding ConnectorObject attribute.
Returns:
an instance of Filter whose accept() method will return true if at least one value of the corresponding attribute of the ConnectorObject contains as its first part the value of the specified Attribute; otherwise false.

contains

public static Filter contains(Attribute attr)
Select only an input ConnectorObject with a value for the specified Attribute that contains as any substring the value of the specified Attribute.

For example, if the specified Attribute were {"hairColor": "a"},
this would match any ConnectorObject with a value such as
    {"hairColor": "auburn"} or
    {"hairColor": "gray"}
but would not match any ConnectorObject that contains only
    {"hairColor": "red"} or
    {"hairColor": "grey"}.
This also would not match any ConnectorObject that contains only {"hairColor": null}
or that lacks the attribute "hairColor".

Parameters:
attr - Attribute containing exactly one value to test against each value of the corresponding ConnectorObject attribute.
Returns:
an instance of Filter whose accept() method will return true if at least one value of the corresponding attribute of the ConnectorObject contains anywhere within it the value of the specified Attribute; otherwise false.

equalTo

public static Filter equalTo(Attribute attr)
Select only an input ConnectorObject with a value for the specified Attribute that is lexically equal to the value of the specified Attribute.

NOTE: Is comparison case-sensitive?

For example, if the specified Attribute were {"hairColor": "brown"},
this would match any ConnectorObject with a value such as
    {"hairColor": "brown"} or
    {"hairColor": "BROWN"}
but would not match any ConnectorObject that contains only
    {"hairColor": "brownish-gray"} or
    {"hairColor": "auburn"}.
This also would not match any ConnectorObject that contains only {"hairColor": null}
or that lacks the attribute "hairColor".

NOTE: Lexical comparison of two string values compares the characters of each value, even if the string values could be interpreted as numeric. The values "01" and "1" are unequal lexically, although they would be equivalent arithmetically.

Two attributes with binary syntax are equal if and only if their constituent bytes match.

Parameters:
attr - Attribute containing exactly one value to test against each value of the corresponding ConnectorObject attribute.
Returns:
an instance of Filter whose accept() method will return true if at least one value of the corresponding attribute of the ConnectorObject matches lexically the value of the specified Attribute; otherwise false.

greaterThanOrEqualTo

public static Filter greaterThanOrEqualTo(Attribute attr)
Select only an input ConnectorObject with a value for the specified Attribute that is lexically greater than or equal to the value of the specified Attribute.

NOTE: Is comparison case-sensitive?

For example, if the specified Attribute were {"hairColor": "brown"},
this would match any ConnectorObject with a value such as
    {"hairColor": "brown"} or
    {"hairColor": "brownish-gray"} or
    {"hairColor": "red"}
but would not match any ConnectorObject that contains only
    {"hairColor": "black"} or
    {"hairColor": "blond"} or
    {"hairColor": "auburn"}.
This also would not match any ConnectorObject that contains only {"hairColor": null}
or that lacks the attribute "hairColor".

NOTE: Lexical comparison of two string values compares the characters of each value, even if the string values could be interpreted as numeric.
When compared lexically, "99" is greater than "123".
When compared arithmetically, 99 is less than 123.

Parameters:
attr - Attribute containing exactly one value to test against each value of the corresponding ConnectorObject attribute.
Returns:
an instance of Filter whose accept() method will return true if at least one value of the corresponding attribute of the ConnectorObject matches or sorts alphabetically after the value of the specified Attribute; otherwise false.

lessThanOrEqualTo

public static Filter lessThanOrEqualTo(Attribute attr)
Select only an input ConnectorObject with a value for the specified Attribute that is lexically less than or equal to the value of the specified Attribute.

NOTE: Is comparison case-sensitive?

For example, if the specified Attribute were {"hairColor": "brown"},
this would match any ConnectorObject with a value such as
    {"hairColor": "brown"} or
    {"hairColor": "black"} or
    {"hairColor": "blond"} or
    {"hairColor": "auburn"}
but would not match any ConnectorObject that contains only
    {"hairColor": "brownish-gray"} or
    {"hairColor": "red"}
This also would not match any ConnectorObject that contains only {"hairColor": null}
or that lacks the attribute "hairColor".

NOTE: Lexical comparison of two string values compares the characters of each value, even if the string values could be interpreted as numeric.
When compared lexically, "99" is greater than "123".
When compared arithmetically, 99 is less than 123.

Parameters:
attr - Attribute containing exactly one value to test against each value of the corresponding ConnectorObject attribute.
Returns:
an instance of Filter whose accept() method will return true if at least one value of the corresponding attribute of the ConnectorObject matches or sorts alphabetically before the value of the specified Attribute; otherwise false.

lessThan

public static Filter lessThan(Attribute attr)
Select only an input ConnectorObject with a value for the specified Attribute that is lexically less than the value of the specified Attribute.

NOTE: Is comparison case-sensitive?

For example, if the specified Attribute were {"hairColor": "brown"},
this would match any ConnectorObject with a value such as
    {"hairColor": "black"} or
    {"hairColor": "blond"} or
    {"hairColor": "auburn"}
but would not match any ConnectorObject that contains only
    {"hairColor": "brown"} or
    {"hairColor": "brownish-gray"} or
    {"hairColor": "red"}
This also would not match any ConnectorObject that contains only {"hairColor": null}
or that lacks the attribute "hairColor".

NOTE: Lexical comparison of two string values compares the characters of each value, even if the string values could be interpreted as numeric.
When compared lexically, "99" is greater than "123".
When compared arithmetically, 99 is less than 123.

Parameters:
attr - Attribute containing exactly one value to test against each value of the corresponding ConnectorObject attribute.
Returns:
an instance of Filter whose accept() method will return true if at least one value of the corresponding attribute of the ConnectorObject sorts alphabetically before the value of the specified Attribute; otherwise false.

greaterThan

public static Filter greaterThan(Attribute attr)
Select only an input ConnectorObject with a value for the specified Attribute that is lexically greater than the value of the specified Attribute.

NOTE: Is comparison case-sensitive?

For example, if the specified Attribute were {"hairColor": "brown"},
this would match any ConnectorObject with a value such as
    {"hairColor": "brownish-gray"} or
    {"hairColor": "red"}
but would not match any ConnectorObject that contains only
    {"hairColor": "brown"} or
    {"hairColor": "black"} or
    {"hairColor": "blond"} or
    {"hairColor": "auburn"}.
This also would not match any ConnectorObject that contains only {"hairColor": null}
or that lacks the attribute "hairColor".

NOTE: Lexical comparison of two string values compares the characters of each value, even if the string values could be interpreted as numeric.
When compared lexically, "99" is greater than "123".
When compared arithmetically, 99 is less than 123.

Parameters:
attr - Attribute containing exactly one value to test against each value of the corresponding ConnectorObject attribute.
Returns:
an instance of Filter whose accept() method will return true if at least one value of the corresponding attribute of the ConnectorObject sorts alphabetically after the value of the specified Attribute; otherwise false.

and

public static Filter and(Filter leftHandSide,
                         Filter rightHandSide)
Logically "ANDs" together the two specified instances of Filter. The resulting conjunct Filter is true if and only if both of the specified filters are true.

Parameters:
leftHandSide - left-hand-side filter.
rightHandSide - right-hand-side filter.
Returns:
the result of (leftHandSide && rightHandSide)

or

public static Filter or(Filter leftHandSide,
                        Filter rightHandSide)
Logically "OR" together the two specified instances of Filter. The resulting disjunct Filter is true if and only if at least one of the specified filters is true.

Parameters:
leftHandSide - left-hand-side filter.
rightHandSide - right-hand-side filter.
Returns:
the result of (leftHandSide || rightHandSide)

not

public static Filter not(Filter filter)
Logically negate the specified Filter. The resulting Filter is true if and only if the specified filter is false.

Parameters:
filter - the Filter to negate.
Returns:
the result of (!filter).

containsAllValues

public static Filter containsAllValues(Attribute attr)
Select only an input ConnectorObject with a value for the specified Attribute that contains all the values from the specified Attribute.

For example, if the specified Attribute were {"hairColor": "brown", "red"},
this would match any ConnectorObject with values such as

but would not match any ConnectorObject that contains only This also would not match any ConnectorObject that contains only {"hairColor": null}
or that lacks the attribute "hairColor".

NOTE: Lexical comparison of two string values compares the characters of each value, even if the string values could be interpreted as numeric.

Parameters:
attr - Attribute containing exactly one value to test against each value of the corresponding ConnectorObject attribute.
Returns:
an instance of Filter whose accept() method will return true if at least one value of the corresponding attribute of the ConnectorObject sorts alphabetically before the value of the specified Attribute; otherwise false.


Copyright © 2012. All Rights Reserved.