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

grails.plugin.json.view.api.internal.DefaultJsonViewIncludeExcludeSupport.groovy Maven / Gradle / Ivy

Go to download

Provides additional view technologies to the Grails framework, including JSON and Markup views.

The newest version!
package grails.plugin.json.view.api.internal

import groovy.transform.CompileStatic
import org.grails.core.util.IncludeExcludeSupport

@CompileStatic
class DefaultJsonViewIncludeExcludeSupport extends IncludeExcludeSupport {

    DefaultJsonViewIncludeExcludeSupport(List defaultIncludes, List defaultExcludes) {
        super(defaultIncludes, defaultExcludes)
    }

    @Override
    boolean shouldInclude(List incs, List excs, String object) {
        def i = object.lastIndexOf('.')
        String unqualified = i > -1 ? object.substring(i + 1) : null
        return super.shouldInclude(incs, excs, object) && (unqualified == null || (includes(defaultIncludes, unqualified) && !excludes(defaultExcludes, unqualified)))
    }

    @Override
    boolean includes(List includes, String object) {
        includes == null ||
                includes.contains(object) ||
                includes.any { object.startsWith(it + ".") } ||
                includes.any { it.startsWith(object + ".") }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy