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

org.kohsuke.groovy.sandbox.impl.InvokerChain Maven / Gradle / Ivy

There is a newer version: 1.19
Show newest version
package org.kohsuke.groovy.sandbox.impl;

import org.kohsuke.groovy.sandbox.GroovyInterceptor;
import org.kohsuke.groovy.sandbox.GroovyInterceptor.Invoker;

import java.util.Collections;
import java.util.Iterator;

/**
 * @author Kohsuke Kawaguchi
 */
abstract class InvokerChain implements Invoker {
    protected final Iterator chain;

    protected InvokerChain(Object receiver) {
        // See issue #6, #15. When receiver is null, technically speaking Groovy handles this
        // as if NullObject.INSTANCE is the receiver. OTOH, it's confusing
        // to GroovyInterceptor that the receiver can be null, so I'm
        // bypassing the checker in this case.
        if (receiver==null)
            chain = EMPTY_ITERATOR;
        else
            chain = GroovyInterceptor.getApplicableInterceptors().iterator();
    }

    private static final Iterator EMPTY_ITERATOR = Collections.emptyList().iterator();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy