org.apache.commons.text.WordUtils Java Examples
The following examples show how to use
org.apache.commons.text.WordUtils.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PartitionKeyDefinition.java From azure-cosmosdb-java with MIT License | 6 votes |
public PartitionKeyDefinitionVersion getVersion() { if (this.version == null) { Object versionObject = super.getObject(Constants.Properties.PARTITION_KEY_DEFINITION_VERSION, Object.class); if (versionObject == null) { this.version = null; } else { String versionStr = String.valueOf(versionObject); if (StringUtils.isNumeric(versionStr)) { this.version = PartitionKeyDefinitionVersion.valueOf(String.format("V%d", Integer.parseInt(versionStr))); } else { this.version = !Strings.isNullOrEmpty(versionStr) ? PartitionKeyDefinitionVersion.valueOf(WordUtils.capitalize(versionStr)) : null; } } } return this.version; }
Example #2
Source File: MailTemplateHelpers.java From Singularity with Apache License 2.0 | 6 votes |
public List<SingularityMailTaskHistoryUpdate> getJadeTaskHistory( Collection<SingularityTaskHistoryUpdate> taskHistory ) { List<SingularityMailTaskHistoryUpdate> output = Lists.newArrayListWithCapacity( taskHistory.size() ); for (SingularityTaskHistoryUpdate taskUpdate : taskHistory) { output.add( new SingularityMailTaskHistoryUpdate( humanizeTimestamp(taskUpdate.getTimestamp()), WordUtils.capitalize(taskUpdate.getTaskState().getDisplayName()), taskUpdate.getStatusMessage().orElse("") ) ); } return output; }
Example #3
Source File: TextCase.java From citeproc-java with Apache License 2.0 | 6 votes |
/** * Transforms the text of a token * @param t the token * @return the new token with the transformed text */ private Token transform(Token t) { String s = t.getText(); if ("lowercase".equals(textCase)) { s = s.toLowerCase(); } else if ("uppercase".equals(textCase)) { s = s.toUpperCase(); } else if ("capitalize-first".equals(textCase)) { s = StringUtils.capitalize(s); } else if ("capitalize-all".equals(textCase)) { s = WordUtils.capitalize(s); } else if ("title".equals(textCase)) { s = StringHelper.toTitleCase(s); } return new Token.Builder(t) .text(s) .build(); }
Example #4
Source File: TvMazeAction.java From drftpd with GNU General Public License v2.0 | 6 votes |
@Override public String exec(CommandRequest request, InodeHandle inode) { _failed = false; TvMazeVFSData tvmazeData = new TvMazeVFSData((DirectoryHandle) inode); TvMazeInfo tvmazeInfo = tvmazeData.getTvMazeInfoFromCache(); if (tvmazeInfo != null) { StringBuilder sb = new StringBuilder(); sb.append("#########################################").append(")\n"); sb.append("# Title # - ").append(tvmazeInfo.getName()).append("\n"); sb.append("# Genre # - ").append(StringUtils.join(Arrays.toString(tvmazeInfo.getGenres()), ", ")).append("\n"); sb.append("# URL # - ").append(tvmazeInfo.getURL()).append("\n"); sb.append("# Plot #\n").append(WordUtils.wrap(tvmazeInfo.getSummary(), 70)); return sb.toString(); } return "#########################################\nNO TvMaze INFO FOUND FOR: " + inode.getPath(); }
Example #5
Source File: IMDBAction.java From drftpd with GNU General Public License v2.0 | 6 votes |
@Override public String exec(CommandRequest request, InodeHandle inode) { _failed = false; IMDBVFSDataNFO imdbData = new IMDBVFSDataNFO((DirectoryHandle) inode); IMDBInfo imdbInfo = imdbData.getIMDBInfoFromCache(); if (imdbInfo != null) { if (imdbInfo.getMovieFound()) { StringBuilder sb = new StringBuilder(); sb.append("#########################################").append(")\n"); sb.append("# Title # - ").append(imdbInfo.getTitle()).append("\n"); sb.append("# Year # - ").append(imdbInfo.getYear()).append("\n"); sb.append("# Runtime # - ").append(imdbInfo.getRuntime()).append(" min").append("\n"); sb.append("# Language # - ").append(imdbInfo.getLanguage()).append("\n"); sb.append("# Country # - ").append(imdbInfo.getCountry()).append("\n"); sb.append("# Director # - ").append(imdbInfo.getDirector()).append("\n"); sb.append("# Genres # - ").append(imdbInfo.getGenres()).append("\n"); sb.append("# Plot #\n").append(WordUtils.wrap(imdbInfo.getPlot(), 70)); sb.append("# Rating # - "); sb.append(imdbInfo.getRating() != null ? imdbInfo.getRating() / 10 + "." + imdbInfo.getRating() % 10 + "/10" : "-").append("\n"); sb.append("# Votes # - ").append(imdbInfo.getVotes()).append("\n"); sb.append("# URL # - ").append(imdbInfo.getURL()).append("\n"); return sb.toString(); } } return "#########################################\nNO IMDB INFO FOUND FOR: " + inode.getPath(); }
Example #6
Source File: CsdbReleasesSD2IEC.java From petscii-bbs with Mozilla Public License 2.0 | 6 votes |
private void listPosts(String rssUrl) throws IOException, FeedException { cls(); drawLogo(); if (isEmpty(posts)) { waitOn(); posts = getPosts(rssUrl, currentPage, pageSize); waitOff(); } for (Map.Entry<Integer, ReleaseEntry> entry: posts.entrySet()) { int i = entry.getKey(); ReleaseEntry post = entry.getValue(); write(WHITE); print(i + "."); write(GREY3); final int iLen = 37-String.valueOf(i).length(); String title = post.title + (isNotBlank(post.releasedBy) ? " (" + post.releasedBy+")" : EMPTY); String line = WordUtils.wrap(filterPrintable(HtmlUtils.htmlClean(title)), iLen, "\r", true); println(line.replaceAll("\r", "\r " + repeat(" ", 37-iLen))); } newline(); }
Example #7
Source File: CsdbReleases.java From petscii-bbs with Mozilla Public License 2.0 | 6 votes |
private void listPosts(String rssUrl) throws IOException, FeedException { cls(); drawLogo(); if (isEmpty(posts)) { waitOn(); posts = getPosts(rssUrl, currentPage, pageSize); waitOff(); } for (Map.Entry<Integer, ReleaseEntry> entry: posts.entrySet()) { int i = entry.getKey(); ReleaseEntry post = entry.getValue(); write(WHITE); print(i + "."); write(GREY3); final int iLen = 37-String.valueOf(i).length(); String title = post.title + (isNotBlank(post.releasedBy) ? " (" + post.releasedBy+")" : EMPTY); String line = WordUtils.wrap(filterPrintable(HtmlUtils.htmlClean(title)), iLen, "\r", true); println(line.replaceAll("\r", "\r " + repeat(" ", 37-iLen))); } newline(); }
Example #8
Source File: TvMazeAction.java From drftpd with GNU General Public License v2.0 | 6 votes |
@Override public String exec(CommandRequest request, InodeHandle inode) { _failed = false; TvMazeVFSData tvmazeData = new TvMazeVFSData((DirectoryHandle) inode); TvMazeInfo tvmazeInfo = tvmazeData.getTvMazeInfoFromCache(); if (tvmazeInfo != null) { StringBuilder sb = new StringBuilder(); sb.append("#########################################").append(")\n"); sb.append("# Title # - ").append(tvmazeInfo.getName()).append("\n"); sb.append("# Genre # - ").append(StringUtils.join(Arrays.toString(tvmazeInfo.getGenres()), ", ")).append("\n"); sb.append("# URL # - ").append(tvmazeInfo.getURL()).append("\n"); sb.append("# Plot #\n").append(WordUtils.wrap(tvmazeInfo.getSummary(), 70)); return sb.toString(); } return "#########################################\nNO TvMaze INFO FOUND FOR: " + inode.getPath(); }
Example #9
Source File: IMDBAction.java From drftpd with GNU General Public License v2.0 | 6 votes |
@Override public String exec(CommandRequest request, InodeHandle inode) { _failed = false; IMDBVFSDataNFO imdbData = new IMDBVFSDataNFO((DirectoryHandle) inode); IMDBInfo imdbInfo = imdbData.getIMDBInfoFromCache(); if (imdbInfo != null) { if (imdbInfo.getMovieFound()) { StringBuilder sb = new StringBuilder(); sb.append("#########################################").append(")\n"); sb.append("# Title # - ").append(imdbInfo.getTitle()).append("\n"); sb.append("# Year # - ").append(imdbInfo.getYear()).append("\n"); sb.append("# Runtime # - ").append(imdbInfo.getRuntime()).append(" min").append("\n"); sb.append("# Language # - ").append(imdbInfo.getLanguage()).append("\n"); sb.append("# Country # - ").append(imdbInfo.getCountry()).append("\n"); sb.append("# Director # - ").append(imdbInfo.getDirector()).append("\n"); sb.append("# Genres # - ").append(imdbInfo.getGenres()).append("\n"); sb.append("# Plot #\n").append(WordUtils.wrap(imdbInfo.getPlot(), 70)); sb.append("# Rating # - "); sb.append(imdbInfo.getRating() != null ? imdbInfo.getRating() / 10 + "." + imdbInfo.getRating() % 10 + "/10" : "-").append("\n"); sb.append("# Votes # - ").append(imdbInfo.getVotes()).append("\n"); sb.append("# URL # - ").append(imdbInfo.getURL()).append("\n"); return sb.toString(); } } return "#########################################\nNO IMDB INFO FOUND FOR: " + inode.getPath(); }
Example #10
Source File: WordpressProxy.java From petscii-bbs with Mozilla Public License 2.0 | 6 votes |
protected void listPosts() throws Exception { cls(); drawLogo(); if (isEmpty(posts)) { waitOn(); posts = getPosts(currentPage, pageSize); waitOff(); } for (Map.Entry<Integer, Post> entry: posts.entrySet()) { int i = entry.getKey(); Post post = entry.getValue(); write(WHITE); print(i + "."); write(GREY3); final int iLen = 37-String.valueOf(i).length(); String line = WordUtils.wrap(filterPrintable(HtmlUtils.htmlClean(post.title)), iLen, "\r", true); println(line.replaceAll("\r", "\r " + repeat(" ", 37-iLen))); } newline(); }
Example #11
Source File: GoogleBloggerProxy.java From petscii-bbs with Mozilla Public License 2.0 | 6 votes |
protected void listPosts() throws IOException { cls(); drawLogo(); if (posts == null) { waitOn(); posts = getPosts(); waitOff(); } for (Map.Entry<Integer, Post> entry: posts.entrySet()) { int i = entry.getKey(); Post post = entry.getValue(); write(WHITE); print(i + "."); write(GREY3); final int iLen = 37-String.valueOf(i).length(); String line = WordUtils.wrap(filterPrintable(HtmlUtils.htmlClean(post.getTitle())), iLen, "\r", true); println(line.replaceAll("\r", "\r " + repeat(" ", 37-iLen))); } newline(); }
Example #12
Source File: UserLogon.java From petscii-bbs with Mozilla Public License 2.0 | 6 votes |
public void displayMessage(Message m) throws Exception { DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); cls(); write(LOGO_BYTES); write(GREY3); println("From: "+ m.userFrom); println("To: "+ m.userTo); println("Date: "+ df.format(m.dateTime)); println("Subj: "+ m.subject); println(StringUtils.repeat(chr(163),39)); String[] lines = defaultString(m.message).split("\n"); for (String line: lines) println(WordUtils.wrap(line, 39, "\r", true )); markAsRead(m); newline(); print("press "); write(WHITE); print("'R'"); write(GREY3); print(" to REPLY, any key to go back."); flush(); resetInput(); int ch = readKey(); if (ch == 'r' || ch == 'R') { newline(); newline(); sendMessageGui(m.userFrom, m.subject); } }
Example #13
Source File: SymptomTextExporter.java From synthea with Apache License 2.0 | 6 votes |
/** * Add the basic information to the record. * * @param textRecord * Text format record, as a list of lines * @param person * The person to export * @param endTime * Time the simulation ended (to calculate age/deceased status) */ private static void basicInfo(List<String> textRecord, Person person, long endTime) { String name = (String) person.attributes.get(Person.NAME); textRecord.add(name); textRecord.add(name.replaceAll("[A-Za-z0-9 ]", "=")); // "underline" the characters in the name String race = (String) person.attributes.get(Person.RACE); String ethnicity = (String) person.attributes.get(Person.ETHNICITY); String displayEthnicity; if (ethnicity.equals("hispanic")) { displayEthnicity = "Hispanic"; } else { displayEthnicity = "Non-Hispanic"; } textRecord.add("Race: " + WordUtils.capitalize(race)); textRecord.add("Ethnicity: " + displayEthnicity); textRecord.add("Gender: " + person.attributes.get(Person.GENDER)); String birthdate = dateFromTimestamp((long) person.attributes.get(Person.BIRTHDATE)); textRecord.add("Birth Date: " + birthdate); }
Example #14
Source File: ConflictResolutionPolicy.java From azure-cosmosdb-java with MIT License | 6 votes |
/** * Gets the {@link ConflictResolutionMode} in the Azure Cosmos DB service. * By default it is {@link ConflictResolutionMode#LastWriterWins}. * * @return ConflictResolutionMode. */ public ConflictResolutionMode getConflictResolutionMode() { String strValue = super.getString(Constants.Properties.MODE); if (!Strings.isNullOrEmpty(strValue)) { try { return ConflictResolutionMode.valueOf(WordUtils.capitalize(super.getString(Constants.Properties.MODE))); } catch (IllegalArgumentException e) { this.getLogger().warn("Invalid ConflictResolutionMode value {}.", super.getString(Constants.Properties.MODE)); return ConflictResolutionMode.Invalid; } } return ConflictResolutionMode.Invalid; }
Example #15
Source File: TxtTablePrinter.java From openemm with GNU Affero General Public License v3.0 | 6 votes |
private StringBuilder getRowsBlock(List<String> order, Map<String, ColumnDefinition> columnDefinitions, Row row) { List<String[]> textBlocks = new ArrayList<>(); Map<String, String> columns = row.getColumns(); int maxHeight = 0; for (String columnKey : order) { String columnText = columns.get(columnKey); String[] blockLines; if (StringUtils.isNotBlank(columnText)) { int columnWidth = columnDefinitions.get(columnKey).getWidth(); String columnBlock = WordUtils.wrap(columnText, columnWidth, lineBreaker, true); blockLines = columnBlock.split("(" + lineBreaker + "|\r|\n)"); } else { blockLines = new String[]{emptyValue}; } textBlocks.add(blockLines); maxHeight = maxHeight < blockLines.length ? blockLines.length : maxHeight; } return appendTextBlocks(order, columnDefinitions, textBlocks, maxHeight); }
Example #16
Source File: AnsiParagraphBuilder.java From halyard with Apache License 2.0 | 5 votes |
@Override public String toString() { StringBuilder bodyBuilder = new StringBuilder(); for (AnsiSnippet snippet : snippets) { bodyBuilder.append(snippet.toString()); } String body = bodyBuilder.toString(); if (maxLineWidth < 0) { return body; } String[] lines = body.split("\n"); StringBuilder lineBuilder = new StringBuilder(); for (int i = 0; i < lines.length; i++) { String line = lines[i]; line = WordUtils.wrap(line, maxLineWidth, "\n" + getIndent(), false); if (indentFirstLine) { line = getIndent() + line; } lineBuilder.append(line); if (i != lines.length - 1) { lineBuilder.append("\n"); } } return lineBuilder.toString(); }
Example #17
Source File: TextExporter.java From synthea with Apache License 2.0 | 5 votes |
/** * Add the basic information to the record. * * @param textRecord * Text format record, as a list of lines * @param person * The person to export * @param endTime * Time the simulation ended (to calculate age/deceased status) */ private static void basicInfo(List<String> textRecord, Person person, long endTime) { String name = (String) person.attributes.get(Person.NAME); textRecord.add(name); textRecord.add(name.replaceAll("[A-Za-z0-9 ]", "=")); // "underline" the characters in the name String race = (String) person.attributes.get(Person.RACE); String ethnicity = (String) person.attributes.get(Person.ETHNICITY); String displayEthnicity; if (ethnicity.equals("hispanic")) { displayEthnicity = "Hispanic"; } else { displayEthnicity = "Non-Hispanic"; } textRecord.add("Race: " + WordUtils.capitalize(race)); textRecord.add("Ethnicity: " + displayEthnicity); textRecord.add("Gender: " + person.attributes.get(Person.GENDER)); String age = person.alive(endTime) ? Integer.toString(person.ageInYears(endTime)) : "DECEASED"; textRecord.add("Age: " + age); String birthdate = dateFromTimestamp((long) person.attributes.get(Person.BIRTHDATE)); textRecord.add("Birth Date: " + birthdate); textRecord.add("Marital Status: " + person.attributes.getOrDefault(Person.MARITAL_STATUS, "S")); if (person.record.provider != null) { textRecord.add("Provider: " + person.record.provider.name); textRecord.add("Provider Address: " + person.record.provider.address + ", " + person.record.provider.city + ", " + person.record.provider.state); } }
Example #18
Source File: PathsDocument.java From swagger2markup with Apache License 2.0 | 5 votes |
/** * Builds the paths section. Groups the paths either as-is, by tags or using regex. * * @param paths the Swagger paths */ private void buildsPathsSection(MarkupDocBuilder markupDocBuilder, Map<String, Path> paths) { List<SwaggerPathOperation> pathOperations = PathUtils.toPathOperationsList(paths, getHostname(), getBasePath(), config.getOperationOrdering()); if (CollectionUtils.isNotEmpty(pathOperations)) { if (config.getPathsGroupedBy() == GroupBy.AS_IS) { pathOperations.forEach(operation -> buildOperation(markupDocBuilder, operation, config)); } else if (config.getPathsGroupedBy() == GroupBy.TAGS) { Validate.notEmpty(context.getSchema().getTags(), "Tags must not be empty, when operations are grouped by tags"); // Group operations by tag Multimap<String, SwaggerPathOperation> operationsGroupedByTag = TagUtils.groupOperationsByTag(pathOperations, config.getOperationOrdering()); Map<String, Tag> tagsMap = TagUtils.toSortedMap(context.getSchema().getTags(), config.getTagOrdering()); tagsMap.forEach((String tagName, Tag tag) -> { markupDocBuilder.sectionTitleWithAnchorLevel2(WordUtils.capitalize(tagName), tagName + "_resource"); String description = tag.getDescription(); if (StringUtils.isNotBlank(description)) { markupDocBuilder.paragraph(description); } operationsGroupedByTag.get(tagName).forEach(operation -> buildOperation(markupDocBuilder, operation, config)); }); } else if (config.getPathsGroupedBy() == GroupBy.REGEX) { Validate.notNull(config.getHeaderPattern(), "Header regex pattern must not be empty when operations are grouped using regex"); Pattern headerPattern = config.getHeaderPattern(); Multimap<String, SwaggerPathOperation> operationsGroupedByRegex = RegexUtils.groupOperationsByRegex(pathOperations, headerPattern); Set<String> keys = operationsGroupedByRegex.keySet(); String[] sortedHeaders = RegexUtils.toSortedArray(keys); for (String header : sortedHeaders) { markupDocBuilder.sectionTitleWithAnchorLevel2(WordUtils.capitalize(header), header + "_resource"); operationsGroupedByRegex.get(header).forEach(operation -> buildOperation(markupDocBuilder, operation, config)); } } } }
Example #19
Source File: Game.java From JavaGame with GNU Affero General Public License v3.0 | 5 votes |
private void status(Graphics g, boolean TerminalMode, boolean TerminalQuit) { if (TerminalMode) { // If running in developer mode g.setColor(Color.CYAN); g.drawString("JavaGame Stats", 0, 10); // Display "JavaGame Stats" in cyan at the bottom left of the screen g.drawString("FPS/TPS: " + fps + "/" + tps, 0, 25); // Display the FPS and TPS in cyan directly above "JavaGame Stats" if ((player.getNumSteps() & 15) == 15) { steps += 1; } g.drawString("Foot Steps: " + steps, 0, 40); // Display the number of "Foot Steps" (in cyan, above the previous) g.drawString( "NPC: " + WordUtils.capitalize(String.valueOf(isNpc())), 0, // Displays whether the NPC is on the level (in cyan, above the previous) 55); g.drawString("Mouse: " + getMouse().getX() + "x |" // Displays the position of the cursor (in cyan, above the previous) + getMouse().getY() + "y", 0, 70); if (getMouse().getButton() != -1) // If a mouse button is pressed g.drawString("Button: " + getMouse().getButton(), 0, 85); // Displays the mouse button that is pressed (in cyan, above the previous) g.setColor(Color.CYAN); g.fillRect(getMouse().getX() - 12, getMouse().getY() - 12, 24, 24); } // If the game is shutting off if (!TerminalQuit) { return; } g.setColor(Color.BLACK); g.fillRect(0, 0, getWidth(), getHeight()); // Make the screen fully black g.setColor(Color.RED); g.drawString("Shutting down the Game", (getWidth() / 2) - 70, // Display "Shutting down the Game" in red in the middle of the screen (getHeight() / 2) - 8); g.dispose(); // Free up memory for graphics }
Example #20
Source File: ApiClient.java From razorpay-java with MIT License | 5 votes |
private Class getClass(String entity) { try { String entityClass = "com.razorpay." + WordUtils.capitalize(entity, '_').replaceAll("_", ""); return Class.forName(entityClass); } catch (ClassNotFoundException e) { return null; } }
Example #21
Source File: WordUtilsUnitTest.java From tutorials with MIT License | 5 votes |
@Test public void whenCapitalized_thenCorrect() { String toBeCapitalized = "to be capitalized!"; String result = WordUtils.capitalize(toBeCapitalized); Assert.assertEquals("To Be Capitalized!", result); }
Example #22
Source File: SpatialIndex.java From azure-cosmosdb-java with MIT License | 5 votes |
/** * Gets data type. * * @return the data type. */ public DataType getDataType() { DataType result = null; try { result = DataType.valueOf(WordUtils.capitalize(super.getString(Constants.Properties.DATA_TYPE))); } catch (IllegalArgumentException e) { this.getLogger().warn("Invalid index dataType value {}.", super.getString(Constants.Properties.DATA_TYPE)); } return result; }
Example #23
Source File: Configs.java From azure-cosmosdb-java with MIT License | 5 votes |
public Protocol getProtocol() { String protocol = getJVMConfigAsString(PROTOCOL, StringUtils.defaultString( StringUtils.defaultString( System.getProperty("azure.cosmos.directModeProtocol"), System.getenv("DIRECT_MODE_PROTOCOL")), DEFAULT_PROTOCOL.name())); try { return Protocol.valueOf(WordUtils.capitalize(protocol.toLowerCase())); } catch (Exception e) { logger.error("Parsing protocol {} failed. Using the default {}.", protocol, DEFAULT_PROTOCOL, e); return DEFAULT_PROTOCOL; } }
Example #24
Source File: EnvironmentConfigurer.java From vividus with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") public void init() throws IOException { Collection<DynamicEnvironmentConfigurationProperty> values = new PropertyMappedDataProvider<>(propertyMapper, DYNAMIC_PROPERTY_PREFIX, DynamicEnvironmentConfigurationProperty.class).getData().values(); for (DynamicEnvironmentConfigurationProperty property: values) { Pattern propertyRegex = property.getPropertyRegex(); Map<String, String> matchedProperties = new TreeMap<>(propertyParser.getPropertiesByRegex(propertyRegex)); matchedProperties.forEach((key, value) -> { Matcher matcher = propertyRegex.matcher(key); matcher.matches(); String descriptionPattern = property.getDescriptionPattern(); addProperty(property.getCategory(), matcher.groupCount() > 0 ? String.format(descriptionPattern, matcher.group(1)) : descriptionPattern, value); }); } propertyMapper.readValues(PROPERTY_PREFIX, Map.class).forEach((category, properties) -> { if (!DYNAMIC.equals(category)) { PropertyCategory propertyCategory = PropertyCategory.valueOf(category.toUpperCase()); Map<String, String> currentProperties = ENVIRONMENT_CONFIGURATION.get(propertyCategory); properties.forEach((k, v) -> currentProperties .put(WordUtils.capitalize(((String) k).replace('-', ' ')), (String) v)); } }); }
Example #25
Source File: ConsistencyPolicy.java From azure-cosmosdb-java with MIT License | 5 votes |
/** * Get the name of the resource. * * @return the default consistency level. */ public ConsistencyLevel getDefaultConsistencyLevel() { ConsistencyLevel result = ConsistencyPolicy.DEFAULT_DEFAULT_CONSISTENCY_LEVEL; try { result = ConsistencyLevel.valueOf( WordUtils.capitalize(super.getString(Constants.Properties.DEFAULT_CONSISTENCY_LEVEL))); } catch (IllegalArgumentException e) { // ignore the exception and return the default this.getLogger().warn("Unknown consistency level {}, value ignored.", super.getString(Constants.Properties.DEFAULT_CONSISTENCY_LEVEL)); } return result; }
Example #26
Source File: CompositePath.java From azure-cosmosdb-java with MIT License | 5 votes |
/** * Gets the sort order for the composite path. * * For example if you want to run the query "SELECT * FROM c ORDER BY c.age asc, c.height desc", * then you need to make the order for "/age" "ascending" and the order for "/height" "descending". * * @return the sort order. */ public CompositePathSortOrder getOrder() { String strValue = super.getString(Constants.Properties.ORDER); if (!StringUtils.isEmpty(strValue)) { try { return CompositePathSortOrder.valueOf(WordUtils.capitalize(super.getString(Constants.Properties.ORDER))); } catch (IllegalArgumentException e) { this.getLogger().warn("Invalid indexingMode value {}.", super.getString(Constants.Properties.ORDER)); return CompositePathSortOrder.Ascending; } } return CompositePathSortOrder.Ascending; }
Example #27
Source File: Index.java From azure-cosmosdb-java with MIT License | 5 votes |
/** * Gets index kind. * * @return the index kind. */ public IndexKind getKind() { IndexKind result = null; try { result = IndexKind.valueOf(WordUtils.capitalize(super.getString(Constants.Properties.INDEX_KIND))); } catch (IllegalArgumentException e) { this.getLogger().warn("Invalid index kind value %s.", super.getString(Constants.Properties.INDEX_KIND)); } return result; }
Example #28
Source File: HashIndex.java From azure-cosmosdb-java with MIT License | 5 votes |
/** * Gets data type. * * @return the data type. */ public DataType getDataType() { DataType result = null; try { result = DataType.valueOf(WordUtils.capitalize(super.getString(Constants.Properties.DATA_TYPE))); } catch (IllegalArgumentException e) { // Ignore exception and let the caller handle null value. this.getLogger().warn("Invalid index dataType value {}.", super.getString(Constants.Properties.DATA_TYPE)); } return result; }
Example #29
Source File: PTextWord.java From jphp with Apache License 2.0 | 5 votes |
@Signature public PTextWord wrap(Environment env, int lineLength, @Optional("null") Memory newLineString, @Optional("false") boolean wrapLongWords) { return new PTextWord(env, WordUtils.wrap( text, lineLength, newLineString.isNull() ? null : newLineString.toString(), wrapLongWords )); }
Example #30
Source File: ClojureBuild.java From clojurephant with Apache License 2.0 | 5 votes |
String getTaskName(String task) { if ("main".equals(name)) { return String.format("%sClojure", task); } else { return String.format("%s%sClojure", task, WordUtils.capitalize(name)); } }