本文整理汇总了Java中com.google.api.client.repackaged.com.google.common.base.Joiner类的典型用法代码示例。如果您正苦于以下问题:Java Joiner类的具体用法?Java Joiner怎么用?Java Joiner使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Joiner类属于com.google.api.client.repackaged.com.google.common.base包,在下文中一共展示了Joiner类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getChannels
import com.google.api.client.repackaged.com.google.common.base.Joiner; //导入依赖的package包/类
@Override
public List<Channel> getChannels(List<String> channelIds)
{
try
{
YouTube.Channels.List channels = getTubeService().channels().list("snippet");
channels.setKey(getApiKey());
channels.setId(Joiner.on(",").join(channelIds));
ChannelListResponse channelListResponse = channels.execute();
return channelListResponse.getItems();
}
catch( Exception ex )
{
throw Throwables.propagate(ex);
}
}
示例2: getVideos
import com.google.api.client.repackaged.com.google.common.base.Joiner; //导入依赖的package包/类
@Override
public List<Video> getVideos(List<String> videoIds)
{
try
{
YouTube.Videos.List videos = getTubeService().videos().list("id,snippet,player,contentDetails,statistics");
videos.setKey(getApiKey());
videos.setId(Joiner.on(",").join(videoIds));
VideoListResponse vlr = videos.execute();
return vlr.getItems();
}
catch( Exception ex )
{
throw Throwables.propagate(ex);
}
}
示例3: toString
import com.google.api.client.repackaged.com.google.common.base.Joiner; //导入依赖的package包/类
@Override
public String toString() {
List<String> terms = new ArrayList<String>();
addTerm(terms, allTerms, "AND", null);
addTerm(terms, someTerms, "OR", null);
if (phrase != null) {
terms.add("\"" + phrase + "\"");
}
if (exclude != null) {
terms.add("-(" + exclude + ")");
}
addTerm(terms, siteTypes, "OR", "site_type");
addTerm(terms, language, "OR", "language");
addTerm(terms, sites, "OR", "site");
addTerm(terms, persons, "OR", "person");
addTerm(terms, locations, "OR", "location");
addTerm(terms, organizations, "OR", "organization");
if (title != null) {
terms.add("title:(" + title + ")");
}
if (bodyText != null) {
terms.add("text:(" + bodyText+ ")");
}
return Joiner.on(" AND ").join(terms);
}
示例4: getQueryForSentence
import com.google.api.client.repackaged.com.google.common.base.Joiner; //导入依赖的package包/类
/**
* Returns the query for a sentence by configured tags
*
* @param sentence i.e. "Ich ging in den dunklen Wald"
* @return i.e. "dunklen Wald"
*/
public String getQueryForSentence(String sentence) {
log.debug("getQueryForSentence in: " + sentence);
if (sentence == null) {
return null;
}
String words[] = sentence.split(" ");
String wordsTags[] = postagger.tag(words);
LinkedHashSet<String> wordsResult = new LinkedHashSet<String>();
for (int i = 0; i < wordsTags.length; i++) {
if (tags.contains(wordsTags[i])) {
wordsResult.add(words[i]);
}
}
String result = Joiner.on(" ").join(wordsResult);
log.debug("getQueryForSentence result: " + result);
return result;
}
示例5: resolve
import com.google.api.client.repackaged.com.google.common.base.Joiner; //导入依赖的package包/类
public ImmutableSet<EquivalenceGraph> resolve(EquivalenceGraphUpdate graphUpdate) {
ImmutableSet<Id> graphIds = graphUpdate.getAllGraphs()
.stream()
.map(EquivalenceGraph::getId)
.collect(MoreCollectors.toImmutableSet());
try {
return graphStore.resolveIds(graphIds).get()
.values()
.stream()
.filter(Optional::isPresent)
.map(Optional::get)
.collect(MoreCollectors.toImmutableSet());
} catch (InterruptedException | ExecutionException e) {
log.error("Failed to resolve equivalence graphs for {}", Joiner.on(",").join(graphIds));
throw Throwables.propagate(e);
}
}
示例6: showDetails
import com.google.api.client.repackaged.com.google.common.base.Joiner; //导入依赖的package包/类
public void showDetails(Book book, Drawable thumb) {
Log.d(TAG, "Show details on " + book.getId());
// Reset the scroll view if this is a different from previous book
if (current != null && !current.getId().equals(book.getId())) {
scrollView.scrollTo(0,0);
}
// Show mandatory info
current = book;
title.setText(book.getTitle());
if (book.getAuthors() != null) {
authors.setText(Joiner.on(", ").join(book.getAuthors()));
} else {
authors.setText(null);
}
Integer count = book.getPageCount();
if (count != null) {
String pageString = pages.getResources().getString(R.string.pages, count);
pages.setText(pageString);
} else {
pages.setText(null);
}
preloadedDrawable = thumb;
setSaleInfo(current);
if (book.getDetails() == null) {
if (thumb != null) {
picture.setImageDrawable(thumb.getCurrent());
} else {
picture.setImageResource(R.drawable.user_placeholder);
}
detailsLoader.doSearch(book);
} else {
onDetailsLoaded(book);
}
}
示例7: setAuthors
import com.google.api.client.repackaged.com.google.common.base.Joiner; //导入依赖的package包/类
private void setAuthors(List<String> authorList) {
int visibility;
if (authorList != null && !authorList.isEmpty()) {
String join = Joiner.on(", ").join(authorList);
authors.setText(join);
visibility = View.VISIBLE;
} else {
visibility = View.GONE;
}
authors.setVisibility(visibility);
}
示例8: getAllEntries
import com.google.api.client.repackaged.com.google.common.base.Joiner; //导入依赖的package包/类
private List<String> getAllEntries(ListFeed listFeed, String[] headerDefault)
{
List<String> returnValue = Lists.newArrayList();
Joiner joiner = Joiner.on(Properties.inputDelimiter.get());
Set<String> header = null;
List<ListEntry> entries = listFeed.getEntries();
if (entries != null && entries.size() > 0) {
ListEntry listEntry = entries.get(0);
if (listEntry != null)
header = listEntry.getCustomElements().getTags();
}
if (header == null && headerDefault != null) {
header = new LinkedHashSet<String>();
for (String headerItem : headerDefault) {
header.add(headerItem);
}
}
returnValue.add(joiner.join(header));
for (ListEntry row : entries) {
List<String> rowValues = Lists.newArrayList();
for (String tag : header) {
String value = row.getCustomElements().getValue(tag);
if (value == null)
value = "";
rowValues.add(value);
}
String rowValuesString = joiner.join(rowValues);
returnValue.add(rowValuesString);
}
return returnValue;
}
示例9: toRemotePaths
import com.google.api.client.repackaged.com.google.common.base.Joiner; //导入依赖的package包/类
public static String toRemotePaths(List<FilePath> importPaths) {
return Joiner.on(',').join(transform(importPaths, new Function<FilePath, String>() {
@Override
public String apply(FilePath input) {
return input.getRemote();
}
}));
}
示例10: constructMessage
import com.google.api.client.repackaged.com.google.common.base.Joiner; //导入依赖的package包/类
private static String constructMessage(String message, HttpResponseException exception) {
try {
ErrorBody body = Json.getInstance().fromJson(exception.getContent(), ErrorBody.class);
if (body.errors.size() > 0) {
return message + " (" + Joiner.on("; ").join(body.errors) + ")";
}
} catch (Exception e) {
}
return message;
}
示例11: init
import com.google.api.client.repackaged.com.google.common.base.Joiner; //导入依赖的package包/类
@Before public void init() throws IOException {
sparkRunner = SparkPipelineRunner.create();
directRunner = DirectPipelineRunner.createForTest();
testDataDirName = Joiner.on(File.separator).join("target", "test-data", name.getMethodName())
+ File.separator;
FileUtils.deleteDirectory(new File(testDataDirName));
new File(testDataDirName).mkdirs();
}
示例12: runPipeline
import com.google.api.client.repackaged.com.google.common.base.Joiner; //导入依赖的package包/类
private String runPipeline(String name, PipelineRunner<?> runner) {
Pipeline p = Pipeline.create(PipelineOptionsFactory.create());
String outFile = Joiner.on(File.separator).join(testDataDirName, "test_text_out_" + name);
PCollection<String> lines = p.apply(TextIO.Read.from("src/test/resources/test_text.txt"));
lines.apply(TextIO.Write.to(outFile));
runner.run(p);
return outFile;
}
示例13: onPreMessageReceived
import com.google.api.client.repackaged.com.google.common.base.Joiner; //导入依赖的package包/类
@Override
public Message onPreMessageReceived(Peer peer, Message m) {
if (m instanceof Pong) {
// nothing
} else if (m instanceof InventoryMessage) {
InventoryMessage inv = (InventoryMessage) m;
log.info("[MESSAGE INV] size={}\nitem={}",
inv.getItems().size(),
Joiner.on(",").join(Lists.transform(inv.getItems(), FunInvItemToString)));
} else {
log.info("[MESSAGE] = {}", m);
}
return super.onPreMessageReceived(peer, m);
}
示例14: getInfo
import com.google.api.client.repackaged.com.google.common.base.Joiner; //导入依赖的package包/类
public String getInfo()
{
ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
if (getRawScore() != null)
{
builder.put(CaddAnnotator.CADD_ABS, getRawScore().toString());
}
if (getPhred() != null)
{
builder.put(CaddAnnotator.CADD_SCALED, getPhred().toString());
}
return Joiner.on(";").withKeyValueSeparator("=").join(builder.build());
// return "CADD=" + getRawScore() + ";CADD_SCALED=" + getPhred();
}
示例15: getJoinedContext
import com.google.api.client.repackaged.com.google.common.base.Joiner; //导入依赖的package包/类
public String getJoinedContext() {
return context.isEmpty() ? "(root)" : Joiner.on("").join(context);
}