View Javadoc

1   /*
2    * ====================
3    * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4    * 
5    * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.     
6    * 
7    * The contents of this file are subject to the terms of the Common Development 
8    * and Distribution License("CDDL") (the "License").  You may not use this file 
9    * except in compliance with the License.
10   * 
11   * You can obtain a copy of the License at 
12   * http://IdentityConnectors.dev.java.net/legal/license.txt
13   * See the License for the specific language governing permissions and limitations 
14   * under the License. 
15   * 
16   * When distributing the Covered Code, include this CDDL Header Notice in each file
17   * and include the License file at identityconnectors/legal/license.txt.
18   * If applicable, add the following below this CDDL Header, with the fields 
19   * enclosed by brackets [] replaced by your own identifying information: 
20   * "Portions Copyrighted [year] [name of copyright owner]"
21   * ====================
22   */
23  package org.identityconnectors.framework.common.objects.filter;
24  
25  import org.identityconnectors.framework.common.objects.Attribute;
26  import org.identityconnectors.framework.common.objects.ConnectorObject;
27  
28  public final class GreaterThanFilter extends ComparableAttributeFilter {
29  
30      /**
31       * Determine if the {@link ConnectorObject} {@link Attribute} value is
32       * greater than the one provided in the filter.
33       */
34      public GreaterThanFilter(Attribute attr) {
35          super(attr);
36      }
37  
38      /**
39       * Determine if the {@link ConnectorObject} {@link Attribute} value is
40       * greater than the one provided in the filter.
41       * 
42       * @see org.identityconnectors.framework.common.objects.filter.Filter#accept(ConnectorObject)
43       */
44      public boolean accept(ConnectorObject obj) {
45          return isPresent(obj) && this.compare(obj) > 0;
46      }
47  
48      @Override
49      public String toString() {
50          StringBuilder bld = new StringBuilder();
51          bld.append("GREATERTHAN: ").append(getAttribute());
52          return bld.toString();
53      }
54  }