本文整理汇总了Java中io.advantageous.boon.core.Str.split方法的典型用法代码示例。如果您正苦于以下问题:Java Str.split方法的具体用法?Java Str.split怎么用?Java Str.split使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.advantageous.boon.core.Str
的用法示例。
在下文中一共展示了Str.split方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setRedisUri
import io.advantageous.boon.core.Str; //导入方法依赖的package包/类
/**
* RedisKeyValueStoreBuilder redis://redisdb:<password>@<host>:<port>/0
*
* @return this
*/
public RedisKeyValueStoreBuilder setRedisUri(final URI uri) {
getRedisOptions().setPort(uri.getPort());
getRedisOptions().setHost(uri.getHost());
final String userInfo = uri.getUserInfo();
final String[] split = Str.split(userInfo);
if (split.length == 2) {
getRedisOptions().setAuth(split[1]);
} else if (split.length == 1) {
getRedisOptions().setAuth(split[0]);
}
return this;
}
示例2: addRequestEndPointUsingPath
import io.advantageous.boon.core.Str; //导入方法依赖的package包/类
private void addRequestEndPointUsingPath(final ContextMeta context,
final ServiceMeta service,
final ServiceMethodMeta method,
final RequestMeta requestMeta,
final String path,
final String requestURI,
final String servicePath) {
RequestMetaData metaData = new RequestMetaData(path, context, requestMeta, method, service);
if (requestMeta.getCallType() == CallType.ADDRESS) {
metaDataMap.put(path, metaData);
} else {
NavigableMap<Integer, RequestMetaData> map = treeMap.get(path);
if (map == null) {
map = new TreeMap<>();
treeMap.put(path, map);
}
int count = Str.split(servicePath + requestURI, '/').length - 1;
map.put(count, metaData);
}
}
示例3: ProcessRunner
import io.advantageous.boon.core.Str; //导入方法依赖的package包/类
public ProcessRunner( ProcessInOut inout, String password, int timeoutInSeconds,
List<Path> path, boolean verbose, String... cmdLine ) {
if ( timeoutInSeconds == 0 ) {
timeoutInSeconds = 5;
}
if ( cmdLine.length == 1 ) {
cmdLine = Str.split( cmdLine[ 0 ] );
}
this.inout = inout;
this.commandLine = Lists.list( cmdLine );
this.password = password;
this.timeoutInSeconds = timeoutInSeconds;
this.path = path;
this.verbose = verbose;
if ( this.path == null ) {
this.path = Runner.path();
}
executorService = Executors.newFixedThreadPool( 2 );
}
示例4: doGet
import io.advantageous.boon.core.Str; //导入方法依赖的package包/类
private RequestMetaData doGet(final String path) {
RequestMetaData requestMetaData = metaDataMap.get(path);
if (requestMetaData == null) {
Map.Entry<String, NavigableMap<Integer, RequestMetaData>> uriParamNumMapEntry = treeMap.lowerEntry(path);
if (uriParamNumMapEntry == null) {
return null;
}
final String requestURI = Str.isEmpty(rootURI) ? path : StringScanner.substringAfter(path, rootURI);
int count = Str.split(requestURI, '/').length - 1;
NavigableMap<Integer, RequestMetaData> uriParamMap = uriParamNumMapEntry.getValue();
requestMetaData = uriParamMap.get(count);
if (requestMetaData != null && path.startsWith(requestMetaData.getPath())) {
return requestMetaData;
} else {
return null;
}
} else {
return requestMetaData;
}
}
示例5: findURIPosition
import io.advantageous.boon.core.Str; //导入方法依赖的package包/类
public static int findURIPosition(String path, String findString) {
final String[] pathParts = Str.split(path, '/');
int position;
for (position = 0; position < pathParts.length; position++) {
String pathPart = pathParts[position];
if (pathPart.equals(findString)) {
break;
}
}
return position;
}
示例6: usingReflection
import io.advantageous.boon.core.Str; //导入方法依赖的package包/类
@Test
public void usingReflection() throws Exception {
contextMetaBuilder.setRootURI(contextMetaBuilder.getRootURI() + "Engine");
contextMetaBuilder.addService(SampleService.class);
ContextMeta context = contextMetaBuilder.build();
assertEquals("/servicesEngine", context.getRootURI());
assertEquals("sampleservice", context.getServices().get(0).getName());
assertEquals("/sample/service", context.getServices().get(0).getRequestPaths().get(0));
assertEquals("simple1", context.getServices().get(0).getMethods().get(0).getName());
assertEquals("/simple1/", context.getServices().get(0).getMethods()
.get(0).getRequestEndpoints().get(0).getRequestURI());
assertEquals("method1", context.getServices().get(0).getMethods().get(1).getName());
assertEquals("/call1/foo/{arg4}/{2}", context.getServices().get(0).getMethods()
.get(1).getRequestEndpoints().get(0).getRequestURI());
final List<ParameterMeta> parameters = context.getServices().get(0).getMethods()
.get(1).getRequestEndpoints().get(0).getParameters();
assertEquals(TypeType.STRING, parameters.get(0).getType());
assertEquals(TypeType.INT, parameters.get(1).getType());
assertEquals(TypeType.FLOAT, parameters.get(2).getType());
assertEquals(TypeType.DOUBLE, parameters.get(3).getType());
assertEquals(ParamType.REQUEST, parameters.get(0).getParam().getParamType());
assertEquals(ParamType.HEADER, parameters.get(1).getParam().getParamType());
assertEquals(ParamType.PATH_BY_POSITION, parameters.get(2).getParam().getParamType());
assertEquals(ParamType.PATH_BY_NAME, parameters.get(3).getParam().getParamType());
final URIPositionalParam param = (URIPositionalParam) parameters.get(2).getParam();
assertEquals(2, param.getPosition());
// 0 1 2 3 4 5 6
//"/servcies/sample/myservice/call1/foo/{arg4}/{2}"
assertEquals(7, param.getIndexIntoURI());
final String[] split = Str.split("/servcies/sample/myservice/call1/foo/{arg4}/foo", '/');
assertEquals("foo", split[7]);
final String json = JsonFactory.toJson(context);
System.out.println(json);
}