org.apache.commons.text.CaseUtils Java Examples

The following examples show how to use org.apache.commons.text.CaseUtils. 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: DialogUtils.java    From aem-component-generator with Apache License 2.0 6 votes vote down vote up
/**
 * Creates the tab structure.
 *
 * @param document The {@link Document} object
 * @param tab the tab
 * @param node The {@link Node} object
 * @return the node {@link Node} object
 */
private static Node createTabStructure(Document document, Tab tab, Node node) {
    Element tabElement = createNode(document, tab.getId(), Constants.RESOURCE_TYPE_CONTAINER);
    String label = tab.getLabel();
    if (StringUtils.isBlank(label)) {
        label = CaseUtils.toCamelCase(tab.getId(), true);
    }
    tabElement.setAttribute(Constants.PROPERTY_JCR_TITLE, label);
    Element columnElement = createNode(document, "column", Constants.RESOURCE_TYPE_CONTAINER);
    
    Element layoutElement = document.createElement("layout");
    layoutElement.setAttribute(Constants.JCR_PRIMARY_TYPE, Constants.NT_UNSTRUCTURED);
    layoutElement.setAttribute(Constants.PROPERTY_SLING_RESOURCETYPE, Constants.RESOURCE_TYPE_CORAL_FIXEDCOLUMNS);

    tabElement.appendChild(layoutElement);
    
    return node.appendChild(tabElement).appendChild(createUnStructuredNode(document, "items"))
            .appendChild(columnElement).appendChild(createUnStructuredNode(document, "items"));
}
 
Example #2
Source File: InterfaceBuilder.java    From aem-component-generator with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the return type of the getter method based on what type of property it is referring to.
 *
 * @param property the property for which the return type is calculated.
 * @return the type being returned by the getter
 */
private JType getGetterMethodReturnType(final Property property) {
    String fieldType = getFieldType(property);
    if (property.getType().equalsIgnoreCase("multifield")) {
        if (property.getItems().size() == 1) {
            return codeModel.ref(fieldType).narrow(codeModel.ref(getFieldType(property.getItems().get(0))));
        } else {
            String narrowedClassName = StringUtils.defaultString(property.getModelName(),
                    CaseUtils.toCamelCase(property.getField(), true) + "Multifield");
            return codeModel.ref(fieldType).narrow(codeModel.ref(narrowedClassName));
        }
    } else {
        return codeModel.ref(fieldType);
    }
}
 
Example #3
Source File: Property.java    From aem-component-generator with Apache License 2.0 5 votes vote down vote up
public String getField() {
    if (StringUtils.isNotBlank(field)) {
        return field;
    } else if (StringUtils.isNoneBlank(label)) {
        return CaseUtils.toCamelCase(label.replaceAll("[^A-Za-z0-9+]", " "), false);
    }
    return field;
}
 
Example #4
Source File: Property.java    From aem-component-generator with Apache License 2.0 5 votes vote down vote up
public String getFieldGetterName() {
    if (StringUtils.isNotBlank(field)) {
        return StringUtils.capitalize(field);
    } else if (StringUtils.isNoneBlank(label)) {
        return CaseUtils.toCamelCase(label.replaceAll("[^A-Za-z0-9+]", " "), true);
    }
    return field;
}
 
Example #5
Source File: RfLintParser.java    From analysis-model with MIT License 5 votes vote down vote up
/**
 * Determines the RfLintRuleName based on the provided name.
 *
 * @param name
 *         the name of the rule
 *
 * @return An instance of RfLintRuleName matching the name. `UNKNOWN` as the default if the name is not valid.
 */
public static RfLintRuleName fromName(final String name) {
    for (RfLintRuleName rule : values()) {
        if (CaseUtils.toCamelCase(rule.name(), true, '_').equals(name)) {
            return rule;
        }
    }
    return UNKNOWN;
}
 
Example #6
Source File: GenerationConfig.java    From aem-component-generator with Apache License 2.0 4 votes vote down vote up
public String getJavaFormatedName() {
    if(StringUtils.isNotBlank(name)){
        javaFormatedName = CaseUtils.toCamelCase(name.replaceAll("-", " "), true);
    }
    return javaFormatedName;
}
 
Example #7
Source File: Utils.java    From api with Apache License 2.0 4 votes vote down vote up
public static String stringCamelCase(String input) {
    return CaseUtils.toCamelCase(input, false, '-', '_', ' ');
}
 
Example #8
Source File: ReferenceTestGenerator.java    From teku with Apache License 2.0 4 votes vote down vote up
private static String toCamelCase(final String input) {
  if (input.isEmpty()) {
    return input;
  }
  return CaseUtils.toCamelCase(sanitise(input), true, '_');
}
 
Example #9
Source File: JavaCodeModel.java    From aem-component-generator with Apache License 2.0 2 votes vote down vote up
/**
 * Generates the sling model interface name for a multifield type
 *
 * @param property the property definition for the multifield type
 * @return the sling model interface name
 */
public static String getMultifieldInterfaceName(Property property) {
    return StringUtils.defaultString(property.getModelName(), CaseUtils.toCamelCase(property.getField(), true) + "Multifield");
}