View Javadoc

1   // Copyright 2006 Daniel Gredler
2   //
3   // Licensed under the Apache License, Version 2.0 (the "License");
4   // you may not use this file except in compliance with the License.
5   // You may obtain a copy of the License at
6   //
7   //     http://www.apache.org/licenses/LICENSE-2.0
8   //
9   // Unless required by applicable law or agreed to in writing, software
10  // distributed under the License is distributed on an "AS IS" BASIS,
11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  // See the License for the specific language governing permissions and
13  // limitations under the License.
14  
15  package net.sf.beanform.prop;
16  
17  import java.lang.annotation.Annotation;
18  import java.util.Collections;
19  import java.util.List;
20  
21  /***
22   * A fake bean property that can be used to insert extra input fields into a BeanForm,
23   * allowing us to mix bean property fields with custom fields that do not correspond to
24   * bean properties.
25   *
26   * @author Daniel Gredler
27   */
28  public class PseudoProperty extends BeanProperty {
29  
30      private static final long serialVersionUID = 9082276460854160562L;
31  
32      public PseudoProperty( Class ownerClass, String name, String validators, String input ) {
33          super( ownerClass, name, validators, input );
34      }
35  
36      @Override
37      @SuppressWarnings( "unchecked" )
38      public List<Annotation> getAnnotations() {
39          return Collections.EMPTY_LIST;
40      }
41  
42      @Override
43      public boolean isReadable() {
44          return true;
45      }
46  
47      @Override
48      public boolean isWriteable() {
49          return true;
50      }
51  
52      @Override
53      public Class getType() {
54          return null;
55      }
56  
57      @Override
58      public Object getValue() {
59          return null;
60      }
61  
62      @Override
63      public void setValue( Object value ) {
64          // Empty.
65      }
66  
67  }