org.carrot2.util.attribute.constraint
Class Constraint

java.lang.Object
  extended by org.carrot2.util.attribute.constraint.Constraint
Direct Known Subclasses:
ValueHintEnumConstraint

public abstract class Constraint
extends Object

A base class for implementing constraints.


Field Summary
protected  Annotation annotation
          Annotation corresponding to this constraint
 
Constructor Summary
Constraint()
           
 
Method Summary
protected  void checkAssignableFrom(Class<?> clazz, Object value)
          Checks if the provided value can be assigned to the type defined by clazz.
protected abstract  boolean isMet(Object value)
          Checks if the provided value meets this constraint.
 void populate(Annotation annotation)
           
protected  void populateCustom(Annotation annotation)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

annotation

protected Annotation annotation
Annotation corresponding to this constraint

Constructor Detail

Constraint

public Constraint()
Method Detail

isMet

protected abstract boolean isMet(Object value)
Checks if the provided value meets this constraint.


checkAssignableFrom

protected void checkAssignableFrom(Class<?> clazz,
                                   Object value)
Checks if the provided value can be assigned to the type defined by clazz. If not, an IllegalArgumentException will be thrown. null values are assignable to any class.


populate

public final void populate(Annotation annotation)

populateCustom

protected void populateCustom(Annotation annotation)


Copyright (c) Dawid Weiss, Stanislaw Osinski