View Javadoc
1   package com.btmatthews.maven.plugins.crx;
2   
3   /*
4    * Copyright 2012 Brian Matthews
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  import org.codehaus.plexus.util.StringUtils;
20  
21  /**
22   * Static helper methods for processing parameters.
23   *
24   * @author <a href="mailto:brian@btmatthews.com">Brian Matthews</a>
25   * @since 1.1.1
26   */
27  public class ParameterUtils {
28      /**
29       * This static helper method splits comma separated lists of directory inclusion and exclusion rules returning
30       * the as a string array.
31       *
32       * @param parameter A comma separated list of directory inclusion and exclusion rules.
33       * @return A string array of the individual inclusion/exclusion rules or {@code null} if the {@code parameter}
34       *         was null or blank.
35       */
36      public static String[] splitParameter(final String parameter) {
37          if (StringUtils.isNotBlank(parameter)) {
38              return StringUtils.stripAll(StringUtils.split(parameter, ","));
39          } else {
40              return null;
41          }
42      }
43  }