001/*
002 *   Copyright (C) Christian Schulte, 2005-206
003 *   All rights reserved.
004 *
005 *   Redistribution and use in source and binary forms, with or without
006 *   modification, are permitted provided that the following conditions
007 *   are met:
008 *
009 *     o Redistributions of source code must retain the above copyright
010 *       notice, this list of conditions and the following disclaimer.
011 *
012 *     o Redistributions in binary form must reproduce the above copyright
013 *       notice, this list of conditions and the following disclaimer in
014 *       the documentation and/or other materials provided with the
015 *       distribution.
016 *
017 *   THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
018 *   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
019 *   AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
020 *   THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,
021 *   INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
022 *   NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
023 *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
024 *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
025 *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
026 *   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
027 *
028 *   $JOMC: TestModelValidator.java 3958 2011-11-18 22:32:23Z schulte2005 $
029 *
030 */
031package org.jomc.modlet.test.support;
032
033import java.net.URL;
034import org.jomc.modlet.Model;
035import org.jomc.modlet.ModelContext;
036import org.jomc.modlet.ModelException;
037import org.jomc.modlet.ModelValidationReport;
038import org.jomc.modlet.ModelValidator;
039
040/**
041 * {@code ModelValidator} test implementation.
042 *
043 * @author <a href="mailto:schulte2005@users.sourceforge.net">Christian Schulte</a> 1.0
044 * @version $JOMC: TestModelValidator.java 3958 2011-11-18 22:32:23Z schulte2005 $
045 */
046public final class TestModelValidator implements ModelValidator
047{
048
049    private boolean booleanProperty;
050
051    private char characterProperty;
052
053    private byte byteProperty;
054
055    private short shortProperty;
056
057    private int intProperty;
058
059    private long longProperty;
060
061    private float floatProperty;
062
063    private double doubleProperty;
064
065    private String stringProperty;
066
067    private String stringPropertyWithoutSetter;
068
069    private String stringPropertyWithoutGetter;
070
071    private URL urlProperty;
072
073    private Thread.State enumProperty;
074
075    private Object objectProperty;
076
077    public TestModelValidator()
078    {
079        super();
080    }
081
082    public ModelValidationReport validateModel( final ModelContext context, final Model model ) throws ModelException
083    {
084        if ( context == null )
085        {
086            throw new NullPointerException( "context" );
087        }
088        if ( model == null )
089        {
090            throw new NullPointerException( "model" );
091        }
092
093        context.setAttribute( TestModelValidator.class.getName(), this );
094        return new ModelValidationReport();
095    }
096
097    public boolean isBooleanProperty()
098    {
099        return this.booleanProperty;
100    }
101
102    public void setBooleanProperty( final boolean value )
103    {
104        this.booleanProperty = value;
105    }
106
107    public char getCharacterProperty()
108    {
109        return this.characterProperty;
110    }
111
112    public void setCharacterProperty( final char value )
113    {
114        this.characterProperty = value;
115    }
116
117    public byte getByteProperty()
118    {
119        return this.byteProperty;
120    }
121
122    public void setByteProperty( final byte value )
123    {
124        this.byteProperty = value;
125    }
126
127    public short getShortProperty()
128    {
129        return this.shortProperty;
130    }
131
132    public void setShortProperty( final short value )
133    {
134        this.shortProperty = value;
135    }
136
137    public int getIntProperty()
138    {
139        return this.intProperty;
140    }
141
142    public void setIntProperty( final int value )
143    {
144        this.intProperty = value;
145    }
146
147    public long getLongProperty()
148    {
149        return this.longProperty;
150    }
151
152    public void setLongProperty( final long value )
153    {
154        this.longProperty = value;
155    }
156
157    public float getFloatProperty()
158    {
159        return this.floatProperty;
160    }
161
162    public void setFloatProperty( final float value )
163    {
164        this.floatProperty = value;
165    }
166
167    public double getDoubleProperty()
168    {
169        return this.doubleProperty;
170    }
171
172    public void setDoubleProperty( final double value )
173    {
174        this.doubleProperty = value;
175    }
176
177    public String getStringProperty()
178    {
179        return this.stringProperty;
180    }
181
182    public void setStringProperty( final String value )
183    {
184        this.stringProperty = value;
185    }
186
187    public String getStringPropertyWithoutSetter()
188    {
189        return this.stringPropertyWithoutSetter;
190    }
191
192    public void setStringPropertyWithoutGetter( final String value )
193    {
194        this.stringPropertyWithoutGetter = value;
195    }
196
197    public URL getUrlProperty()
198    {
199        return this.urlProperty;
200    }
201
202    public void setUrlProperty( final URL value )
203    {
204        this.urlProperty = value;
205    }
206
207    public Thread.State getEnumProperty()
208    {
209        return this.enumProperty;
210    }
211
212    public void setEnumProperty( final Thread.State value )
213    {
214        this.enumProperty = value;
215    }
216
217    public Object getObjectProperty()
218    {
219        return this.objectProperty;
220    }
221
222    public void setObjectProperty( final Object value )
223    {
224        this.objectProperty = value;
225    }
226
227}