private String extractId(Class serviceInterface, String id) { return InternalUtils.isBlank(id) ? serviceInterface.getSimpleName() : id; }
/** * Splits a value around commas. Whitespace around the commas is removed, as is leading and trailing whitespace. * * @since 5.1.0.0 */ public static String[] splitAtCommas(String value) { if (InternalUtils.isBlank(value)) return InternalConstants.EMPTY_STRING_ARRAY; return COMMA_PATTERN.split(value.trim()); }
private void writeElement(Writer writer, String elementSpec, String text) throws IOException { String elementName = elementSpec; int idxOfSpace = elementSpec.indexOf(' '); if (idxOfSpace != -1) { elementName = elementSpec.substring(0, idxOfSpace); } writer.write(String.format("<%s>%s</%s>", elementSpec, InternalUtils.isBlank(text) ? " " : text, elementName)); }
private void writeElement(Writer writer, String elementSpec, String text) throws IOException { String elementName = elementSpec; int idxOfSpace = elementSpec.indexOf(' '); if (idxOfSpace != -1) { elementName = elementSpec.substring(0, idxOfSpace); } writer.write(String.format("<%s>%s</%s>", elementSpec, InternalUtils.isBlank(text) ? " " : text, elementName)); }
public Object toValue(String clientValue) { if (blankToNull && InternalUtils.isBlank(clientValue)) { return null; } return typeCoercer.coerce(clientValue, type); } };
private void decodeParametersIntoRequest(String queryString) { if (InternalUtils.isBlank(queryString)) return; for (String term : queryString.split("&")) { int eqx = term.indexOf("="); String key = term.substring(0, eqx).trim(); String value = term.substring(eqx + 1).trim(); request.loadParameter(key, value); } }
public E toValue(String clientValue) { if (InternalUtils.isBlank(clientValue)) return null; return typeCoercer.coerce(clientValue, enumType); }
private String extractNonBlank(Element element, String attributeName) { String result = element.getAttribute(attributeName); if (InternalUtils.isBlank(result)) throw new RuntimeException(String.format("The %s attribute of the <%s> element was blank or missing.", attributeName, element.getName())); return result; }
private String getRequiredIdAttribute() { String id = getSingleParameter("id"); if (InternalUtils.isBlank(id)) throw new RuntimeException(String.format("The <%s> element must have an id attribute.", tokenStream.getLocalName())); return id; }
private void convertTextBufferToTokens(TemplateParserState state) { String text = textBuffer.toString(); textBuffer.setLength(0); if (state.isCompressWhitespace()) { text = compressWhitespaceInText(text); if (InternalUtils.isBlank(text)) return; } addTokensForText(text); }
public void validate(Field field, Void constraintValue, MessageFormatter formatter, Object value) throws ValidationException { if (value == null || InternalUtils.isEmptyCollection(value) || InternalUtils.isBlank(value.toString())) throw new ValidationException(buildMessage(formatter, field)); }
public Asset getAsset(Asset original) { if(javaScriptFilesConfiguration.containsKey(original.getResource().getFile())) { String assetPath = javaScriptFilesConfiguration.get(original.getResource().getFile()); return InternalUtils.isBlank(assetPath) ? null : this.as.getExpandedAsset(assetPath); } return original; } }
private boolean hasSlidesClass(Element element) { return InternalUtils.isBlank(element.getAttribute("class")) || (InternalUtils.isNonBlank(element.getAttribute("class")) && !element.getAttribute("class").contains("slides")); } });
public EventContext decodePath(String path) { if (InternalUtils.isBlank(path)) return EMPTY; String[] split = TapestryInternalUtils.splitPath(path); for (int i = 0; i < split.length; i++) { split[i] = urlEncoder.decode(split[i]); } return new URLEventContext(valueEncoder, split); } }
private void processSubmission(String controlName) { String encoded = request.getParameter(controlName); String toDecode = InternalUtils.isBlank(encoded) ? nulls.replaceFromClient() : encoded; Object decoded = toDecode == null ? null : encoder.toValue(toDecode); value = decoded; }
public String getClientId() { if(InternalUtils.isBlank(clientId)) clientId = (InternalUtils.isNonBlank(resources.getInformalParameter("id", String.class))) ? resources.getInformalParameter("id", String.class) : javaScriptSupport.allocateClientId(resources); return clientId; }
public String getClientId() { if (InternalUtils.isBlank(clientId)) clientId = (InternalUtils.isNonBlank(resources.getInformalParameter("id", String.class))) ? resources .getInformalParameter("id", String.class) : javaScriptSupport.allocateClientId(resources); return clientId; }
void afterRender(MarkupWriter writer) { // If the Label element has a body that renders some non-blank output, that takes precedence // over the label string provided by the field. boolean bodyIsBlank = InternalUtils.isBlank(labelElement.getChildMarkup()); if (bodyIsBlank) writer.write(field.getLabel()); writer.end(); // label decorator.afterLabel(field); } }
private void replaceFieldWithMixin(MutableComponentModel model, PlasticField field) { Mixin annotation = field.getAnnotation(Mixin.class); field.claim(annotation); String mixinType = annotation.value(); String[] order = annotation.order(); String fieldType = field.getTypeName(); String mixinClassName = InternalUtils.isBlank(mixinType) ? fieldType : resolver .resolveMixinTypeToClassName(mixinType); model.addMixinClassName(mixinClassName, order); replaceFieldAccessWithMixin(field, mixinClassName); }
private void addInjectedPage(PlasticField field) { InjectPage annotation = field.getAnnotation(InjectPage.class); field.claim(annotation); String pageName = annotation.value(); String fieldName = field.getName(); String injectedPageName = InternalUtils.isBlank(pageName) ? resolver .resolvePageClassNameToPageName(field.getTypeName()) : pageName; field.setConduit(new InjectedPageConduit(field.getPlasticClass().getClassName(), fieldName, injectedPageName)); } }