List of usage examples for org.springframework.util StringUtils uncapitalize
public static String uncapitalize(String str)
From source file:net.nan21.dnet.core.presenter.converter.AbstractDsConverter.java
/** * Update entity attribute fields.// ww w .j av a 2 s . co m * * @param m * @param e * @param isInsert * @param entityService * @throws Exception */ protected void modelToEntityAttributes(M m, E e, boolean isInsert, EntityManager em) throws Exception { StandardEvaluationContext context = new StandardEvaluationContext(m); Map<String, String> attrmap = this.descriptor.getM2eConv(); Method[] methods = this.getEntityClass().getMethods(); List<String> noInserts = this.descriptor.getNoInserts(); List<String> noUpdates = this.descriptor.getNoUpdates(); for (Method method : methods) { if (method.getName().startsWith("set")) { String fn = StringUtils.uncapitalize(method.getName().substring(3)); boolean doit = true; if (attrmap.containsKey(fn)) { String dsf = attrmap.get(fn); if (isInsert && noInserts.contains(fn)) { doit = false; } if (!isInsert && noUpdates.contains(fn)) { doit = false; } try { if (doit) { method.invoke(e, parser.parseExpression(dsf).getValue(context)); } } catch (Exception exc) { } } } } }
From source file:org.shredzone.commons.taglib.processor.TaglibProcessor.java
/** * Processes a {@link Tag} annotation./* w ww .j a v a 2s . c o m*/ * * @param element * Program element with that tag */ private void processTag(Element element) { Tag tagAnno = element.getAnnotation(Tag.class); String className = element.toString(); String tagName = computeTagName(tagAnno.name(), className); // Try to evaluate the class name of the tag type String tagTypeClass = null; try { Class<? extends JspTag> tagType = tagAnno.type(); tagTypeClass = tagType.getName(); } catch (MirroredTypeException ex) { // This is a hack, see http://forums.sun.com/thread.jspa?threadID=791053 tagTypeClass = ex.getTypeMirror().toString(); } if (!PROXY_MAP.containsKey(tagTypeClass)) { throw new ProcessorException("No proxy for tag type " + tagTypeClass); } TagBean tag = new TagBean(tagName, className, tagAnno.bodycontent(), tagTypeClass); tag.setProxyClassName(className + "Proxy"); if (StringUtils.hasText(tagAnno.bean())) { tag.setBeanName(tagAnno.bean()); } else { tag.setBeanName(StringUtils.uncapitalize(StringUtils.unqualify(className))); } tag.setTryCatchFinally(tagAnno.tryCatchFinally()); taglib.addTag(tag); }
From source file:org.agatom.springatom.cmp.wizards.core.AbstractWizardProcessor.java
protected String getWizardID() { final String value = this.getWizardAnnotation().value(); if (!StringUtils.hasText(value)) { return StringUtils.uncapitalize(ClassUtils.getShortName(this.getClass())); }/*from ww w.jav a 2s .c o m*/ return value; }
From source file:org.web4thejob.web.panel.DefaultTabbedEntityViewPanel.java
private String buildBeanIdFromRenderScheme(RenderScheme renderScheme) { return StringUtils.uncapitalize(renderScheme.getTargetType().getSimpleName()); }
From source file:com.cottsoft.thrift.framework.server.ThriftMultiBinaryServerFactory.java
/** * ?Service implSpring bean???@Service???? * /* w w w .j av a 2 s . co m*/ * @param thriftServiceImplClass * @return */ private String getServiceImplBeanName(Class<?> thriftServiceImplClass) { if (thriftServiceImplClass.isAnnotationPresent(Service.class)) { Service serviceAnnotation = (Service) thriftServiceImplClass.getAnnotation(Service.class); String value = serviceAnnotation.value(); if (StringUtils.isEmpty(value)) { return StringUtils.uncapitalize(thriftServiceImplClass.getSimpleName()); } else { return value; } } else { return StringUtils.uncapitalize(thriftServiceImplClass.getSimpleName()); } }
From source file:net.nan21.dnet.core.presenter.service.asgn.AbstractAsgnService.java
/** * /*from www .ja v a2 s.c o m*/ * @param e * @param m * @throws Exception */ public void entityToModel(E e, M m) throws Exception { ExpressionParser parser = new SpelExpressionParser(); StandardEvaluationContext context = new StandardEvaluationContext(e); Map<String, String> refpaths = this.getDescriptor().getE2mConv(); Method[] methods = this.getModelClass().getMethods(); for (Method method : methods) { if (!method.getName().equals("set__clientRecordId__") && method.getName().startsWith("set")) { String fn = StringUtils.uncapitalize(method.getName().substring(3)); try { method.invoke(m, parser.parseExpression(refpaths.get(fn)).getValue(context)); } catch (Exception exc) { } } } }
From source file:org.web4thejob.web.dialog.DefaultSelectPanelDialog.java
private void drawLayoutsTab() { Tab tab = new Tab(L10N_TAB_TITLE_LAYOUTS.toString()); tab.setParent(tabbox.getTabs());//from ww w .j a va2s .c om Tabpanel tabpanel = new Tabpanel(); tabpanel.setParent(tabbox.getTabpanels()); listboxLayouts = new Listbox(); listboxLayouts.setParent(tabpanel); listboxLayouts.setHflex("true"); listboxLayouts.setVflex("true"); listboxLayouts.setSpan(true); listboxLayouts.addEventListener(Events.ON_DOUBLE_CLICK, this); new Listhead().setParent(listboxLayouts); listboxLayouts.getListhead().setSizable(true); Listheader header = new Listheader(L10N_HEADER_NAME.toString()); header.setParent(listboxLayouts.getListhead()); header.setSort("auto"); header = new Listheader(L10N_HEADER_DESCRIPTION.toString()); header.setParent(listboxLayouts.getListhead()); header.setSort("auto"); header = new Listheader(L10N_HEADER_TYPE.toString()); header.setParent(listboxLayouts.getListhead()); header.setSort("auto"); for (org.web4thejob.web.panel.Panel panel : ContextUtil.getSessionContext().getPanels(LayoutPanel.class)) { if (panel != null && !ContentPanel.class.isInstance(panel)) { Listitem item = new Listitem(); item.setParent(listboxLayouts); item.setAttribute(ATTRIB_BEANID, panel.getBeanName()); String name; String descr; if (panel.isPersisted()) { PanelDefinition panelDefinition = ORMUtil.getPanelDefinition(panel.getBeanName()); name = panelDefinition.getName(); descr = panelDefinition.getDescription(); } else { name = panel.getBeanName(); descr = L10N_MSG_SYSTEM_DEFINED.toString(); } boolean featured = name .equals(StringUtils.uncapitalize(DefaultBorderedLayoutPanel.class.getSimpleName())) || name.equals(StringUtils.uncapitalize(DefaultTabbedLayoutPanel.class.getSimpleName())); Listcell cell = new Listcell(name); cell.setParent(item); cell.setImage(panel.getImage()); if (featured) { cell.setStyle("font-weight:bold;font-style:italic;"); } cell = new Listcell(descr); cell.setParent(item); if (featured) { cell.setStyle("font-weight:bold;font-style:italic;"); } cell = new Listcell(panel.getClass().getSimpleName()); cell.setParent(item); if (featured) { cell.setStyle("font-weight:bold;font-style:italic;"); } } } }
From source file:net.daum.clix.springframework.data.rest.client.repository.RestRepositories.java
public String getRepositoryNameFor(Class<?> domainClass) { Class<?> repositoryInterface = getRepositoryInterfaceFor(domainClass); return repositoryInterface == null ? null : StringUtils.uncapitalize(repositoryInterface.getSimpleName().replaceAll("Repository", "")); }
From source file:org.shredzone.commons.taglib.processor.TaglibProcessor.java
/** * Processes a {@link TagParameter} annotation. * * @param element//from w w w. jav a 2 s.c o m * Program element with that tag */ private void processTagParameter(Element element) { TagParameter tagAnno = element.getAnnotation(TagParameter.class); String methodName = element.toString(); String className = element.getEnclosingElement().toString(); TagBean tag = taglib.getTagForClass(className); if (tag == null) { throw new ProcessorException("Missing @Tag on class: " + className); } Matcher m = METHOD_PATTERN.matcher(methodName); if (!m.matches()) { throw new ProcessorException("@TagParameter must be used on a setter method: " + methodName); } String attrName = StringUtils.uncapitalize(m.group(1)); String attrType = m.group(2); if (attrType.indexOf(',') >= 0) { throw new ProcessorException("@TagParameter setter only allows one parameter: " + methodName); } AttributeBean attr = new AttributeBean(attrName, attrType, tagAnno.required(), tagAnno.rtexprvalue()); tag.addAttribute(attr); }
From source file:com.opengamma.language.object.ObjectFunctionProvider.java
protected String uncapitalize(final String str) { if (str.length() > 1) { if (Character.isUpperCase(str.charAt(0)) && Character.isUpperCase(str.charAt(1))) { return str; }//from w w w .ja va 2 s . co m } return StringUtils.uncapitalize(str); }