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

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

Introduction

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

Prototype

public static Function<Object, String> toStringFunction() 

Source Link

Document

Returns a function that calls toString() on its argument.

Usage

From source file:com.google.devtools.build.android.desugar.io.ZipInputFileProvider.java

@Override
public Iterator<String> iterator() {
    return Iterators.transform(Iterators.forEnumeration(zipFile.entries()), Functions.toStringFunction());
}

From source file:com.b2international.index.lucene.FilteredIndexField.java

@Override
public List<String> getValuesAsStringList(Document doc) {
    return FluentIterable.from(getValues(doc)).transform(Functions.toStringFunction()).toList();
}

From source file:swingn.ui.ListBox.java

/**
 * Creates an item renderer that, for a source item, produces a {@link ToggleButton} with text
 * set to the result of the source item's {@code toString()} method.
 *///w ww. j av a2 s  .c  om
public static <T> Renderer<T> labels() {
    return ListBox.<T>labels(Functions.toStringFunction());
}

From source file:google.registry.tools.PendingEscrowCommand.java

@Override
public void run() throws Exception {
    System.out.println(FluentIterable
            .from(SORTER.sortedCopy(checker.getTldsAndWatermarksPendingDepositForRdeAndBrda().values()))
            .transform(Functions.toStringFunction()).join(Joiner.on('\n')));
}

From source file:com.github.jsdossier.jscomp.DossierModuleRegistry.java

/**
 * Creates a new registry.//from  w w  w  .j a  v a2s.  c  om
 *
 * @param commonJsModulePaths the set of source files that should be treated as a CommonJS
 *     modules. All other source files will be treated as normal JS files.
 */
public DossierModuleRegistry(Iterable<Path> commonJsModulePaths) {
    this.commonJsModulePaths = FluentIterable.from(commonJsModulePaths).transform(Functions.toStringFunction())
            .toSet();
    this.fileSystem = commonJsModulePaths.iterator().hasNext()
            ? commonJsModulePaths.iterator().next().getFileSystem()
            : FileSystems.getDefault();
}

From source file:brooklyn.location.docker.strategy.LabelPlacementStrategy.java

@Override
public boolean apply(DockerHostLocation input) {
    Set<String> labels = MutableSet.copyOf(config().get(LABELS));
    if (labels.isEmpty())
        return true;
    Set<String> tags = MutableSet
            .copyOf(Iterables.transform(input.getMachine().tags().getTags(), Functions.toStringFunction()));
    labels.removeAll(tags);/*from  w w  w. j  a  va 2 s. c o  m*/
    LOG.debug("Host {} : Tags {} : Remaining {}", new Object[] { input, Iterables.toString(tags),
            labels.isEmpty() ? "none" : Iterables.toString(labels) });

    return labels.isEmpty();
}

From source file:com.googlecode.blaisemath.graph.app.GraphAppCanvas.java

public GraphAppCanvas() {
    PanAndZoomHandler.install(this);

    graph = adapter.getViewGraph();//from  w  ww. j a  va 2 s .  c om
    graph.setDragEnabled(true);
    graph.setPointSelectionEnabled(true);

    graph.getNodeStyler().setLabelDelegate(Functions.toStringFunction());
    graph.getNodeStyler().setLabelStyleDelegate(new Function<Object, AttributeSet>() {
        @Override
        public AttributeSet apply(Object input) {
            double rad = ((Number) scaler.apply(input).get(Styles.MARKER_RADIUS)).doubleValue();
            Point2D offset = new Point2D.Double(rad, rad);
            return AttributeSet.createWithParent(Styles.defaultTextStyle()).and(Styles.FONT_SIZE, 8f)
                    .and(Styles.OFFSET, offset);
        }
    });
    graph.getNodeStyler().setStyleDelegate(scaler);
}

From source file:com.b2international.index.lucene.FilteredIndexField.java

@Override
public Set<String> getValuesAsStringSet(Document doc) {
    return FluentIterable.from(getValues(doc)).transform(Functions.toStringFunction()).toSet();
}

From source file:de.cosmocode.palava.ipc.conversation.CompletionFailedException.java

@Override
public String toString() {
    return getClass().getName() + ":\n"
            + JOINER.join(Iterables.transform(errors.keySet(), Functions.toStringFunction()));
}

From source file:de.learnlib.algorithms.features.observationtable.OTUtils.java

public static <I, D> void writeHTMLToFile(ObservationTable<I, D> table, File file) throws IOException {
    writeHTMLToFile(table, file, Functions.toStringFunction(), Functions.toStringFunction());
}