Example usage for com.google.common.base Suppliers compose

List of usage examples for com.google.common.base Suppliers compose

Introduction

In this page you can find the example usage for com.google.common.base Suppliers compose.

Prototype

public static <F, T> Supplier<T> compose(Function<? super F, T> function, Supplier<F> supplier) 

Source Link

Document

Returns a new supplier which is the composition of the provided function and supplier.

Usage

From source file:org.jabylon.common.util.config.DynamicConfigUtil.java

private static synchronized void createSuppliers() {
    configTabs = Suppliers.memoize(Suppliers.compose(new IConfigurationElementLoader(),
            Suppliers.ofInstance("org.jabylon.rest.ui.configTab")));
    configSections = Suppliers.memoize(Suppliers.compose(new IConfigurationElementLoader(),
            Suppliers.ofInstance("org.jabylon.rest.ui.config")));

}

From source file:org.apache.beam.sdk.io.AvroUtils.java

/** Helper to get around the fact that {@link Schema} itself is not serializable. */
public static Supplier<Schema> serializableSchemaSupplier(String jsonSchema) {
    return Suppliers.memoize(Suppliers.compose(new JsonToSchema(), Suppliers.ofInstance(jsonSchema)));
}

From source file:com.bitranger.parknshop.common.recommend.util.MoreSuppliers.java

public static <X, T> Supplier<T> curry(Function<? super X, T> func, X arg) {
    return Suppliers.compose(func, Suppliers.ofInstance(arg));
}

From source file:org.jabylon.rest.ui.model.ProgressionModel.java

public ProgressionModel(String id) {
    this.modelSupplier = Suppliers.memoize(Suppliers.compose(new LookupFunction(), Suppliers.ofInstance(id)));
    this.id = id;
}

From source file:org.jabylon.rest.ui.model.ComputableModel.java

public ComputableModel(Function<F, T> loadingFunction, F seed) {
    super();//from  w  w  w .jav  a  2  s .  c o m
    result = Suppliers.compose(loadingFunction, Suppliers.memoize(Suppliers.ofInstance(seed)));
    //        this.loadingFunction = loadingFunction;
    //        this.seed = seed;
}

From source file:org.jclouds.config.ContextLinking.java

public static Module linkView(final String id, final Supplier<View> view) {
    return new AbstractModule() {
        @Override//from  w w  w  . j  a  va 2s.  c om
        protected void configure() {
            bind(VIEW_SUPPLIER).annotatedWith(Names.named(id)).toInstance(view);
            bind(CONTEXT_SUPPLIER).annotatedWith(Names.named(id))
                    .toInstance(Suppliers.compose(ViewToContext, view));
        }
    };
}

From source file:org.jabylon.rest.ui.wicket.injector.OSGiProxy.java

public OSGiProxy(IProxyTargetLocator locator) {
    supplier = Suppliers.memoize(Suppliers.compose(new LoadingFunction(), Suppliers.ofInstance(locator)));
}

From source file:org.jabylon.rest.ui.model.PropertyFileModel.java

public PropertyFileModel(PropertyFileDescriptor descriptor) {
    model = new EObjectModel<PropertyFileDescriptor>(descriptor);
    supplier = Suppliers.memoize(Suppliers.compose(new PropertyFileLoader(), Suppliers.ofInstance(model)));
}

From source file:org.jabylon.rest.ui.model.WritableEObjectModel.java

@Override
protected T getDomainObject() {
    T result = super.getDomainObject();
    if (result == null) {
        modelSupplier = Suppliers.memoize(Suppliers.compose(new LookupFunction<T>(), Suppliers.ofInstance(id)));
        result = modelSupplier.get();//from  www .j  a  v a 2  s .  c om
    }

    if (result.cdoView() instanceof CDOTransaction) {
        transaction = (CDOTransaction) result.cdoView();
    }
    return result;
}

From source file:org.jabylon.rest.ui.model.ProgressionModel.java

public void setTaskID(String id) {
    this.modelSupplier = Suppliers.memoize(Suppliers.compose(new LookupFunction(), Suppliers.ofInstance(id)));
    this.id = id;
}