View Javadoc
1   /*******************************************************************************
2    * Portions created by Sebastian Thomschke are copyright (c) 2005-2011 Sebastian
3    * Thomschke.
4    * 
5    * All Rights Reserved. This program and the accompanying materials
6    * are made available under the terms of the Eclipse Public License v1.0
7    * which accompanies this distribution, and is available at
8    * http://www.eclipse.org/legal/epl-v10.html
9    * 
10   * Contributors:
11   *     Sebastian Thomschke - initial implementation.
12   *******************************************************************************/
13  package net.sf.oval.guard;
14  
15  import net.sf.oval.AbstractCheck;
16  import net.sf.oval.Validator;
17  import net.sf.oval.context.OValContext;
18  import net.sf.oval.exception.OValException;
19  
20  /**
21   * @author Sebastian Thomschke
22   */
23  public class PostCheck extends AbstractCheck
24  {
25  	private static final long serialVersionUID = 1L;
26  
27  	private String expression;
28  	private String language;
29  	private String old;
30  
31  	public void configure(final Post constraintAnnotation)
32  	{
33  		setMessage(constraintAnnotation.message());
34  		setErrorCode(constraintAnnotation.errorCode());
35  		setSeverity(constraintAnnotation.severity());
36  		setExpression(constraintAnnotation.expr());
37  		setLanguage(constraintAnnotation.lang());
38  		setOld(constraintAnnotation.old());
39  		setProfiles(constraintAnnotation.profiles());
40  	}
41  
42  	/**
43  	 * @return the condition
44  	 */
45  	public String getExpression()
46  	{
47  		return expression;
48  	}
49  
50  	/**
51  	 * @return the language
52  	 */
53  	public String getLanguage()
54  	{
55  		return language;
56  	}
57  
58  	/**
59  	 * @return the old
60  	 */
61  	public String getOld()
62  	{
63  		return old;
64  	}
65  
66  	/**
67  	 * {@inheritDoc}
68  	 */
69  	public boolean isSatisfied(final Object validatedObject, final Object valueToValidate, final OValContext context,
70  			final Validator validator) throws OValException
71  	{
72  		throw new UnsupportedOperationException();
73  	}
74  
75  	/**
76  	 * @param condition the condition to set
77  	 */
78  	public void setExpression(final String condition)
79  	{
80  		expression = condition;
81  	}
82  
83  	/**
84  	 * @param language the language to set
85  	 */
86  	public void setLanguage(final String language)
87  	{
88  		this.language = language;
89  	}
90  
91  	/**
92  	 * @param old the old to set
93  	 */
94  	public void setOld(final String old)
95  	{
96  		this.old = old;
97  	}
98  }