001    // Copyright 2006-2007 Daniel Gredler
002    //
003    // Licensed under the Apache License, Version 2.0 (the "License");
004    // you may not use this file except in compliance with the License.
005    // You may obtain a copy of the License at
006    //
007    //     http://www.apache.org/licenses/LICENSE-2.0
008    //
009    // Unless required by applicable law or agreed to in writing, software
010    // distributed under the License is distributed on an "AS IS" BASIS,
011    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012    // See the License for the specific language governing permissions and
013    // limitations under the License.
014    
015    package net.sf.beanform.prop;
016    
017    import java.lang.annotation.Annotation;
018    import java.util.Collections;
019    import java.util.List;
020    
021    /**
022     * A fake bean property that can be used to insert extra input fields into a BeanForm,
023     * allowing us to mix bean property fields with custom fields that do not correspond to
024     * bean properties.
025     *
026     * @author Daniel Gredler
027     */
028    public class PseudoProperty extends BeanProperty {
029    
030        private static final long serialVersionUID = 9082276460854160562L;
031    
032        public PseudoProperty( Class ownerClass, String name, String validators, String input ) {
033            super( ownerClass, name, validators, input );
034        }
035    
036        @Override
037        @SuppressWarnings( "unchecked" )
038        public List<Annotation> getAnnotations() {
039            return Collections.EMPTY_LIST;
040        }
041    
042        @Override
043        public boolean isReadable() {
044            return true;
045        }
046    
047        @Override
048        public boolean isWriteable() {
049            return true;
050        }
051    
052        @Override
053        public Class getType() {
054            return null;
055        }
056    
057        @Override
058        public Object getValue() {
059            return null;
060        }
061    
062        @Override
063        public void setValue( Object value ) {
064            // Empty.
065        }
066    
067    }