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

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

Introduction

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

Prototype

boolean isDefault();

Source Link

Document

Returns whether this is the default description.

Usage

From source file:org.springframework.data.rest.webmvc.alps.RootResourceInformationToAlpsDescriptorConverter.java

private String resolveMessage(ResourceDescription description) {

    if (!description.isDefault()) {
        return description.getMessage();
    }/*from w  ww  . ja  va  2 s.  c  o m*/

    try {
        return messageSource.getMessage(description);
    } catch (NoSuchMessageException o_O) {
        return configuration.getMetadataConfiguration().omitUnresolvableDescriptionKeys() ? null
                : description.getMessage();
    }
}

From source file:org.springframework.data.rest.webmvc.alps.RootResourceInformationToAlpsDescriptorConverter.java

private Doc getDocFor(ResourceDescription description, PersistentProperty<?> property) {

    if (description == null) {
        return null;
    }//from w  w w. ja v  a 2  s  .  c  om

    String message = resolveMessage(description);

    // Manually post process the default message for enumerations if needed
    if (configuration.isEnableEnumTranslation() && property != null && property.getType().isEnum()) {
        if (description.isDefault()) {
            return new Doc(
                    StringUtils.collectionToDelimitedString(
                            translator.getValues((Class<? extends Enum<?>>) property.getType()), ", "),
                    Format.TEXT);
        }
    }

    return message == null ? null : new Doc(message, Format.TEXT);
}