All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.netgrif.application.engine.configuration.JsonRootRelProvider.groovy Maven / Gradle / Ivy

Go to download

System provides workflow management functions including user, role and data management.

There is a newer version: 6.3.3
Show newest version
package com.netgrif.application.engine.configuration

import com.fasterxml.jackson.annotation.JsonRootName
import org.atteo.evo.inflector.English
import org.springframework.hateoas.LinkRelation
import org.springframework.hateoas.server.LinkRelationProvider
import org.springframework.util.StringUtils

class JsonRootRelProvider implements LinkRelationProvider {


    @Override
    LinkRelation getItemResourceRelFor(Class aClass) {
        return LinkRelationProvider.getItemResourceRelFor(aClass)
    }

    @Override
    LinkRelation getCollectionResourceRelFor(Class type) {
        JsonRootName rootName = type.getAnnotationsByType(JsonRootName)?.find { true }
        return rootName ? English.plural(rootName.value()) : English.plural(StringUtils.uncapitalize(type.getSimpleName()))
    }

    @Override
    boolean supports(LookupContext delimiter) {
        return LinkRelationProvider.supports(delimiter)
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy