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.session.impl.SAML2SPSessionCreationStrategy.java

/**
 * Constructor./*from  www .  ja v  a2 s  .c  om*/
 * 
 * @param lifetime lifetime in milliseconds, determines upper bound for expiration of
 * {@link SAML2SPSession} to be created
 */
public SAML2SPSessionCreationStrategy(@Positive @Duration final long lifetime) {
    sessionLifetime = Constraint.isGreaterThan(0, lifetime, "Lifetime must be greater than 0");
    relyingPartyContextLookupStrategy = new ChildContextLookup<>(RelyingPartyContext.class);
    responseLookupStrategy = Functions.compose(new MessageLookup<>(Response.class),
            new OutboundMessageContextLookup());
}

From source file:org.opensaml.saml.saml2.profile.impl.AbstractEncryptAction.java

/** Constructor. */
public AbstractEncryptAction() {
    encryptionCtxLookupStrategy = Functions.compose(new ChildContextLookup<>(EncryptionContext.class),
            new OutboundMessageContextLookup());
    keyPlacementLookupStrategy = FunctionSupport
            .<ProfileRequestContext, KeyPlacement>constant(KeyPlacement.INLINE);
    encryptToSelf = Predicates.alwaysFalse();
}

From source file:net.shibboleth.idp.saml.nameid.impl.PersistentSAML2NameIDGenerator.java

/** Constructor. */
public PersistentSAML2NameIDGenerator() {
    setFormat(NameID.PERSISTENT);/*from w ww.  j  ava  2 s. com*/
    subjectContextLookupStrategy = new ChildContextLookup<>(SubjectContext.class);
    attributeContextLookupStrategy = Functions.compose(
            new ChildContextLookup<RelyingPartyContext, AttributeContext>(AttributeContext.class),
            new ChildContextLookup<ProfileRequestContext, RelyingPartyContext>(RelyingPartyContext.class));
    attributeSourceIds = Collections.emptyList();
    setDefaultIdPNameQualifierLookupStrategy(new ResponderIdLookupFunction());
    setDefaultSPNameQualifierLookupStrategy(new RelyingPartyIdLookupFunction());
    useUnfilteredAttributes = true;
}

From source file:org.apache.brooklyn.entity.nosql.redis.RedisStoreImpl.java

/**
 * Create a {@link Function} to retrieve a particular field value from a {@code redis-cli info}
 * command.//from www . j  a  va 2  s . c  o m
 * 
 * @param field the info field to retrieve and convert
 * @return a new function that converts a {@link SshPollValue} to an {@link Integer}
 */
private static Function<SshPollValue, Integer> infoFunction(final String field) {
    return Functions.compose(new Function<String, Integer>() {
        @Override
        public Integer apply(@Nullable String input) {
            Optional<String> line = Iterables.tryFind(Splitter.on('\n').split(input),
                    Predicates.containsPattern(field + ":"));
            if (line.isPresent()) {
                String data = line.get().trim();
                int colon = data.indexOf(":");
                return Integer.parseInt(data.substring(colon + 1));
            } else {
                throw new IllegalStateException("Data for field " + field + " not found: " + input);
            }
        }
    }, SshValueFunctions.stdout());
}

From source file:net.shibboleth.idp.authn.impl.AttributeSourcedSubjectCanonicalization.java

/** Constructor. */
public AttributeSourcedSubjectCanonicalization() {
    delimiter = '@';
    attributeSourceIds = Collections.emptyList();

    attributeContextLookupStrategy = Functions.compose(new ChildContextLookup<>(AttributeContext.class),
            new ChildContextLookup<ProfileRequestContext, SubjectCanonicalizationContext>(
                    SubjectCanonicalizationContext.class));
}

From source file:org.opensaml.saml.common.profile.impl.VerifyChannelBindings.java

/** Constructor. */
public VerifyChannelBindings() {
    channelBindingsLookupStrategy1 = Functions.compose(new ChildContextLookup<>(ChannelBindingsContext.class),
            new InboundMessageContextLookup());
    channelBindingsLookupStrategy2 = Functions.compose(new ChildContextLookup<>(ChannelBindingsContext.class),
            Functions.compose(new ChildContextLookup<>(SOAP11Context.class),
                    new InboundMessageContextLookup()));

    channelBindingsCreationStrategy = Functions.compose(
            new ChildContextLookup<>(ChannelBindingsContext.class, true), new OutboundMessageContextLookup());
}

From source file:uk.ac.ebi.mdk.hsql.handler.HandlerBuilder.java

/**
 * Use the specified function to annotate the metabolite during
 * construction./*w  ww  .jav a  2 s .  co m*/
 *
 * @param annotator function to annotate a metabolite
 * @return self-reference
 */
public HandlerBuilder with(Function<Metabolite, Metabolite> annotator) {
    this.annotator = Functions.compose(this.annotator, annotator);
    return this;
}

From source file:org.opensaml.saml.saml2.profile.impl.ResolveArtifact.java

/** Constructor. */
public ResolveArtifact() {
    requestLookupStrategy = Functions.compose(new MessageLookup<>(ArtifactResolve.class),
            new InboundMessageContextLookup());
    responseLookupStrategy = Functions.compose(new MessageLookup<>(ArtifactResponse.class),
            new OutboundMessageContextLookup());
    requesterLookupStrategy = Functions.compose(new SAMLMessageContextIssuerFunction(),
            new InboundMessageContextLookup());
}

From source file:org.trancecode.xproc.RunnablePipeline.java

public void bindSourcePort(final String portName, final Iterable<Source> bindings) {
    final List<PortBinding> portBindings = ImmutableList
            .copyOf(Iterables.transform(bindings, Functions.compose(PortBindingFunctions.toPortBinding(),
                    SaxonFunctions.buildDocument(context.getProcessor()))));

    pipeline = pipeline.setPortBindings(portName, portBindings);
}

From source file:net.shibboleth.idp.saml.audit.impl.WriteFTICKSLog.java

/** Constructor. */
public WriteFTICKSLog() {
    relyingPartyLookupStrategy = new RelyingPartyIdLookupFunction();
    responderLookupStrategy = new ResponderIdLookupFunction();
    usernameLookupStrategy = Functions.compose(new SubjectContextPrincipalLookupFunction(),
            new ChildContextLookup(SubjectContext.class));
    authenticationMethodLookupStrategy = new AuthnContextAuditExtractor(
            Functions.compose(new MessageLookup(SAMLObject.class), new OutboundMessageContextLookup()));
    statusCodeLookupStrategy = new StatusCodeAuditExtractor(
            Functions.compose(new MessageLookup(SAMLObject.class), new OutboundMessageContextLookup()));
}