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: FilterImpl.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  import org.apache.log4j.Logger;
41  
42  /***
43   * Refer to {@link Filter}.
44   *
45   * @since ivata masks 0.6 (2005-03-17)
46   * @author Colin MacLeod
47   * <a href='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
48   * @version $Revision: 1.1 $
49   */
50  public class FilterImpl implements Filter {
51      /***
52       * Logger for this class.
53       */
54      private static final Logger logger = Logger.getLogger(FilterImpl.class);
55      /***
56       * Refer to {@link Filter#getPropertyClass}.
57       */
58      private Class propertyClass;
59      /***
60       * Refer to {@link Filter#getPropertyName}.
61       */
62      private String propertyName;
63      /***
64       * Refer to {@link Filter#getValue}.
65       */
66      private Object value;
67      /***
68       * Constructor.
69       */
70      public FilterImpl(final String propertyName, final Class propertyClass,
71              final Object value) {
72          this.propertyName = propertyName;
73          this.propertyClass = propertyClass;
74          this.value = value;
75      }
76      /***
77       * Refer to {@link Filter#getPropertyClass}.
78       * @return Refer to {@link Filter#getPropertyClass}.
79       */
80      public Class getPropertyClass() {
81          return propertyClass;
82      }
83      /***
84       * Refer to {@link Filter#getPropertyName}.
85       * @return Refer to {@link Filter#getPropertyName}.
86       */
87      public String getPropertyName() {
88          return propertyName;
89      }
90      /***
91       * Refer to {@link Filter#getValue}.
92       * @return Refer to {@link Filter#getValue}.
93       */
94      public Object getValue() {
95          return value;
96      }
97      /***
98       * Refer to {@link Filter#getValue}.
99       * @param valueParam Refer to {@link Filter#getValue}.
100      */
101     public void setValue(Object valueParam) {
102         if (logger.isDebugEnabled()) {
103             logger.debug("Setting value. Before '" + value + "', after '"
104                     + valueParam + "'");
105         }
106         value = valueParam;
107     }
108 }