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

brooklyn.event.feed.function.FunctionPollConfig Maven / Gradle / Ivy

There is a newer version: 0.7.0-M1
Show newest version
package brooklyn.event.feed.function;

import static com.google.common.base.Preconditions.checkNotNull;
import groovy.lang.Closure;

import java.util.concurrent.Callable;

import brooklyn.event.AttributeSensor;
import brooklyn.event.feed.PollConfig;
import brooklyn.util.GroovyJavaMethods;

public class FunctionPollConfig extends PollConfig> {

    private Callable callable;
    
    public FunctionPollConfig(AttributeSensor sensor) {
        super(sensor);
    }

    public FunctionPollConfig(FunctionPollConfig other) {
        super(other);
        callable = other.callable;
    }
    
    public Callable getCallable() {
        return callable;
    }
    
    public FunctionPollConfig callable(Callable val) {
        this.callable = checkNotNull(val, "callable");
        return this;
    }
    
    public FunctionPollConfig closure(Closure val) {
        this.callable = GroovyJavaMethods.callableFromClosure(checkNotNull(val, "closure"));
        return this;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy