List of usage examples for org.apache.commons.lang3 StringUtils substringAfterLast
public static String substringAfterLast(final String str, final String separator)
Gets the substring after the last occurrence of a separator.
From source file:com.zht.common.codegen.excute.impl.DaoGeneratorImpl.java
public void genDaoImpl(String entityFullClassName) { DaoImplModel daoModel = new DaoImplModel(); String entitySimpleClassName = StringUtils.substringAfterLast(entityFullClassName, "."); String path = StringUtils.substringBeforeLast(entityFullClassName, "."); path = StringUtils.substringBeforeLast(path, "."); String packageName = path + ".dao.impl"; String interfacePackageName = path + ".dao"; String className = entitySimpleClassName + "DaoImpl"; daoModel.setPackageName(packageName); daoModel.setEntitySimpleClassName(entitySimpleClassName); daoModel.setInterfacePackageName(interfacePackageName); Map<String, Object> data = new HashMap<String, Object>(); data.put("model", daoModel); String filePath = new String( GenConstant.project_path + "src/" + package2path(packageName) + "/" + className + ".java"); super.generate(GenConstant.daoImpl_template_dir, data, filePath); }
From source file:com.ppcxy.cyfm.showcase.demos.utilities.string.ApacheStringUtilsDemo.java
@Test public void substring() { String input = "hahakaka"; String result = StringUtils.substringAfter(input, "ha"); assertThat(result).isEqualTo("hakaka"); result = StringUtils.substringAfterLast(input, "ha"); assertThat(result).isEqualTo("kaka"); assertThat(StringUtils.substringBetween("'haha'", "'")).isEqualTo("haha"); assertThat(StringUtils.substringBetween("{haha}", "{", "}")).isEqualTo("haha"); }
From source file:cc.recommenders.names.CoReVariableName.java
@Override public String getName() { return StringUtils.substringAfterLast(identifier, "#"); }
From source file:com.thinkbiganalytics.nifi.feedmgr.ConfigurationPropertyReplacer.java
/** * return the application.properties property key for the specific property using the proocessor type as the key reference * * @param property the nifi property// w ww .j a v a2s . com * @return the property key prepended with the "nifi.<processor type>." */ public static String getProcessorPropertyConfigName(NifiProperty property) { String processorTypeName = "nifi." + toPropertyName( StringUtils.substringAfterLast(property.getProcessorType(), ".") + "." + property.getKey()); return processorTypeName; }
From source file:com.vmware.admiral.test.integration.client.ServiceDocument.java
public static String extractId(String documentSelfLink) { if (documentSelfLink == null) { return null; }//from w ww .j a v a2 s . co m String id = StringUtils.substringAfterLast(documentSelfLink, "/"); if (id == null || id.isEmpty()) { return documentSelfLink; } return id; }
From source file:com.eryansky.common.orm.core.PropertyFilters.java
/** * ?/* w w w . j ava 2s .co m*/ * <p> * * </p> * <code> * PropertyFilters.get("EQS_propertyName","maurice") * </code> * * @param expression ? * @param matchValue * * @return {@link PropertyFilter} */ @SuppressWarnings("static-access") public static PropertyFilter get(String expression, String matchValue) { Assert.hasText(expression, "??"); String restrictionsNameAndClassType = StringUtils.substringBefore(expression, "_"); String restrictionsName = StringUtils.substring(restrictionsNameAndClassType, 0, restrictionsNameAndClassType.length() - 1); String classType = StringUtils.substring(restrictionsNameAndClassType, restrictionsNameAndClassType.length() - 1, restrictionsNameAndClassType.length()); FieldType FieldType = null; try { FieldType = FieldType.valueOf(classType); } catch (Exception e) { throw new IllegalAccessError( "[" + expression + "]??,?:" + classType); } String[] propertyNames = null; if (StringUtils.contains(expression, "_OR_")) { String temp = StringUtils.substringAfter(expression, restrictionsNameAndClassType + "_"); propertyNames = StringUtils.splitByWholeSeparator(temp, "_OR_"); } else { propertyNames = new String[1]; propertyNames[0] = StringUtils.substringAfterLast(expression, "_"); } return new PropertyFilter(restrictionsName, FieldType, propertyNames, matchValue); }
From source file:com.inkubator.hrm.batch.PayTempOvertimeUploadReader.java
public PayTempOvertimeUploadReader(String filePath) { this.extension = StringUtils.substringAfterLast(filePath, "."); this.pathUpload = filePath; if (StringUtils.equals(this.extension, "csv")) { this.initializationCsvReader(filePath); } else {// w w w . j av a 2s . c o m this.initializationExcelReader(filePath); } }
From source file:com.github.dactiv.orm.core.PropertyFilters.java
/** * ?//from w w w .ja va2 s . c o m * <p> * * </p> * <code> * PropertyFilters.build("EQS_propertyName","maurice") * </code> * * @param expression ? * @param matchValue * * @return {@link PropertyFilter} */ @SuppressWarnings("static-access") public static PropertyFilter build(String expression, String matchValue) { Assert.hasText(expression, "??"); String restrictionsNameAndClassType = StringUtils.substringBefore(expression, "_"); String restrictionsName = StringUtils.substring(restrictionsNameAndClassType, 0, restrictionsNameAndClassType.length() - 1); String classType = StringUtils.substring(restrictionsNameAndClassType, restrictionsNameAndClassType.length() - 1, restrictionsNameAndClassType.length()); FieldType FieldType = null; try { FieldType = FieldType.valueOf(classType); } catch (Exception e) { throw new IllegalAccessError( "[" + expression + "]??,?:" + classType); } String[] propertyNames = null; if (StringUtils.contains(expression, "_OR_")) { String temp = StringUtils.substringAfter(expression, restrictionsNameAndClassType + "_"); propertyNames = StringUtils.splitByWholeSeparator(temp, "_OR_"); } else { propertyNames = new String[1]; propertyNames[0] = StringUtils.substringAfterLast(expression, "_"); } return new PropertyFilter(restrictionsName, FieldType, propertyNames, matchValue); }
From source file:com.zht.common.codegen.excute.impl.ServiceGeneratorImpl.java
@Override public void genServiceImpl(String entityFullClassName) { ServiceImplModel serviceModel = new ServiceImplModel(); String entitySimpleClassName = StringUtils.substringAfterLast(entityFullClassName, "."); String path = StringUtils.substringBeforeLast(entityFullClassName, "."); path = StringUtils.substringBeforeLast(path, "."); String packageName = path + ".service.impl"; String interfacePackageName = path + ".service"; String className = entitySimpleClassName + "ServiceImpl"; String daoPackageName = path + ".dao"; serviceModel.setPackageName(packageName); serviceModel.setEntitySimpleClassName(entitySimpleClassName); serviceModel.setInterfacePackageName(interfacePackageName); serviceModel.setEntityFullClassName(entityFullClassName); serviceModel.setDaoPackageName(daoPackageName); Map<String, Object> data = new HashMap<String, Object>(); data.put("model", serviceModel); String filePath = new String( GenConstant.project_path + "src/" + package2path(packageName) + "/" + className + ".java"); super.generate(GenConstant.serviceImpl_template_dir, data, filePath); }
From source file:de.blizzy.backup.vfs.RemoteFileOrFolder.java
@Override public String getName() { return StringUtils.substringAfterLast(file, "/"); //$NON-NLS-1$ }