KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > soto > state > helpers > ScopeParser


1 package org.sapia.soto.state.helpers;
2
3 import org.apache.commons.lang.StringUtils;
4
5 /**
6  * A utility class that parses scope names from a comma-delimited list.
7  *
8  * @author Yanick Duchesne
9  *
10  * <dl>
11  * <dt><b>Copyright:</b><dd>Copyright &#169; 2002-2004 <a HREF="http://www.sapia-oss.org">Sapia Open Source Software</a>. All Rights Reserved.</dd></dt>
12  * <dt><b>License:</b><dd>Read the license.txt file of the jar or visit the
13  * <a HREF="http://www.sapia-oss.org/license.html">license page</a> at the Sapia OSS web site</dd></dt>
14  * </dl>
15  */

16 public class ScopeParser {
17     
18     public static final String JavaDoc COMMA = ",";
19     
20     /**
21      * Parses a comma-delimited list of scope names and returns it as an array.
22      *
23      * @param scopeList a comma-delimited list of scope names.
24      * @return the array of the parsed scope names (with each item in the
25      * array corresponding to a scope name).
26      */

27     public static String JavaDoc[] parse(String JavaDoc scopeList){
28         String JavaDoc[] scopes = StringUtils.split(scopeList, COMMA);
29         for(int i = 0; i < scopes.length; i++){
30             scopes[i] = scopes[i].trim();
31         }
32         return scopes;
33     }
34
35 }
36
Popular Tags