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

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

Introduction

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

Prototype


@SuppressWarnings("unchecked")
public static <E> Function<E, E> identity() 

Source Link

Document

Returns the identity function.

Usage

From source file:org.apache.brooklyn.feed.windows.WindowsPerformanceCounterPollConfig.java

@SuppressWarnings({ "unchecked", "rawtypes" })
public WindowsPerformanceCounterPollConfig(AttributeSensor<T> sensor) {
    super(sensor);
    description(sensor.getDescription());
    onSuccess((Function) Functions.identity());
}

From source file:com.isotrol.impe3.api.PathSegmentsTransformers.java

/**
 * Returns a new transformer that appends segments to the provided path.
 * @param segments Segments to append./*from  ww  w .jav a 2s.c  o m*/
 * @return The requested transformer.
 */
public static Function<PathSegments, PathSegments> append(final PathSegments segments) {
    if (segments == null || segments.isEmpty()) {
        return Functions.identity();
    }
    return new Function<PathSegments, PathSegments>() {
        public PathSegments apply(PathSegments input) {
            if (input == null || input.isEmpty()) {
                return segments;
            }
            return input.add(segments);
        }

        public String toString() {
            return String.format("Append transformer: %s", segments);
        };
    };
}

From source file:org.apache.brooklyn.feed.jmx.JmxAttributePollConfig.java

@SuppressWarnings({ "unchecked", "rawtypes" })
public JmxAttributePollConfig(AttributeSensor<T> sensor) {
    super(sensor);
    onSuccess((Function) Functions.identity());
}

From source file:org.semanticweb.elk.proofs.TracingInferenceWrap.java

@Override
public List<? extends Object> getPremises() {
    return Lists.transform(getDelegate().getPremises(), Functions.identity());
}

From source file:se.softhouse.common.guavaextensions.Functions2.java

/**
 * Runs several {@link Function}s in the same order as they are
 * given as arguments here.<br>/*from  w  ww.  ja va  2s.co  m*/
 * If one of the {@link Function}s makes {@code T} {@link Immutable},
 * make sure to pass it in last as it's hard to modify
 * an {@link Immutable} value. This works exactly like
 * {@link Functions#compose(Function, Function)} except that if {@code first} doesn't do
 * anything, {@code second} is returned directly instead.
 * 
 * @param first a {@link Function}
 * @param second another {@link Function}
 * @return a merged {@link Function}
 */
@Nonnull
public static <T> Function<T, T> compound(Function<T, T> first, Function<T, T> second) {
    checkNotNull(first);
    checkNotNull(second);
    if (first == Functions.identity())
        return second;

    return new CompoundFunction<T>(first, second);
}

From source file:com.isotrol.impe3.api.support.DefaultLocaleURIGenerator.java

/**
 * @see com.isotrol.impe3.api.LocaleURIGenerator#getTransformer(com.isotrol.impe3.api.Portal, java.util.Locale)
 *//*  w  ww.  jav a2  s .  co  m*/
public Function<PathSegments, PathSegments> getTransformer(Portal portal, Locale locale) {
    return Functions.identity();
}

From source file:org.eclipse.umlgen.reverse.c.internal.reconciler.Utils.java

/**
 * This returns only the objects which are only in the given <code>left</code> list.
 *
 * @param left//from ww w  .  ja  va2  s.co m
 *            The left list
 * @param right
 *            The right list
 * @param <T>
 *            Any Java object
 * @return The objects only in left side
 */
public static <T> Collection<T> inLeftOnly(Collection<T> left, Collection<T> right) {
    return inLeftOnly(left, right, Functions.identity());
}

From source file:org.apache.brooklyn.feed.jmx.JmxNotificationSubscriptionConfig.java

@SuppressWarnings({ "unchecked", "rawtypes" })
public JmxNotificationSubscriptionConfig(AttributeSensor<T> sensor) {
    super(sensor);
    onSuccess((Function) Functions.identity());
}

From source file:org.apache.brooklyn.feed.jmx.JmxOperationPollConfig.java

@SuppressWarnings({ "unchecked", "rawtypes" })
public JmxOperationPollConfig(AttributeSensor<T> sensor) {
    super(sensor);
    onSuccess((Function) Functions.identity());
}

From source file:com.facebook.presto.hive.FileSystemWrapperProvider.java

Function<FileStatus, FileStatus> createFileStatusWrapper() {
    return Functions.identity();
}