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

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

Introduction

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

Prototype

public static <A, B, C> Function<A, C> compose(Function<B, C> g, Function<A, ? extends B> f) 

Source Link

Document

Returns the composition of two functions.

Usage

From source file:net.shibboleth.idp.saml.saml2.profile.delegation.impl.AddDelegationRestrictionToAssertions.java

/**
 * Constructor.//w w w  .java  2  s  .  c  o m
 */
public AddDelegationRestrictionToAssertions() {
    responseLookupStrategy = Functions.compose(new MessageLookup<>(Response.class),
            new OutboundMessageContextLookup());
    presenterContextLookupStrategy = Functions.compose(
            new ChildContextLookup<>(SAMLPresenterEntityContext.class), new InboundMessageContextLookup());

    libertyContextLookupStrategy = new ChildContextLookup<>(LibertySSOSContext.class);
}

From source file:net.shibboleth.idp.saml.impl.profile.saml2.AddStatusToResponse.java

/** Constructor. */
public AddStatusToResponse() {
    relyingPartyContextLookupStrategy = new ChildContextLookup<>(RelyingPartyContext.class, false);
    responseLookupStrategy = Functions.compose(new MessageLookup<Response>(),
            new OutboundMessageContextLookup<Response>());
    statusCodes = Collections.emptyList();
    statusMessageFromEvent = true;/* w  ww  .  j a  v  a2  s . co m*/
    detailedStatus = false;
}

From source file:org.apache.abdera2.common.misc.MapRed.java

public static <K1, V1, K2, V2, V3> Function<Iterable<Pair<K1, V1>>, Iterable<Pair<K2, Iterable<V3>>>> compose(
        Mapper<K1, V1, K2, V2> mapper, Reducer<K2, V2, K2, V3> reducer, Comparator<K2> comparator) {
    return Functions.compose(asFunction(reducer, comparator), asFunction(mapper, comparator));
}

From source file:com.eucalyptus.compute.common.internal.vm.VmInstances.java

/**
 * Function for lookup of non-terminated VM instances.
 *
 * <p>The function parameter is the instance identifier the return is the
 * instance. The function will not return null, but may throw
 * NoSuchElementException or TerminatedInstanceException.</p>
 *
 * @return The function./*w  w  w .j ava2 s  .c o  m*/
 */
public static Function<String, VmInstance> lookup() {
    return Functions.compose(TerminatedInstanceCheck.INSTANCE, PersistentLookup.INSTANCE);
}

From source file:org.opensaml.saml.saml1.profile.impl.AddSubjectConfirmationToSubjects.java

/** Constructor. */
public AddSubjectConfirmationToSubjects() {
    subjectBuilder = (SAMLObjectBuilder<Subject>) XMLObjectProviderRegistrySupport.getBuilderFactory()
            .<Subject>getBuilderOrThrow(Subject.DEFAULT_ELEMENT_NAME);
    confirmationBuilder = (SAMLObjectBuilder<SubjectConfirmation>) XMLObjectProviderRegistrySupport
            .getBuilderFactory()/*from w ww . jav a2s. c o m*/
            .<SubjectConfirmation>getBuilderOrThrow(SubjectConfirmation.DEFAULT_ELEMENT_NAME);
    confirmationMethodBuilder = (SAMLObjectBuilder<ConfirmationMethod>) XMLObjectProviderRegistrySupport
            .getBuilderFactory().<ConfirmationMethod>getBuilderOrThrow(ConfirmationMethod.DEFAULT_ELEMENT_NAME);

    overwriteExisting = true;

    responseLookupStrategy = Functions.compose(new MessageLookup<>(Response.class),
            new OutboundMessageContextLookup());
    confirmationMethods = Collections.emptyList();
}

From source file:net.shibboleth.idp.profile.impl.ResolveAttributes.java

/**
 * Constructor.//  w ww.  j  ava 2s . c  o  m
 * 
 * @param resolverService resolver used to fetch attributes
 */
public ResolveAttributes(@Nonnull final ReloadableService<AttributeResolver> resolverService) {
    attributeResolverService = Constraint.isNotNull(resolverService, "AttributeResolver cannot be null");

    issuerLookupStrategy = new ResponderIdLookupFunction();
    recipientLookupStrategy = new RelyingPartyIdLookupFunction();

    principalNameLookupStrategy = Functions.compose(new SubjectContextPrincipalLookupFunction(),
            new ChildContextLookup<ProfileRequestContext, SubjectContext>(SubjectContext.class));

    authnContextLookupStrategy = new ChildContextLookup<>(AuthenticationContext.class);

    // Defaults to ProfileRequestContext -> RelyingPartyContext -> AttributeContext.
    attributeContextCreationStrategy = Functions.compose(new ChildContextLookup<>(AttributeContext.class, true),
            new ChildContextLookup<ProfileRequestContext, RelyingPartyContext>(RelyingPartyContext.class));

    attributesToResolve = Collections.emptyList();

    maskFailures = true;
}

From source file:com.twitter.aurora.scheduler.storage.mem.MemTaskStore.java

private Multimap<IJobKey, String> taskIdsByJobKey(Iterable<Task> toIndex) {
    return Multimaps.transformValues(
            Multimaps.index(toIndex, Functions.compose(Tasks.SCHEDULED_TO_JOB_KEY, TO_SCHEDULED)), TO_ID);
}

From source file:com.eucalyptus.node.Nodes.java

private static Function<String, ServiceConfiguration> lookupNodeServiceConfiguration(
        ServiceConfiguration ccConfig) {
    return Functions.compose(transformNodeInfo(ccConfig), lookupNodeInfo(ccConfig));
}

From source file:org.apache.abdera2.common.misc.MapRed.java

public static <K1, V1, K2, V2, K3, V3> Function<Iterable<Pair<K1, V1>>, Iterable<Pair<K3, Iterable<V3>>>> compose(
        Mapper<K1, V1, K2, V2> mapper, Reducer<K2, V2, K3, V3> reducer, Comparator<K2> comparator,
        Comparator<K3> comparator2) {
    return Functions.compose(asFunction(reducer, comparator2), asFunction(mapper, comparator));
}

From source file:fi.okm.mpass.idp.authn.impl.SetOIDCInformation.java

/** Constructor. */
public SetOIDCInformation() {
    log.trace("Entering");
    attributeContextLookupStrategy = Functions.compose(new ChildContextLookup<>(AttributeContext.class),
            new ChildContextLookup<ProfileRequestContext, RelyingPartyContext>(RelyingPartyContext.class));
    log.trace("Leaving");
}