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

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

Introduction

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

Prototype

public static String uncapitalize(final String str) 

Source Link

Document

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

Usage

From source file:com.csc.fi.ioapi.utils.LDHelper.java

public static String propertyName(String name) {
    name = StringUtils.uncapitalize(name);
    return removeInvalidCharacters(name);
}

From source file:com.yahoo.elide.core.filter.FilterPredicate.java

@Override
public String toString() {
    List<PathElement> elements = path.getPathElements();
    StringBuilder formattedPath = new StringBuilder();
    if (!elements.isEmpty()) {
        formattedPath//  w  w  w .j av  a 2 s.com
                .append(StringUtils.uncapitalize(EntityDictionary.getSimpleName(elements.get(0).getType())));
    }

    for (PathElement element : elements) {
        formattedPath.append(PERIOD).append(element.getFieldName());

    }
    return formattedPath.append(' ').append(operator).append(' ').append(values).toString();
}

From source file:com.yunmel.syncretic.core.BaseService.java

/**
 * ?(?delFlag)//from  w w  w.  j  av  a 2s .  c om
 * 
 * @param bean 
 * @return ?
 */
public <M extends BaseEntity> int updateDelFlagToDelStatusById(Class<M> bean, String id) {
    String mapperName = StringUtils.uncapitalize(bean.getSimpleName()) + "Mapper";
    Mapper<M> mapper = SpringUtils.getBean(mapperName);
    M m = null;
    try {
        m = bean.newInstance();
        m.setId(id);
        m.set("delFlag", Globle.DEL_FLAG_DELETE);
    } catch (InstantiationException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
    return mapper.updateByPrimaryKeySelective(m);
}

From source file:com.discovery.darchrow.lang.StringUtil.java

/**
 * ???? Jinxin/*from  w ww .  jav  a2 s .  c o  m*/
 * 
 * return jinxin
 * 
 * <pre>
 * StringUtils.capitalize(null)  = null
 * StringUtils.capitalize(&quot;&quot;)    = &quot;&quot;
 * StringUtils.capitalize(&quot;Jinxin&quot;) = &quot;jinxin&quot;
 * StringUtils.capitalize(&quot;CAt&quot;) = &quot;cAt&quot;
 * </pre>
 * 
 * @param word
 *            ??
 * @return ????
 * @see org.apache.commons.lang3.StringUtils#uncapitalize(String)
 */
public static final String firstCharToLowerCase(String word) {
    return StringUtils.uncapitalize(word);
}

From source file:com.github.jknack.handlebars.internal.BaseTemplate.java

/**
 * Creates a new {@link TypeSafeTemplate}.
 *
 * @param rootType The target type.//from  www.ja v  a 2 s.  c o  m
 * @param template The target template.
 * @return A new {@link TypeSafeTemplate}.
 */
private static Object newTypeSafeTemplate(final Class<?> rootType, final Template template) {
    return Proxy.newProxyInstance(template.getClass().getClassLoader(), new Class[] { rootType },
            new InvocationHandler() {
                private Map<String, Object> attributes = new HashMap<String, Object>();

                @Override
                public Object invoke(final Object proxy, final Method method, final Object[] args)
                        throws IOException {
                    String methodName = method.getName();
                    if ("apply".equals(methodName)) {
                        Context context = Context.newBuilder(args[0]).combine(attributes).build();
                        attributes.clear();
                        if (args.length == 2) {
                            template.apply(context, (Writer) args[1]);
                            return null;
                        }
                        return template.apply(context);
                    }

                    if (Modifier.isPublic(method.getModifiers()) && methodName.startsWith("set")) {
                        String attrName = StringUtils.uncapitalize(methodName.substring("set".length()));
                        if (args != null && args.length == 1 && attrName.length() > 0) {
                            attributes.put(attrName, args[0]);
                            if (TypeSafeTemplate.class.isAssignableFrom(method.getReturnType())) {
                                return proxy;
                            }
                            return null;
                        }
                    }
                    String message = String.format(
                            "No handler method for: '%s(%s)', expected method signature is: 'setXxx(value)'",
                            methodName, args == null ? "" : join(args, ", "));
                    throw new UnsupportedOperationException(message);
                }
            });
}

From source file:net.rptools.gui.GuiBuilder.java

/**
 * Create all the layer panes/nodes and signal contruction end to framework.
 * @param layer layers to supply nodes to
 *//*w w w  . j  av a  2  s.c  om*/
@ThreadPolicy(ThreadPolicy.ThreadId.MAIN)
public void createLayerPanes(final Layer layer) {
    Platform.runLater(new Runnable() {
        @Override
        public void run() {
            final String selector = "#" + StringUtils.uncapitalize(layer.getName());
            LOGGER.debug("selector={}", selector);
            final Node layerNode = rootRegion.lookup(selector);
            LOGGER.info("rootRegion={}; selector={}; layerNode={}", rootRegion, selector, layerNode);
            if (layerNode != null) {
                layer.setDrawable((Pane) layerNode);
            }
        }
    });
}

From source file:io.wcm.caravan.io.jsontransform.source.XmlSource.java

private String convertName(final String name) {
    if (uncapitalizeProperties) {
        return StringUtils.uncapitalize(name);
    }/*from w w  w. ja v a  2s .co  m*/
    return name;
}

From source file:com.oakhole.Generate.java

/**
 * object// w w w  .  ja  va2 s.co m
 * @param object
 * @return
 */
private Map<String, Object> getDataModel(Class object) {
    Map<String, Object> dataModel = Maps.newHashMap();

    // Step 1: ?
    dataModel.put("author", "Oakhole");
    dataModel.put("since", "1.0");

    // Step 2: ?packageName?className?
    String packageName = object.getPackage().getName();

    // ?Entity
    packageName = packageName.substring(0, packageName.lastIndexOf("."));

    // ???
    String className = object.getName();
    className = className.substring(className.lastIndexOf(".") + 1, className.length());

    // Step 3: 
    dataModel.put("packageName", packageName);
    dataModel.put("ClassName", className);
    dataModel.put("className", StringUtils.uncapitalize(className));

    return dataModel;
}

From source file:com.minlia.cloud.framework.common.web.controller.AbstractReadOnlyController.java

protected S getService() {
    ApplicationContext applicationContext = ApplicationContextHolder.getApplicationContext();
    Object object = applicationContext
            .getBean(StringUtils.uncapitalize(this.clazz.getSimpleName()) + "ServiceImpl");
    return (S) object;
}

From source file:br.com.mv.modulo.web.GenericCrudController.java

private String getModelName() {
    return StringUtils.uncapitalize(clazz.getSimpleName());
}