Skip to content
Permalink
Browse files
toString
  • Loading branch information
mbenson committed Oct 16, 2018
1 parent 4bfbc97 commit e634f4c95c66ac3601123324cc04c748a7b0baa3
Showing 1 changed file with 8 additions and 0 deletions.
@@ -53,6 +53,7 @@
import org.apache.bval.jsr.util.AnnotationsManager;
import org.apache.bval.jsr.util.ToUnmodifiable;
import org.apache.bval.util.Exceptions;
import org.apache.bval.util.Lazy;
import org.apache.bval.util.Validate;

public class ConstraintD<A extends Annotation> implements ConstraintDescriptor<A> {
@@ -81,6 +82,8 @@ private static <T> Set<T> set(Supplier<T[]> array) {

private final Set<ConstraintDescriptor<?>> composingConstraints;
private final List<Class<? extends ConstraintValidator<A, ?>>> constraintValidatorClasses;
private final Lazy<String> toString =
new Lazy<>(() -> String.format("%s: %s", ConstraintD.class.getSimpleName(), getAnnotation()));

public ConstraintD(A annotation, Scope scope, Meta<?> meta, ApacheValidatorFactory validatorFactory) {
this.annotation = Validate.notNull(annotation, "annotation");
@@ -170,6 +173,11 @@ public ElementType getDeclaredOn() {
return meta.getElementType();
}

@Override
public String toString() {
return toString.get();
}

private <T> T read(ConstraintAnnotationAttributes attr) {
return read(attr, Optionality.OPTIONAL);
}

0 comments on commit e634f4c

Please sign in to comment.