@Override public String toErrorString() { return "\n" + Joiner.on("\n").join(errors); }
/** * Removes extra spaces and empty values in a CSV String * @param csv The CSV string to be sanitized * @return The sanitized CSV string */ public static String sanitizeCSV(String csv) { // tokenize String[] tokens = csv.split(","); ArrayList<String> sanitizedTokens = new ArrayList<String>(tokens.length); // check for empties for (String s : tokens) { String trimmedToken = s.trim(); if (trimmedToken.length() != 0) { sanitizedTokens.add(trimmedToken); } } String result = ""; if (sanitizedTokens.size() != 0) { result = Joiner.on(",").join(sanitizedTokens); } return result; }
public String toString() { return Joiner.on(".").join(getSchemaPath()); }
@Override public String getSQLKeywords() throws SQLException { checkOpen(); if (!getServerMetaSupported()) { return super.getSQLKeywords(); } return Joiner.on(",").join(getServerMeta().getSqlKeywordsList()); }
@Override public String getSystemFunctions() throws SQLException { checkOpen(); if (!getServerMetaSupported()) { return super.getSystemFunctions(); } return Joiner.on(",").join(getServerMeta().getSystemFunctionsList()); }
@Override public String getTimeDateFunctions() throws SQLException { checkOpen(); if (!getServerMetaSupported()) { return super.getTimeDateFunctions(); } return Joiner.on(",").join(getServerMeta().getDateTimeFunctionsList()); }
@Override public String getNumericFunctions() throws SQLException { checkOpen(); if (!getServerMetaSupported()) { return super.getNumericFunctions(); } return Joiner.on(",").join(getServerMeta().getNumericFunctionsList()); }
@Override public String getStringFunctions() throws SQLException { checkOpen(); if (!getServerMetaSupported()) { return super.getStringFunctions(); } return Joiner.on(",").join(getServerMeta().getStringFunctionsList()); }
/** * Returns a string containing the string representation of each of {@code parts}, using the * previously configured separator between each. */ public final String join(Iterable<?> parts) { return join(parts.iterator()); }
/** * Returns a string containing the string representation of each of {@code parts}, using the * previously configured separator between each. */ public final String join(Object[] parts) { return join(Arrays.asList(parts)); }
private static String getDigest(int minWidth, int maxWidth, Map<DrillbitEndpoint, EndpointAffinity> affinityMap) { StringBuilder sb = new StringBuilder(); sb.append(String.format("[minWidth = %d, maxWidth=%d, epAff=[", minWidth, maxWidth)); sb.append(Joiner.on(",").join(affinityMap.values())); sb.append("]]"); return sb.toString(); }
@Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append(function); builder.append("("); builder.append(Joiner.on(",").join(args)); builder.append(")"); return builder.toString(); } }
/** * Returns a string containing the string representation of each argument, using the previously * configured separator between each. */ public final String join(@Nullable Object first, @Nullable Object second, Object... rest) { return join(iterable(first, second, rest)); }
/** Utility method to get the schema path for given schema instance. */ public static String getSchemaPath(SchemaPlus schema) { return SCHEMA_PATH_JOINER.join(getSchemaPathAsList(schema)); }
TypeVariable<?> captureAsTypeVariable(Type[] upperBounds) { String name = "capture#" + id.incrementAndGet() + "-of ? extends " + Joiner.on('&').join(upperBounds); return Types.newArtificialTypeVariable(WildcardCapturer.class, name, upperBounds); }
/** * Returns the ancestor of the current domain at the given number of levels "higher" (rightward) * in the subdomain list. The number of levels must be non-negative, and less than {@code N-1}, * where {@code N} is the number of parts in the domain. * * <p>TODO: Reasonable candidate for addition to public API. */ private InternetDomainName ancestor(int levels) { return from(DOT_JOINER.join(parts.subList(levels, parts.size()))); }
@Override public String getSystemFunctions() throws SQLException { checkOpen(); if (!getServerMetaSupported()) { return super.getSystemFunctions(); } return Joiner.on(",").join(getServerMeta().getSystemFunctionsList()); }
@Override public String getTimeDateFunctions() throws SQLException { checkOpen(); if (!getServerMetaSupported()) { return super.getTimeDateFunctions(); } return Joiner.on(",").join(getServerMeta().getDateTimeFunctionsList()); }
@Override public String getNumericFunctions() throws SQLException { checkOpen(); if (!getServerMetaSupported()) { return super.getNumericFunctions(); } return Joiner.on(",").join(getServerMeta().getNumericFunctionsList()); }
@Override public String getStringFunctions() throws SQLException { checkOpen(); if (!getServerMetaSupported()) { return super.getStringFunctions(); } return Joiner.on(",").join(getServerMeta().getStringFunctionsList()); }