I have made traversal through object graph to pick up all fields and their given annotations and would like to validate domain objects built from the XSDs based on the annotations.
However, i got stuck on the @XmlElement as i don't know how to get the value of required attribute.
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlElement;
public class SomeClass {
@XmlElement(name = "user_id", required = true)
@NotNull
protected String userId;
}
This must be simple but i cannot figure how to check if the attribute required is set to true once i detected that the given annotation is of type @XmlElement.
if(annotation.annotationType().equals(XmlElement.class)) {
// how to check value of required atrribute
}
Aucun commentaire:
Enregistrer un commentaire