org.apache.bval.jsr303
Enum ConstraintAnnotationAttributes

java.lang.Object
  extended by java.lang.Enum<ConstraintAnnotationAttributes>
      extended by org.apache.bval.jsr303.ConstraintAnnotationAttributes
All Implemented Interfaces:
Serializable, Comparable<ConstraintAnnotationAttributes>

public enum ConstraintAnnotationAttributes
extends Enum<ConstraintAnnotationAttributes>

Defines the well-known attributes of Constraint annotations.

Version:
$Rev: 1165923 $ $Date: 2011-09-06 18:07:53 -0500 (Tue, 06 Sep 2011) $

Enum Constant Summary
GROUPS
          "groups"
MESSAGE
          "message"
PAYLOAD
          "payload"
VALUE
          "value" for multi-valued constraints
 
Method Summary
<V> V
get(Map<? super String,? super V> map)
          Get the value of this.attributeName from map.
 String getAttributeName()
          Get the attribute name represented.
<T,A extends Annotation>
T
getDefaultValue(Class<A> type)
          Get the default value of this attribute on the given annotation type.
 Type getType()
          Get the expected type of the represented attribute.
<T> T
getValue(Annotation constraint)
          Get the value of this attribute from the specified constraint annotation.
<A extends Annotation>
boolean
isDeclaredOn(Class<A> type)
          Benign means of checking for an attribute's existence.
<V> Object
put(Map<? super String,? super V> map, V value)
          Put value into a map with this.attributeName as key.
<A extends Annotation>
void
validateOn(Class<A> type)
          Verify that this attribute is validly defined on the given type.
static ConstraintAnnotationAttributes valueOf(String name)
          Returns the enum constant of this type with the specified name.
static ConstraintAnnotationAttributes[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

MESSAGE

public static final ConstraintAnnotationAttributes MESSAGE
"message"


GROUPS

public static final ConstraintAnnotationAttributes GROUPS
"groups"


PAYLOAD

public static final ConstraintAnnotationAttributes PAYLOAD
"payload"


VALUE

public static final ConstraintAnnotationAttributes VALUE
"value" for multi-valued constraints

Method Detail

values

public static ConstraintAnnotationAttributes[] 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 (ConstraintAnnotationAttributes c : ConstraintAnnotationAttributes.values())
    System.out.println(c);

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

valueOf

public static ConstraintAnnotationAttributes 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

getType

public Type getType()
Get the expected type of the represented attribute.

Returns:
Class

getAttributeName

public String getAttributeName()
Get the attribute name represented.

Returns:
String

put

public <V> Object put(Map<? super String,? super V> map,
                      V value)
Put value into a map with this.attributeName as key.

Type Parameters:
V -
Parameters:
map -
value -
Returns:
previous value mapped to this.attributeName

get

public <V> V get(Map<? super String,? super V> map)
Get the value of this.attributeName from map.

Type Parameters:
V -
Parameters:
map -
Returns:
V if you say so

validateOn

public <A extends Annotation> void validateOn(Class<A> type)
Verify that this attribute is validly defined on the given type.

Parameters:
type -
Throws:
ConstraintDefinitionException

isDeclaredOn

public <A extends Annotation> boolean isDeclaredOn(Class<A> type)
Benign means of checking for an attribute's existence.

Parameters:
type -
Returns:
whether the attribute was (properly) declared

getValue

public <T> T getValue(Annotation constraint)
Get the value of this attribute from the specified constraint annotation.

Parameters:
constraint -
Returns:
Object

getDefaultValue

public <T,A extends Annotation> T getDefaultValue(Class<A> type)
Get the default value of this attribute on the given annotation type.

Type Parameters:
T -
Parameters:
type -
Returns:
Object


Copyright © 2010-2012 Apache Software Foundation. All Rights Reserved.