Example usage for org.springframework.data.rest.core.mapping ResourceDescription getDefaultMessage

List of usage examples for org.springframework.data.rest.core.mapping ResourceDescription getDefaultMessage

Introduction

In this page you can find the example usage for org.springframework.data.rest.core.mapping ResourceDescription getDefaultMessage.

Prototype

@Nullable
default String getDefaultMessage() 

Source Link

Document

Return the default message to be used to resolve this message.

Usage

From source file:org.springframework.data.rest.webmvc.json.PersistentEntityToJsonSchemaConverter.java

private JsonSchemaProperty getSchemaProperty(BeanPropertyDefinition definition, TypeInformation<?> type,
        ResourceDescription description) {

    String name = definition.getName();
    String title = resolveMessageWithDefault(new ResolvableProperty(definition));
    String resolvedDescription = resolveMessage(description);
    boolean required = definition.isRequired();
    Class<?> rawType = type.getType();

    if (!rawType.isEnum()) {
        return new JsonSchemaProperty(name, title, resolvedDescription, required).with(type);
    }/*from   ww  w  .  ja  va  2s . c om*/

    String message = resolveMessage(new DefaultMessageSourceResolvable(description.getMessage()));

    return new EnumProperty(name, title, rawType,
            description.getDefaultMessage().equals(resolvedDescription) ? message : resolvedDescription,
            required);
}