/** * Converts a string to upper case, where the string may be null. * * @param aString the string to convert. * @return the string converted to upper case, or null if the supplied string was null. */ public static String upperCase(final String aString) { if (!empty(aString)) { return aString.toUpperCase(); } return aString; }
/** * @param url URL to a resource */ public ApplicationResource(final String url) { if (Util.empty(url)) { throw new IllegalArgumentException("A URL must be provided."); } this.resourceId = "url:" + url; this.url = url; this.resource = null; }
/** * Remove a value from the HTML class name list. * @param className the value to remove */ protected void removeHtmlClass(final String className) { if (this.htmlClasses != null && !Util.empty(className)) { this.htmlClasses.remove(className); } }
/** * @param text The HTML class name text to set. */ protected void addHtmlClass(final String text) { if (!Util.empty(text)) { if (this.htmlClasses == null) { this.htmlClasses = new HashSet<>(); } this.htmlClasses.add(text); } }
/** * @param text the output text to sanitize * @return the sanitized text */ public static String sanitizeOutputText(final String text) { if (Util.empty(text)) { return text; } return sanitize(text, true); }
/** * @param text the input text to sanitize * @return the sanitized text */ public static String sanitizeInputText(final String text) { if (Util.empty(text)) { return text; } return sanitize(text); }
/** * Given an interface, determine if an implementation of that interface is available to this factory, see * newInstance(.) method. * * @param interfaz the interface to check for. * @return true if an implementation of the interface is available to this factory. */ public static boolean implementationExists(final Class<?> interfaz) { return !Util.empty(ConfigurationProperties.getFactoryImplementation(interfaz.getName())); } }
/** * {@inheritDoc} */ @Override public String getValue() { Object data = getData(); if (data == null) { return null; } // An empty string is treated as null return Util.empty(data.toString()) ? null : data.toString(); }
/** * @return true if the field is in a read-only state. */ public boolean isReadOnly() { return !Util.empty(getAttribute("data-wc-component")); }
/** * @return true if users are to be redirected when a step error occurs */ public static boolean isErrorRedirect() { return !Util.empty(getErrorUrl()); }
/** * {@inheritDoc} */ @Override public String getValue() { Object data = getData(); if (data == null) { return null; } // An empty string is treated as null return Util.empty(data.toString()) ? null : data.toString(); }
/** * {@inheritDoc} */ @Override public String getValue() { Object data = getData(); if (data == null) { return null; } // An empty string is treated as null return Util.empty(data.toString()) ? null : data.toString(); }
/** * Remove bad characters in XML. * * @param input The String to escape. * @return the clean string */ private static String removeCorruptCharacters(final String input) { if (Util.empty(input)) { return input; } return ESCAPE_BAD_XML10.translate(input); }
/** * {@inheritDoc} */ @Override public String getValue() { Object data = getData(); if (data == null) { return null; } // An empty string is treated as null return Util.empty(data.toString()) ? null : data.toString(); }
/** * @return {@code true} if the current {@code autocomplete} setting is "off" */ default boolean isAutocompleteOff() { String autocomplete = getAutocomplete(); if (Util.empty(autocomplete)) { return false; } return AutocompleteUtil.getOff().equalsIgnoreCase(autocomplete); } }
@Override public Object getBean(final BeanProviderBound beanProviderBound) { String result = (String) Cache.getCache().get(DATA_KEY); if (!Util.empty(result)) { return result; } else if (result == null) { return "Loading..."; } return ""; } });
@Override public void execute(final ActionEvent event) { String txt = txtAdd.getText(); if (!Util.empty(txt)) { // NOTE: one would NOT usually unencode content from a user input: this is VERY dangerous. messageBox.addMessage(false, txt.trim()); applySettings(); } } });
/** * Set the value of the {@code autocomplete} attribute for the current field. * @param autocompleteValue the value to set as a (optionally space delimited list of) String value(s). */ protected void setAutocomplete(final String autocompleteValue) { final String newValue = Util.empty(autocompleteValue) ? null : autocompleteValue; if (!Util.equals(newValue, getAutocomplete())) { getOrCreateComponentModel().autocomplete = newValue; } }
@Override public void execute(final ActionEvent event) { String fileText; if (Util.empty(fileWidget.getFileName())) { fileText = "nothing uploaded"; } else { fileText = new String(fileWidget.getFile().getBytes()); } console.setText(fileText); } });
@Override public void executeOnValid(final ActionEvent event) { if (!Util.empty(selectOther.getText())) { ExampleData example = menuPanel.getClosestMatch(selectOther.getText()); if (example != null) { selectExample(example); } } } });