Package java.util

Examples of java.util.StringTokenizer.countTokens()


    SimpleObj dest = mapper.map(src, SimpleObj.class);

    // Custom converter specified for the field1 mapping, so verify custom converter was actually used
    assertNotNull("dest field1 should not be null", dest.getField1());
    StringTokenizer st = new StringTokenizer(dest.getField1(), "-");
    assertEquals("dest field1 value should contain a hyphon", 2, st.countTokens());
    String token1 = st.nextToken();
    assertEquals("1st portion of dest field1 value should equal src field value", src.getValue("fieldA"), token1);
    String token2 = st.nextToken();
    assertEquals("dest field1 value should have been appended to by the cust converter",
        StringAppendCustomConverter.APPENDED_VALUE, token2);
View Full Code Here


    SimpleObj dest = mapper.map(src, SimpleObj.class);

    // Custom converter specified for the field1 mapping, so verify custom converter was actually used
    assertNotNull("dest field1 should not be null", dest.getField1());
    StringTokenizer st = new StringTokenizer(dest.getField1(), "-");
    assertEquals("dest field1 value should contain a hyphon", 2, st.countTokens());
    String token1 = st.nextToken();
    assertEquals("1st portion of dest field1 value should equal src field value", src.getHashMap().get("fieldA"), token1);
    String token2 = st.nextToken();
    assertEquals("dest field1 value should have been appended to by the cust converter",
        StringAppendCustomConverter.APPENDED_VALUE, token2);
View Full Code Here

    AnotherTestObject dest = mapper.map(src, AnotherTestObject.class);

    // Custom converter specified for the field1 mapping, so verify custom converter was actually used
    assertNotNull("dest field1 should not be null", dest.getField3());
    StringTokenizer st = new StringTokenizer(dest.getField3(), "-");
    assertEquals("dest field1 value should contain a hyphon", 2, st.countTokens());
    String token1 = st.nextToken();
    assertEquals("1st portion of dest field1 value should equal src field value", src.getField1(), token1);
    String token2 = st.nextToken();
    assertEquals("custom converter param should have been appended to by the cust converter", "CustomConverterParamTest", token2);
View Full Code Here

  private static String [] getCipherList() throws Exception {
    String cipherList = System.getProperty(CIPHER,null);
    String[] cipherTable = null;
    if ( cipherList != null ) {
      StringTokenizer tokenizer = new StringTokenizer( cipherList,",");
      int tokens = tokenizer.countTokens();
      if (tokens > 0) {
        cipherTable = new String[tokens];
        while(tokenizer.hasMoreElements())
          cipherTable[--tokens] = tokenizer.nextToken();
      }
View Full Code Here

        if(fqn == null || root == null)
            return;
        curr=root;
        tok=new StringTokenizer(fqn, "/");

        while(tok.countTokens() > 1) {
            child_name=tok.nextToken();
            n=curr.findChild(child_name);
            if(n == null) // node does not exist
                return;
            curr=n;
View Full Code Here

        } else {
            listTypes = argument.substring(spIndex + 1);
   
            // parse all the type tokens
            StringTokenizer st = new StringTokenizer(listTypes, ";");
            types = new String[st.countTokens()];
            for (int i = 0; i < types.length; ++i) {
                types[i] = st.nextToken();
            }
        }
        // set the list types
View Full Code Here

        return buf.toString();
    }

    public static byte[] decodeMacAddress(final String mac) {
        final StringTokenizer tokens = new StringTokenizer(mac, "-");
        if(tokens.countTokens() != MAC_ADDRESS_TOKENS) {
            throw new IllegalArgumentException("Unexpected mac address representation: " + mac);
        }
        final StringBuilder buf = new StringBuilder(MAC_ADDRESS_TOKENS * 2);
        for(int i = 0; i < MAC_ADDRESS_TOKENS; i++) {
            buf.append(tokens.nextToken());
View Full Code Here

   * @param splitter Characters to split on
   * @return List of String pieces from full string
   */
    public static List<String> split(String str, String splitter) {
        StringTokenizer tokens = new StringTokenizer(str, splitter);
        ArrayList<String> l = new ArrayList<String>(tokens.countTokens());
        while(tokens.hasMoreTokens()) {
            l.add(tokens.nextToken());
        }
        return l;
    }
View Full Code Here

     * @param delimiter Characters which are delimit tokens
     * @return Number of tokens seperated by the delimiter
     */
    public static int getTokenCount(String str, String delimiter) {
        StringTokenizer tokens = new StringTokenizer(str, delimiter);
        return tokens.countTokens();
    }   
   
    /**
     * Return the number of occurrences of token string that occurs in input string.
     * Note: token is case sensitive.
View Full Code Here

    // passing selected row id
    if (request.getParameterValues("rowId") != null) {
      String[] selectedRowId = request.getParameterValues("rowId");
      // why am I breaking up the first row on tokens?
      StringTokenizer parseSelectedId = new StringTokenizer(selectedRowId[0], ",");
      int countOfRowId = parseSelectedId.countTokens();
      rowId = new String[countOfRowId];
      int i = 0;
      while (parseSelectedId.hasMoreTokens()) {
        rowId[i] = parseSelectedId.nextToken().toString();
        i++;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.