List of usage examples for com.google.common.base Splitter on
@CheckReturnValue @GwtIncompatible("java.util.regex") public static Splitter on(final Pattern separatorPattern)
From source file:org.apache.metron.pcap.PcapHelper.java
public static Long getTimestamp(String filename) { try {/*from w ww .j a va 2 s.c o m*/ return Long.parseUnsignedLong(Iterables.get(Splitter.on('_').split(filename), 2)); } catch (Exception e) { //something went wrong here. return null; } }
From source file:org.apache.phoenix.pig.util.TableSchemaParserFunction.java
@Override public Pair<String, String> apply(final String tableSchema) { Preconditions.checkNotNull(tableSchema); Preconditions.checkArgument(!tableSchema.isEmpty(), "HBase Table name is empty!!"); final String tokens[] = Iterables.toArray( Splitter.on(TABLE_COLUMN_DELIMITER).trimResults().omitEmptyStrings().split(tableSchema), String.class); final String tableName = tokens[0]; String columns = null;/* w w w. ja va2 s .co m*/ if (tokens.length > 1) { columns = tokens[1]; } return new Pair<String, String>(tableName, columns); }
From source file:ltg.heliotablet_android.ClassStudentWizardModel.java
@Override protected PageList onNewRootPageList() { Resources act = mContext.getApplicationContext().getResources(); String bensClassString = act.getString(R.string.ben_class_title); String juliaClassString = act.getString(R.string.julia_class_title); String fifthGrade = act.getString(R.string.class_title_5th); String sixthGrade = act.getString(R.string.class_title_6th); //Ben 5th//from ww w. j a v a 2s . c o m Iterable<String> ben5th = Splitter.on(',').trimResults().omitEmptyStrings() .split(act.getString(R.string.ben_class_5th)); //String[] ben5thArray = Iterables.toArray(ben5th, String.class); //Ben 6th // Iterable<String> ben6th = Splitter.on(',') // .trimResults() // .omitEmptyStrings() // .split(act.getString(R.string.ben_class_6th)); //String[] ben6thArray = Iterables.toArray(ben6th, String.class); // Iterable<String> combinedBenList = Iterables.concat(ben5th, ben6th); // // ArrayList<String> newArrayListBen = Lists.newArrayList(combinedBenList); ArrayList<String> newArrayListBen = Lists.newArrayList(ben5th); Collections.sort(newArrayListBen, Ordering.natural()); String[] SORTEDBEN = newArrayListBen.toArray(new String[newArrayListBen.size()]); // //Julia 5th // Iterable<String> julia5th = Splitter.on(',') // .trimResults() // .omitEmptyStrings() // .split(act.getString(R.string.julia_class_5th)); // // //Julia 6th // Iterable<String> julia6th = Splitter.on(',') // .trimResults() // .omitEmptyStrings() // .split(act.getString(R.string.julia_class_6th)); // // Iterable<String> combinedJuliaList = Iterables.concat(julia5th, julia6th); // // ArrayList<String> newArrayListJulia = Lists.newArrayList(combinedJuliaList); // // Collections.sort(newArrayListJulia, // Ordering.natural()); // // String[] SORTEDJULIA = newArrayListJulia.toArray(new String[newArrayListJulia.size()]); //ben branch Page benPage = new SingleFixedChoicePage(this, act.getString(R.string.choose_your_name_)) .setChoices(SORTEDBEN).setRequired(true); benPage.setRequired(true); // Page juliaPage = new SingleFixedChoicePage(this, act.getString(R.string.choose_your_name_)).setChoices(SORTEDJULIA).setRequired(true); // juliaPage.setRequired(true); return new PageList( new BranchPage(this, act.getString(R.string.pick_your_teacher_)).addBranch(bensClassString, benPage) // .addBranch(juliaClassString, juliaPage) .setRequired(true) ); }
From source file:tds.router.domain.TenancyChain.java
public TenancyChain(String pipeTenancyChain) { List<String> chain = Splitter.on("|").trimResults().splitToList(pipeTenancyChain); this.roleID = chain.get(1); this.name = chain.get(2); this.level = chain.get(3); this.clientID = chain.get(4); this.client = chain.get(5); this.groupOfStatesID = chain.get(6); this.groupOfStates = chain.get(7); this.stateID = chain.get(8); this.state = chain.get(9); this.groupOfDistrictsID = chain.get(10); this.groupOfDistricts = chain.get(11); this.districtID = chain.get(12); this.district = chain.get(13); this.groupOfInstitutionsID = chain.get(14); this.groupOfInstitutions = chain.get(15); this.institutionID = chain.get(16); this.institution = chain.get(17); }
From source file:org.sonar.scanner.issue.tracking.DefaultServerLineHashesLoader.java
@Override public String[] getLineHashes(String fileKey) { String hashesFromWs = loadHashesFromWs(fileKey); return Iterators.toArray(Splitter.on('\n').split(hashesFromWs).iterator(), String.class); }
From source file:brooklyn.event.feed.http.JsonFunctions.java
/** as {@link #walkM(Iterable)} taking a single string consisting of a dot separated path */ public static Function<JsonElement, JsonElement> walk(String elementOrDotSeparatedElements) { return walk(Splitter.on('.').split(elementOrDotSeparatedElements)); }
From source file:org.apache.isis.viewer.wicket.ui.util.CssClassRemover.java
@Override protected String newValue(String currentValue, String valueToRemove) { if (currentValue == null) return ""; Set<String> classes = Sets.newHashSet(Splitter.on(" ").split(currentValue)); classes.remove(valueToRemove);/*from www.ja v a 2 s . c o m*/ return Joiner.on(" ").join(classes); }
From source file:io.soliton.protobuf.plugin.TypeMap.java
/** * @param name// ww w . j a va 2s . co m * @return */ @VisibleForTesting static String createOuterJavaClassname(String name) { if (name.endsWith(".proto")) { name = name.substring(0, name.length() - ".proto".length()); } name = Iterables.getLast(Splitter.on('/').split(name)); name = name.replace('-', '_'); name = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name); return Character.toUpperCase(name.charAt(0)) + name.substring(1); }
From source file:me.lucko.luckperms.sponge.service.model.SubjectReferenceFactory.java
@Deprecated public static SubjectReference deserialize(@NonNull LPPermissionService service, @NonNull String serialisedReference) { List<String> parts = Splitter.on('/').limit(2).splitToList(serialisedReference); return obtain(service, parts.get(0), parts.get(1)); }
From source file:foo.domaintest.http.TempAction.java
/** Serve stashed requests. */ @Override//from ww w. j av a2s . c o m @SuppressWarnings("unchecked") public void run() { String token = Iterables.getLast(Splitter.on('/').split(requestPath), ""); Map<String, Object> params = memcache.load(new Key(STASH, token)); if (params == null) { throw new NotFoundException("No stashed request for this token"); } else { response.setStatus((Integer) params.get("status")).setSleepSeconds((Integer) params.get("sleepSeconds")) .setMimeType((String) params.get("mimeType")) .setCookiesToDelete((List<String>) params.get("cookiesToDelete")) .setCookiesToAdd((Map<String, String>) params.get("cookiesToAdd")) .setHeaders((Map<String, String>) params.get("headers")) .setPayload((String) params.get("payload")).send(); memcache.delete(new Key(STASH, token)); } }