本文整理汇总了Java中org.apache.commons.lang3.StringUtils.substringAfter方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtils.substringAfter方法的具体用法?Java StringUtils.substringAfter怎么用?Java StringUtils.substringAfter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang3.StringUtils
的用法示例。
在下文中一共展示了StringUtils.substringAfter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateMapType
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
private static Object generateMapType(ServiceDefinition def, TypeDefinition td, MetadataType metadataType,
Set<String> resolvedTypes) {
String keyType = StringUtils.substringAfter(td.getType(), "<");
keyType = StringUtils.substringBefore(keyType, ",");
keyType = StringUtils.strip(keyType);
keyType = StringUtils.isNotEmpty(keyType) ? keyType : "java.lang.Object";
Object key = generateType(def, keyType, metadataType, resolvedTypes);
String valueType = StringUtils.substringAfter(td.getType(), ",");
valueType = StringUtils.substringBefore(valueType, ">");
valueType = StringUtils.strip(valueType);
valueType = StringUtils.isNotEmpty(valueType) ? valueType : "java.lang.Object";
Object value = generateType(def, valueType, metadataType, resolvedTypes);
Map<Object, Object> map = new HashMap<>();
map.put(key, value);
return map;
}
示例2: handle
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public void handle(MessageReceivedEvent event) {
String message = event.getMessage().getContent();
String channel = event.getChannel().getName();
LOGGER.info("Read : {} in channel {}",message,channel);
if(message.startsWith(COMMAND_CUE)) {
String commandString = StringUtils.substringAfter(message, COMMAND_CUE);
String[] args = commandString.split(" ");
Command command = library.getCommand(args[0]);
if(command == null || !command.handle(event, args)) {
event.getChannel().sendMessage("Sorry!!, I did not understand your message " + commandString + ":(. Type !help for list of commands");
}
}
}
示例3: getProject
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Sessional
protected ProjectFacade getProject(HttpServletRequest request, HttpServletResponse response, String projectInfo)
throws IOException {
projectInfo = StringUtils.stripStart(StringUtils.stripEnd(projectInfo, "/"), "/");
if (StringUtils.isBlank(projectInfo) || !projectInfo.startsWith("projects/")) {
String url = request.getRequestURL().toString();
String urlRoot = url.substring(0, url.length()-getPathInfo(request).length());
throw new GitException(String.format("Expecting url of format %sprojects/<project name>", urlRoot));
}
String projectName = StringUtils.substringAfter(projectInfo, "/");
if (projectName.endsWith(".git"))
projectName = projectName.substring(0, projectName.length()-".git".length());
Project project = projectManager.find(projectName);
if (project == null) {
throw new GitException(String.format("Unable to find project %s", projectName));
}
return project.getFacade();
}
示例4: fromTransportFormatToBytes
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
* Transform a byte [] transported in hex prefixed by "**!kawanfw_bytes!**"
* to it's orginal byte []
*
* @param string
* the string that contains the bytes prefixed by
* "**!kawanfw_bytes!**"
* @return the bytes
*/
public static byte[] fromTransportFormatToBytes(String string) {
String encodedString = StringUtils
.substringAfter(string, KAWANFW_BYTES);
if (encodedString.equals("null")) {
return null;
}
try {
byte[] bytes = Base64.base64ToByteArray(encodedString);
return bytes;
} catch (Exception e) {
throw new IllegalArgumentException(Tag.PRODUCT_PRODUCT_FAIL
+ "String is not in BASE64 format: " + encodedString, e);
}
}
示例5: constructPatternId
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public static String constructPatternId(String patternResourcePath, String patternsPath, String templateName, String jsonDataFileName) {
final String patternPath = StringUtils.substringAfter(patternResourcePath, patternsPath + SLASH);
final StringBuilder patternIdBuilder = new StringBuilder();
if (StringUtils.endsWith(patternPath, HTML_EXT)) {
patternIdBuilder.append(StringUtils.substringBeforeLast(patternPath, HTML_EXT));
} else {
patternIdBuilder.append(patternPath);
}
if (StringUtils.isNotBlank(templateName)) {
patternIdBuilder.append(SLASH).append(templateName);
}
if (StringUtils.isNotBlank(jsonDataFileName)) {
final String patternFileName = StringUtils.substringAfterLast(patternPath, SLASH);
final String fileNameWithoutExt = StringUtils.substringBeforeLast(patternFileName, HTML_EXT);
final String dataFileSuffix = StringUtils.substringBetween(jsonDataFileName, fileNameWithoutExt
+ SELECTOR, DATA_EXT);
patternIdBuilder.append(SLASH).append(StringUtils.defaultString(dataFileSuffix, fileNameWithoutExt));
}
return StringUtils.replace(patternIdBuilder.toString(), SLASH, PATTERN_ID_REPLACEMENT);
}
示例6: TextRange
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public TextRange(String markStr) {
String begin = StringUtils.substringBefore(markStr, "-");
String end = StringUtils.substringAfter(markStr, "-");
beginLine = Integer.parseInt(StringUtils.substringBefore(begin, "."))-1;
beginChar = Integer.parseInt(StringUtils.substringAfter(begin, "."));
endLine = Integer.parseInt(StringUtils.substringBefore(end, "."))-1;
endChar = Integer.parseInt(StringUtils.substringAfter(end, "."));
}
示例7: fromPath
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
private static Registration fromPath(String path) {
String subPath = StringUtils.substringAfter(path, basePath);
String[] array = subPath.split("/");
String serviceName = array[0];
String[] address = array[1].split(":");
Registration registration = new Registration(address[0], Integer.parseInt(address[1]), serviceName);
return registration;
}
示例8: getClassName
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public static String getClassName(String code) {
String className = StringUtils.substringBefore(code, "{");
if (StringUtils.isBlank(className)) {
return className;
}
if (StringUtils.contains(code, " class ")) {
className = StringUtils.substringAfter(className, " class ");
if (StringUtils.contains(className, " extends ")) {
className = StringUtils.substringBefore(className, " extends ").trim();
} else if (StringUtils.contains(className, " implements ")) {
className = StringUtils.trim(StringUtils.substringBefore(className, " implements "));
} else {
className = StringUtils.trim(className);
}
} else if (StringUtils.contains(code, " interface ")) {
className = StringUtils.substringAfter(className, " interface ");
if (StringUtils.contains(className, " extends ")) {
className = StringUtils.substringBefore(className, " extends ").trim();
} else {
className = StringUtils.trim(className);
}
} else if (StringUtils.contains(code, " enum ")) {
className = StringUtils.trim(StringUtils.substringAfter(className, " enum "));
} else {
return StringUtils.EMPTY;
}
return className;
}
示例9: fromSqlToJava
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
* Decode the String param type passed by user on client side into a Types
* corresponding value.
*
* @param sqlParamType
* @return
*/
public static int fromSqlToJava(String sqlParamType) {
int javaType = 0;
if (sqlParamType.equals(AceQLTypes.CHARACTER)) {
javaType = Types.CHAR;
} else if (sqlParamType.equals(AceQLTypes.VARCHAR)) {
javaType = Types.VARCHAR;
} else if (sqlParamType.equals(AceQLTypes.LONGVARCHAR)) {
javaType = Types.LONGVARCHAR;
} else if (sqlParamType.equals(AceQLTypes.BIT)) {
javaType = Types.BIT;
} else if (sqlParamType.equals(AceQLTypes.NUMERIC)) {
javaType = Types.NUMERIC;
} else if (sqlParamType.equals(AceQLTypes.TINYINT)) {
javaType = Types.TINYINT;
} else if (sqlParamType.equals(AceQLTypes.SMALLINT)) {
javaType = Types.SMALLINT;
} else if (sqlParamType.equals(AceQLTypes.INTEGER)) {
javaType = Types.INTEGER;
} else if (sqlParamType.equals(AceQLTypes.BIGINT)) {
javaType = Types.BIGINT;
} else if (sqlParamType.equals(AceQLTypes.REAL)) {
javaType = Types.REAL;
} else if (sqlParamType.equals(AceQLTypes.FLOAT)) {
javaType = Types.FLOAT;
} else if (sqlParamType.equals(AceQLTypes.DOUBLE_PRECISION)) {
javaType = Types.DOUBLE;
} else if (sqlParamType.equals(AceQLTypes.DATE)) {
javaType = Types.DATE;
} else if (sqlParamType.equals(AceQLTypes.TIME)) {
javaType = Types.TIME;
} else if (sqlParamType.equals(AceQLTypes.TIMESTAMP)) {
javaType = Types.TIMESTAMP;
} else if (sqlParamType.equals(AceQLTypes.BINARY)) {
javaType = Types.BINARY;
} else if (sqlParamType.equals(AceQLTypes.VARBINARY)) {
javaType = Types.VARBINARY;
} else if (sqlParamType.equals(AceQLTypes.DATE)) {
javaType = Types.LONGVARBINARY;
} else if (sqlParamType.equals(AceQLTypes.BLOB)) {
javaType = Types.BLOB;
} else if (sqlParamType.equals(AceQLTypes.CLOB)) {
javaType = Types.CLOB;
} else if (sqlParamType.startsWith("TYPE_NULL")) {
String javaTypeStr = StringUtils.substringAfter(sqlParamType,
"TYPE_NULL");
javaType = Integer.parseInt(javaTypeStr);
} else {
throw new IllegalArgumentException(
"Unsuported data type for null setting: " + sqlParamType);
}
return javaType;
}
示例10: asFile
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
* 兼容无前缀, classpath://, file:// 的情况获取文件
*
* 如果以classpath:// 定义的文件不存在会抛出IllegalArgumentException异常,以file://定义的则不会
*/
public static File asFile(String generalPath) throws IOException {
if (StringUtils.startsWith(generalPath, CLASSPATH_PREFIX)) {
String resourceName = StringUtils.substringAfter(generalPath, CLASSPATH_PREFIX);
return getFileByURL(ResourceUtil.asUrl(resourceName));
}
try {
// try URL
return getFileByURL(new URL(generalPath));
} catch (MalformedURLException ex) {
// no URL -> treat as file path
return new File(generalPath);
}
}
示例11: setConnectorValues
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
* If there are some Connector properties, set them on Tomcat instance
*/
public void setConnectorValues() {
// Do we have to set special values to the Connector?
Enumeration<?> enumeration = properties.propertyNames();
if (enumeration.hasMoreElements()) {
System.out.println(SqlTag.SQL_PRODUCT_START + " Setting Default Connector base attributes:");
}
while (enumeration.hasMoreElements()) {
String property = (String) enumeration.nextElement();
if (property.startsWith("connector.")) {
String theValue = properties.getProperty(property);
String tomcatProperty = StringUtils.substringAfter(property, "connector.");
if (theValue != null && !theValue.isEmpty()) {
theValue = theValue.trim();
System.out.println(SqlTag.SQL_PRODUCT_START + " -> " + tomcatProperty + " = " + theValue);
tomcat.getConnector().setProperty(tomcatProperty, theValue);
}
}
}
}
示例12: getUrlHttpOnly
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
* Returns the HTTP URL
*
* @param url
* the JDBC URL with maybe "jdbc:aceql:" header
* @return the pure HTTP URL
*/
public static String getUrlHttpOnly(String url) {
if (url == null) {
throw new IllegalArgumentException("url is null!");
}
String urlHttpOnly = url;
if (url.startsWith(JDBC_URL_HEADER)) {
urlHttpOnly = StringUtils.substringAfter(url, JDBC_URL_HEADER);
}
return urlHttpOnly;
}
示例13: asStream
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
* 兼容file://与classpath://的情况的打开文件成Stream
*/
public static InputStream asStream(String generalPath) throws IOException {
if (StringUtils.startsWith(generalPath, CLASSPATH_PREFIX)) {
String resourceName = StringUtils.substringAfter(generalPath, CLASSPATH_PREFIX);
return ResourceUtil.asStream(resourceName);
}
try {
// try URL
return FileUtil.asInputStream(getFileByURL(new URL(generalPath)));
} catch (MalformedURLException ex) {
// no URL -> treat as file path
return FileUtil.asInputStream(generalPath);
}
}
示例14: findParameterTypes
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public static String[] findParameterTypes(String methodSignature, boolean erase) {
String parameterStr = StringUtils.substringAfter(methodSignature, "~");
String[] types = StringUtils.split(parameterStr, ';');
if (erase) {
for (int i = 0; i < types.length; i++) {
types[i] = StringUtils.substringBefore(types[i], "<");
}
}
return types;
}
示例15: buildURL
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
private GrpcURL buildURL(ConsulService service) {
try {
for (String tag : service.getTags()) {
if (StringUtils.indexOf(tag, Constants.PROVIDERS_CATEGORY) != -1) {
String toUrlPath = StringUtils.substringAfter(tag, Constants.PROVIDERS_CATEGORY);
GrpcURL salukiUrl = GrpcURL.valueOf(GrpcURL.decode(toUrlPath));
return salukiUrl;
}
}
} catch (Exception e) {
log.error("convert consul service to url fail! service:" + service, e);
}
return null;
}