当前位置: 首页>>代码示例>>Java>>正文


Java Str.split方法代码示例

本文整理汇总了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;
}
 
开发者ID:advantageous,项目名称:qbit-extensions,代码行数:22,代码来源:RedisKeyValueStoreBuilder.java

示例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);

    }
}
 
开发者ID:advantageous,项目名称:qbit,代码行数:27,代码来源:StandardMetaDataProvider.java

示例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 );

}
 
开发者ID:advantageous,项目名称:boon,代码行数:28,代码来源:Runner.java

示例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;
        }
    }
 
开发者ID:advantageous,项目名称:qbit,代码行数:28,代码来源:StandardMetaDataProvider.java

示例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;
    }
 
开发者ID:advantageous,项目名称:qbit,代码行数:14,代码来源:RequestMetaBuilder.java

示例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);

}
 
开发者ID:advantageous,项目名称:qbit,代码行数:68,代码来源:ContextBuilderTest.java


注:本文中的io.advantageous.boon.core.Str.split方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。