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.trancecode.io.UriFunctions.java

public static Function<URI, URI> resolveUri(final URI baseUri) {
    if (baseUri == null) {
        return Functions.identity();
    }/*w ww  . j  av  a 2 s . c  om*/

    return new ResolveUriFunction(baseUri);
}

From source file:com.cinchapi.concourse.util.Conversions.java

/**
 * Return a function that doesn't perform any conversion.
 * //from www .j  a va2  s  . c o  m
 * @return the (non) conversion function
 */
public static <T> Function<T, T> none() {
    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   w ww .  j  a v  a2 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(T[] left, T[] right) {
    return inLeftOnly(Lists.newArrayList(left), Lists.newArrayList(right), Functions.identity());
}

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

/**
 * Returns a new transformer that inserts segments at the beginning of the provided path.
 * @param segments Segments to add./*from   w ww. j av a2 s .  c om*/
 * @return The requested transformer.
 */
public static Function<PathSegments, PathSegments> insert(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 segments.add(input);
        }

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

From source file:org.trancecode.xproc.variable.VariableFunctions.java

public static Function<Variable, Variable> identity() {
    return Functions.identity();
}

From source file:ws.moor.swissvault.persistence.model.Property.java

@SuppressWarnings("unchecked")
private Property(String name) {
    this(name, (Function<T, Object>) Functions.identity(), (Function<Object, T>) Functions.identity());
}

From source file:io.druid.query.groupby.orderby.NoopLimitSpec.java

@Override
public Function<Sequence<Row>, Sequence<Row>> build(List<DimensionSpec> dimensions,
        List<AggregatorFactory> aggs, List<PostAggregator> postAggs) {
    return Functions.identity();
}

From source file:org.apache.brooklyn.entity.chef.ChefAttributePollConfig.java

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

From source file:brooklyn.event.feed.windows.WindowsPerformanceCounterPollConfig.java

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

From source file:cat.calidos.morfeu.model.metadata.injection.GlobalModelMetadataModule.java

@Produces
public static Map<URI, Metadata> provideGlobalModelMetadata(XSAnnotation annotation,
        @Named("ModelURI") URI uri) {

    List<Node> extraMetadataNodes = DaggerMetadataAnnotationComponent.builder().from(annotation)
            .andTag("mf:metadata").build().values();

    // an XSAnnotation is just a wrapper for any kind of object, in this case a Node, so we give it that
    return extraMetadataNodes.stream().map(m -> DaggerModelMetadataComponent.builder().from(new XSAnnotation() {

        @Override/*w w w  . ja v a  2s .  co m*/
        public Object setAnnotation(Object o) {
            return null;
        }

        @Override
        public Locator getLocator() {
            return null;
        }

        @Override
        public Object getAnnotation() {
            return m;
        }
    }).withParentURI(uri).build().value())
            .collect(Collectors.toMap(Metadata::getURI, Functions.identity(), (p1, p2) -> p1));
    // FIXME: sometimes we get a duplicate here, we should investigate at some point

}