edu.internet2.middleware.grouper.attr
Enum AttributeDefValidationDef

java.lang.Object
  extended by java.lang.Enum<AttributeDefValidationDef>
      extended by edu.internet2.middleware.grouper.attr.AttributeDefValidationDef
All Implemented Interfaces:
AttributeDefValidationInterface, Serializable, Comparable<AttributeDefValidationDef>

public enum AttributeDefValidationDef
extends Enum<AttributeDefValidationDef>
implements AttributeDefValidationInterface

definitions of validations

Author:
mchyzer

Enum Constant Summary
dateTimeMask
          formatting of dateTime, the mask.
dontTrim
          dont trim the value before saving.
exactLength
          length in chars must be a certain value, not less not more
maxLength
          length in chars cannot be more than this amount
minLength
          length in chars must be at least this amount
regex
          validate based on regex
required
          if the value is required when the attribute is assigned
stringCapitalizeWords
          capitalize words so each is lower and starts with upper
stringToLower
          make the string to lower
stringToUpper
          make the string caps
 
Method Summary
static int argumentInt(AttributeDefValidationInterface attributeDefValidationInterface, String argument, int argumentIndex)
          make sure this argument is an int
static void argumentNone(AttributeDefValidationInterface attributeDefValidationInterface, String argument0, String argument1)
          make sure there are no argument
static void argumentOne(AttributeDefValidationInterface attributeDefValidationInterface, String argument0, String argument1)
          make sure there is one argument
static int argumentOneInt(AttributeDefValidationInterface attributeDefValidationInterface, String argument0, String argument1)
          should have 1 argument, as int
static String argumentOneString(AttributeDefValidationInterface attributeDefValidationInterface, String argument0, String argument1)
          should have 1 argument, as string
 String formatFromDb(Object input, String argument0, String argument1)
          format an input
 Object formatToDb(Object input, String argument0, String argument1)
          format an input
static int length(Object object)
           
 String validate(Object input, String argument0, String argument1)
          validate that an object is not null
static AttributeDefValidationDef valueOf(String name)
          Returns the enum constant of this type with the specified name.
static AttributeDefValidationDef[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.internet2.middleware.grouper.attr.AttributeDefValidationInterface
name
 

Enum Constant Detail

exactLength

public static final AttributeDefValidationDef exactLength
length in chars must be a certain value, not less not more


minLength

public static final AttributeDefValidationDef minLength
length in chars must be at least this amount


maxLength

public static final AttributeDefValidationDef maxLength
length in chars cannot be more than this amount


regex

public static final AttributeDefValidationDef regex
validate based on regex


required

public static final AttributeDefValidationDef required
if the value is required when the attribute is assigned


dateTimeMask

public static final AttributeDefValidationDef dateTimeMask
formatting of dateTime, the mask. Like a java SimpleDateFormat, e.g. mm/dd/ccyy


dontTrim

public static final AttributeDefValidationDef dontTrim
dont trim the value before saving. note: the logic will look at this one


stringToUpper

public static final AttributeDefValidationDef stringToUpper
make the string caps


stringToLower

public static final AttributeDefValidationDef stringToLower
make the string to lower


stringCapitalizeWords

public static final AttributeDefValidationDef stringCapitalizeWords
capitalize words so each is lower and starts with upper

Method Detail

values

public static AttributeDefValidationDef[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (AttributeDefValidationDef c : AttributeDefValidationDef.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static AttributeDefValidationDef valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

formatFromDb

public String formatFromDb(Object input,
                           String argument0,
                           String argument1)
Description copied from interface: AttributeDefValidationInterface
format an input

Specified by:
formatFromDb in interface AttributeDefValidationInterface
Parameters:
input - could be integer, string, double, or memberId
Returns:
the representation for a screen
See Also:
formatFromDb(Object, String, String)

formatToDb

public Object formatToDb(Object input,
                         String argument0,
                         String argument1)
Description copied from interface: AttributeDefValidationInterface
format an input

Specified by:
formatToDb in interface AttributeDefValidationInterface
Returns:
the string, integer, double, or memberId
See Also:
AttributeDefValidationDef#formatToDb(String, String, String)

validate

public String validate(Object input,
                       String argument0,
                       String argument1)
Description copied from interface: AttributeDefValidationInterface
validate that an object is not null

Specified by:
validate in interface AttributeDefValidationInterface
Returns:
the error string if there is one
See Also:
validate(Object, String, String)

argumentOneInt

public static int argumentOneInt(AttributeDefValidationInterface attributeDefValidationInterface,
                                 String argument0,
                                 String argument1)
should have 1 argument, as int

Parameters:
argument0 -
argument1 -
Returns:
the int

argumentOneString

public static String argumentOneString(AttributeDefValidationInterface attributeDefValidationInterface,
                                       String argument0,
                                       String argument1)
should have 1 argument, as string

Parameters:
argument0 -
argument1 -
Returns:
the string

argumentInt

public static int argumentInt(AttributeDefValidationInterface attributeDefValidationInterface,
                              String argument,
                              int argumentIndex)
make sure this argument is an int

Parameters:
attributeDefValidationInterface -
argument -
argumentIndex -

argumentOne

public static void argumentOne(AttributeDefValidationInterface attributeDefValidationInterface,
                               String argument0,
                               String argument1)
make sure there is one argument


argumentNone

public static void argumentNone(AttributeDefValidationInterface attributeDefValidationInterface,
                                String argument0,
                                String argument1)
make sure there are no argument


length

public static int length(Object object)
Parameters:
object -
Returns: