JAC project
AOPSYS
CEDRIC & LIP6 labs

org.objectweb.jac.aspects.integrity
Class GenericConditions

java.lang.Object
  |
  +--org.objectweb.jac.aspects.integrity.GenericConditions

public class GenericConditions
extends Object

Some basic methods for constraints on fields values.

Constraint methods must return a Boolean that is Boolean.TRUE if the test has been validated (passed), Boolean.FALSE else. Their parameters are :

See Also:
IntegrityAC.addPreCondition(ClassItem,String,MethodItem,Object[],String), IntegrityAC.addPostCondition(ClassItem,String,MethodItem,Object[],String), IntegrityAC.doCheck()

Constructor Summary
GenericConditions()
           
 
Method Summary
static Boolean authorizedValues(Wrappee substance, FieldItem field, Object value, Object[] values)
          Check if field's value is equal to one of the authorized values.
static Boolean forbiddenValues(Wrappee substance, FieldItem field, Object value, Object[] values)
          Check if field's value is not equal to the forbidden values.
static Boolean isBeginingWithLetter(Wrappee substance, FieldItem field, Object value, Object[] values)
          Tells if the value is a letter begining string.
static Boolean isBeginingWithUpperCaseChar(Wrappee substance, FieldItem field, Object value, Object[] values)
          Tells if the value is an upper-case char begining string.
static Boolean isGreaterThan(Wrappee substance, FieldItem field, Object value, Object[] values)
          Tells if the value is greater than a given number.
static Boolean isJavaIdentifier(Wrappee substance, FieldItem field, Object value, Object[] values)
          Tells if the value is a valid java identifier.
static Boolean isLowerThan(Wrappee substance, FieldItem field, Object value, Object[] values)
           
static Boolean isUniqueValue(Wrappee substance, FieldItem field, Object value, Object[] values)
          Check if this field already has the same value in another object of the same type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericConditions

public GenericConditions()
Method Detail

forbiddenValues

public static Boolean forbiddenValues(Wrappee substance,
                                      FieldItem field,
                                      Object value,
                                      Object[] values)
Check if field's value is not equal to the forbidden values. If it is, the method returns Boolean.FALSE.

Parameters:
field - the tested field
value - the value that is about to be set
values - the forbidden values

authorizedValues

public static Boolean authorizedValues(Wrappee substance,
                                       FieldItem field,
                                       Object value,
                                       Object[] values)
Check if field's value is equal to one of the authorized values. If it is not, the method returns Boolean.FALSE.

Parameters:
field - the tested field
value - the value that is about to be set
values - the authorized values

isUniqueValue

public static Boolean isUniqueValue(Wrappee substance,
                                    FieldItem field,
                                    Object value,
                                    Object[] values)
Check if this field already has the same value in another object of the same type.

Parameters:
field - the tested field
value - the value that is about to be set
values - unused

isBeginingWithUpperCaseChar

public static Boolean isBeginingWithUpperCaseChar(Wrappee substance,
                                                  FieldItem field,
                                                  Object value,
                                                  Object[] values)
Tells if the value is an upper-case char begining string.

Parameters:
field - the tested field
value - the value that is about to be set
values - unused

isBeginingWithLetter

public static Boolean isBeginingWithLetter(Wrappee substance,
                                           FieldItem field,
                                           Object value,
                                           Object[] values)
Tells if the value is a letter begining string.

Parameters:
field - the tested field
value - the value that is about to be set
values - unused

isJavaIdentifier

public static Boolean isJavaIdentifier(Wrappee substance,
                                       FieldItem field,
                                       Object value,
                                       Object[] values)
Tells if the value is a valid java identifier.

Parameters:
field - the tested field
value - the value that is about to be set
values - unused

isGreaterThan

public static Boolean isGreaterThan(Wrappee substance,
                                    FieldItem field,
                                    Object value,
                                    Object[] values)
                             throws Exception
Tells if the value is greater than a given number.

Parameters:
field - the tested field
value - the value that is about to be set
values - unused
Exception

isLowerThan

public static Boolean isLowerThan(Wrappee substance,
                                  FieldItem field,
                                  Object value,
                                  Object[] values)
                           throws Exception
Exception

Contact JAC development team:
Renaud Pawlak
Lionel Seinturier
Laurent Martelli