Example usage for org.apache.commons.lang StringUtils uncapitalize

List of usage examples for org.apache.commons.lang StringUtils uncapitalize

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils uncapitalize.

Prototype

public static String uncapitalize(String str) 

Source Link

Document

Uncapitalizes a String changing the first letter to title case as per Character#toLowerCase(char) .

Usage

From source file:com.agimatec.annotations.jam.JAMDtoMethod.java

public String getName() {
    int offset = 3;
    if (getType().equals("boolean") && jmethod.getSimpleName().startsWith("is")) {
        offset = 2;/*www  .j a  v  a  2  s  .com*/
    }
    return StringUtils.uncapitalize(jmethod.getSimpleName().substring(offset));
}

From source file:com.senacor.core.manager.LocalManagerFactory.java

public <T extends Manager> T getManager(Class<T> clazz) {
    Object bean = applicationContext.getBean(StringUtils.uncapitalize(clazz.getSimpleName()));
    assert bean != null : ManagerError.NO_EXACT_MANAGER_DEFINITION_FOUND.getDescription();
    return (T) bean;
}

From source file:de.hybris.platform.acceleratorfacades.device.populators.ResponsiveImagePopulator.java

@Override
public void populate(final MediaModel mediaModel, final ImageData imageData) throws ConversionException {
    final Matcher filenameMatcher = fileNameExtractorPattern.matcher(mediaModel.getCode());
    if (filenameMatcher.find()) {
        final Matcher widthMatcher = widthExtractorPattern.matcher(filenameMatcher.group());
        if (widthMatcher.find()) {
            final String matchingString = StringUtils.uncapitalize(widthMatcher.group());
            imageData.setWidth(Integer.valueOf(StringUtils.remove(matchingString, 'x')));
        }/* w w w. ja v a2  s.c o  m*/
    } else {
        if (getResponsiveImageFormats().containsKey(mediaModel.getMediaFormat().getQualifier())) {
            imageData.setWidth(getResponsiveImageFormats().get(mediaModel.getMediaFormat().getQualifier()));
        }
    }
}

From source file:hr.fer.zemris.vhdllab.platform.manager.editor.impl.AbstractEditorMetadata.java

public AbstractEditorMetadata(Class<? extends Editor> editorClass) {
    Validate.notNull(editorClass, "Editor class can't be null");
    this.editorClass = editorClass;
    this.code = StringUtils.uncapitalize(getClass().getSimpleName().replace("Metadata", ""));
}

From source file:com.bstek.dorado.view.widget.action.LongTaskParser.java

@Override
protected void initDefinition(ObjectDefinition definition, Element element, ParseContext context)
        throws Exception {
    super.initDefinition(definition, element, context);

    String taskName = (String) definition.getProperty("taskName");
    if (taskName != null && taskName.charAt(0) == '#') {
        String viewName = ((ViewParseContext) context).getResourceName();
        if (StringUtils.isNotEmpty(viewName)) {
            String prefix;/*from  w ww .ja  v a  2  s.co  m*/
            int i1 = viewName.lastIndexOf('/');
            int i2 = viewName.lastIndexOf('.');
            int i = (i1 > i2) ? i1 : i2;
            if (i > 0 && i < (viewName.length() - 1)) {
                prefix = viewName.substring(i + 1);
            } else {
                prefix = viewName;
            }
            definition.setProperty("taskName", StringUtils.uncapitalize(prefix) + taskName);
        }
    }
}

From source file:com.bstek.dorado.view.type.property.validator.AjaxValidatorParser.java

@Override
protected void initDefinition(ObjectDefinition definition, Element element, ParseContext context)
        throws Exception {
    super.initDefinition(definition, element, context);

    String service = (String) definition.getProperty("service");
    if (service != null && service.charAt(0) == '#') {
        String viewName = ((ViewParseContext) context).getResourceName();
        if (StringUtils.isNotEmpty(viewName)) {
            String prefix;/*from   w  ww .  j ava 2  s  .c  o m*/
            int i1 = viewName.lastIndexOf('/');
            int i2 = viewName.lastIndexOf('.');
            int i = (i1 > i2) ? i1 : i2;
            if (i > 0 && i < (viewName.length() - 1)) {
                prefix = viewName.substring(i + 1);
            } else {
                prefix = viewName;
            }
            definition.setProperty("service", StringUtils.uncapitalize(prefix) + service);
        }
    }
}

From source file:edu.scripps.fl.pubchem.xml.extract.AssayExtractor.java

public void fillAssayExcelTemplate(ExcelTableModel model, Assay assay)
        throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
    model.setSheet("Assay");
    model.setUseFirstRowAsColumnHeadings(false);
    String[] tags = { "AID", "Name", "External Reg Id", "Grant Number", "Project Category", "Hold Until Date",
            "Activity Outcome Method", "Source" };
    Integer count = tags.length;/*  ww w .j  av a2  s  .co m*/

    for (int ii = 0; ii < count; ii++) {
        model.setValueAt(tags[ii], ii, 0);
        String property = StringUtils.uncapitalize(tags[ii].replaceAll(" ", ""));
        if (tags[ii].equals("AID"))
            property = property.toLowerCase();
        if (property.equals("holdUntilDate"))
            model.setValueAt(assay.getHoldUntilDate(), ii, 1);
        else {
            Object value = BeanUtils.getProperty(assay, property);
            model.setValueAt(value, ii, 1);
        }
    }
    List<String> descriptionS = assay.getDescription();
    putStringListInModel(model, descriptionS, count, "Description");

    List<String> protocolS = assay.getProtocol();
    count = count + descriptionS.size();
    putStringListInModel(model, protocolS, count, "Protocol");

    List<String> commentS = assay.getComment();
    count = count + protocolS.size();
    putStringListInModel(model, commentS, count, "Comment");

    //      Sheet sheet = model.getSheet();
    //      for(int ii = 0; ii <= model.getColumnCount(); ii++)
    //         sheet.autoSizeColumn(ii);
}

From source file:com.migo.utils.GenUtils.java

/**
 * ??//from  ww  w .j a  v a2s. com
 */
public static void generatorCode(Map<String, String> table, List<Map<String, String>> columns,
        ZipOutputStream zip) {
    //??
    Configuration config = getConfig();

    //?
    TableEntity tableEntity = new TableEntity();
    tableEntity.setTableName(table.get("tableName"));
    tableEntity.setComments(table.get("tableComment"));
    //????Java??
    String className = tableToJava(tableEntity.getTableName(), config.getString("tablePrefix"));
    tableEntity.setClassName(className);
    tableEntity.setClassname(StringUtils.uncapitalize(className));

    //?
    List<ColumnEntity> columsList = new ArrayList<>();
    for (Map<String, String> column : columns) {
        ColumnEntity columnEntity = new ColumnEntity();
        columnEntity.setColumnName(column.get("columnName"));
        columnEntity.setDataType(column.get("dataType"));
        columnEntity.setComments(column.get("columnComment"));
        columnEntity.setExtra(column.get("extra"));

        //????Java??
        String attrName = columnToJava(columnEntity.getColumnName());
        columnEntity.setAttrName(attrName);
        columnEntity.setAttrname(StringUtils.uncapitalize(attrName));

        //???Java
        String attrType = config.getString(columnEntity.getDataType(), "unknowType");
        columnEntity.setAttrType(attrType);

        //?
        if ("PRI".equalsIgnoreCase(column.get("columnKey")) && tableEntity.getPk() == null) {
            tableEntity.setPk(columnEntity);
        }

        columsList.add(columnEntity);
    }
    tableEntity.setColumns(columsList);

    //
    if (tableEntity.getPk() == null) {
        tableEntity.setPk(tableEntity.getColumns().get(0));
    }

    //velocity?
    Properties prop = new Properties();
    prop.put("file.resource.loader.class",
            "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
    Velocity.init(prop);

    //???
    Map<String, Object> map = new HashMap<>();
    map.put("tableName", tableEntity.getTableName());
    map.put("comments", tableEntity.getComments());
    map.put("pk", tableEntity.getPk());
    map.put("className", tableEntity.getClassName());
    map.put("classname", tableEntity.getClassname());
    map.put("pathName", tableEntity.getClassname().toLowerCase());
    map.put("columns", tableEntity.getColumns());
    map.put("package", config.getString("package"));
    map.put("author", config.getString("author"));
    map.put("email", config.getString("email"));
    map.put("datetime", DateUtils.format(new Date(), DateUtils.DATE_TIME_PATTERN));
    VelocityContext context = new VelocityContext(map);

    //??
    List<String> templates = getTemplates();
    for (String template : templates) {
        //?
        StringWriter sw = new StringWriter();
        Template tpl = Velocity.getTemplate(template, "UTF-8");
        tpl.merge(context, sw);

        try {
            //zip
            zip.putNextEntry(new ZipEntry(
                    getFileName(template, tableEntity.getClassName(), config.getString("package"))));
            IOUtils.write(sw.toString(), zip, "UTF-8");
            IOUtils.closeQuietly(sw);
            zip.closeEntry();
        } catch (IOException e) {
            throw new RRException("???" + tableEntity.getTableName(), e);
        }
    }
}

From source file:hr.fer.zemris.vhdllab.platform.listener.AutoPublishListenerBeanPostProcessor.java

@SuppressWarnings("unchecked")
@Override//from ww  w.  j a v  a  2 s  .  co  m
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
    List<Class<?>> implementedInterfaces = ClassUtils.getAllInterfaces(bean.getClass());
    for (Class<?> implementedInterface : implementedInterfaces) {
        AutoPublished autoPublished = implementedInterface.getAnnotation(AutoPublished.class);
        if (autoPublished != null) {
            Class<?> publisherClass = autoPublished.publisher();
            Object object = context.getBean(StringUtils.uncapitalize(publisherClass.getSimpleName()));
            try {
                MethodUtils.invokeMethod(object, "addListener", bean);
            } catch (Exception e) {
                throw new IllegalStateException("Auto publishing event listener failed", e);
            }
        }
    }
    return bean;
}

From source file:mrcg.domain.JavaClass.java

public String getLowerCamelPlural() {
    return Utils.pluralize(StringUtils.uncapitalize(name));
}