View Javadoc

1   /*
2    * Copyright (c) 2001 - 2005 ivata limited.
3    * All rights reserved.
4    * ---------------------------------------------------------
5    * ivata masks may be redistributed under the GNU General Public
6    * License as published by the Free Software Foundation;
7    * version 2 of the License.
8    *
9    * These programs are free software; you can redistribute them and/or
10   * modify them under the terms of the GNU General Public License
11   * as published by the Free Software Foundation; version 2 of the License.
12   *
13   * These programs are distributed in the hope that they will be useful,
14   * but WITHOUT ANY WARRANTY; without even the implied warranty of
15   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16   *
17   * See the GNU General Public License in the file LICENSE.txt for more
18   * details.
19   *
20   * If you would like a copy of the GNU General Public License write to
21   *
22   * Free Software Foundation, Inc.
23   * 59 Temple Place - Suite 330
24   * Boston, MA 02111-1307, USA.
25   *
26   *
27   * To arrange commercial support and licensing, contact ivata at
28   *                  http://www.ivata.com/contact.jsp
29   * ---------------------------------------------------------
30   * $Log: Filter.java,v $
31   * Revision 1.1  2005/04/11 12:27:02  colinmacleod
32   * Added preliminary support for filters.
33   * Added FieldValueConvertor factor interface
34   * to split off value convertors for reuse.
35   *
36   * ---------------------------------------------------------
37   */
38  package com.ivata.mask.filter;
39  
40  /***
41   * <p>
42   * A mask (or group of masks) can filter its contents. At the moment, you can
43   * only filter for the contents of a property inside the mask's bean being
44   * equal to a given property.
45   * </p>
46   * <p>
47   * If the property does not exist, it is assumed to match. This lets you assign
48   * filters to groups, which are only applied for those beans which have the
49   * matching property.
50   * </p>
51   *
52   * @since ivata masks 0.6 (2005-03-17)
53   * @author Colin MacLeod
54   * <a href='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
55   * @version $Revision: 1.1 $
56   */
57  
58  public interface Filter {
59      /***
60       * Get the name of the property the filter is searching for.
61       *
62       * @return property name to filter for.
63       */
64      String getPropertyName();
65      /***
66       * Get the class of the property.
67       *
68       * @return class of the property.
69       */
70      Class getPropertyClass();
71      /***
72       * Value the property must have to be matched. Matches will be made using
73       * the <code>equals</code> method of this value, or <code>==</code>, if the
74       * value is null.
75       *
76       * @return property value to filter for.
77       */
78      Object getValue();
79  }