Example usage for org.springframework.restdocs.constraints ConstraintDescriptions descriptionsForProperty

List of usage examples for org.springframework.restdocs.constraints ConstraintDescriptions descriptionsForProperty

Introduction

In this page you can find the example usage for org.springframework.restdocs.constraints ConstraintDescriptions descriptionsForProperty.

Prototype

public List<String> descriptionsForProperty(String property) 

Source Link

Document

Returns a list of the descriptions for the constraints on the given property.

Usage

From source file:com.netflix.genie.web.controllers.Snippets.java

private static Attributes.Attribute getConstraintsForField(final ConstraintDescriptions constraints,
        final String fieldName) {
    return Attributes.key(CONSTRAINTS).value(
            StringUtils.collectionToDelimitedString(constraints.descriptionsForProperty(fieldName), ". "));
}

From source file:com.example.Constraints.java

@SuppressWarnings("unused")
// tag::constraints[]
public void example() {
    ConstraintDescriptions userConstraints = new ConstraintDescriptions(UserInput.class); // <1>
    List<String> descriptions = userConstraints.descriptionsForProperty("name"); // <2>
}

From source file:capital.scalable.restdocs.constraints.ConstraintReaderImpl.java

@Override
public List<String> getConstraintMessages(Class<?> javaBaseClass, String javaFieldName) {
    ConstraintDescriptions constraints = new ConstraintDescriptions(javaBaseClass, constraintResolver,
            constraintDescriptionResolver);
    List<String> constraintMessages = new ArrayList<>();
    constraintMessages.addAll(constraints.descriptionsForProperty(javaFieldName));
    constraintMessages.addAll(getEnumConstraintMessage(javaBaseClass, javaFieldName));
    return constraintMessages;
}