/*
 * JBoss, Home of Professional Open Source
 * Copyright 2010, Red Hat, Inc., and individual contributors
 * by the @authors tag. See the copyright.txt in the distribution for a
 * full listing of individual contributors.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */

package org.jboss.shrinkwrap.descriptor.impl.base;

import java.util.Collection;
import java.util.Iterator;

/**
 * String utilities.
 * 
 * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
 * 
 */
public class Strings
{
   /**
    * Capitalize the given String: "input" -> "Input"
    */
   public static String capitalize(final String input)
   {
      if ((input == null) || (input.length() == 0))
      {
         return input;
      }
      return input.substring(0, 1).toUpperCase() + input.substring(1).toLowerCase();
   }

   public static String unquote(final String value)
   {
      String result = null;
      if (value != null)
      {
         result = value.replaceAll("\"(.*)\"", "$1");
      }
      return result;
   }

   public static String enquote(final String value)
   {
      String result = null;
      if (value != null)
      {
         result = "\"" + value + "\"";
      }
      return result;
   }

   public static String join(Collection<?> collection, String delimiter)
   {
      StringBuffer buffer = new StringBuffer();
      Iterator<?> iter = collection.iterator();
      while (iter.hasNext())
      {
         buffer.append(iter.next());
         if (iter.hasNext())
         {
            buffer.append(delimiter);
         }
      }
      return buffer.toString();
   }

   public static boolean isNullOrEmpty(String string)
   {
      return string == null || string.isEmpty();
   }

   public static boolean isTrue(String value)
   {
      return value == null ? false : "true".equalsIgnoreCase(value.trim());
   }

   public static boolean areEqual(String left, String right)
   {
      if (left == null && right == null)
      {
         return true;
      }
      else if (left == null || right == null)
      {
         return false;
      }
      return left.equals(right);
   }

   public static boolean areEqualTrimmed(String left, String right)
   {
      if (left != null && right != null)
      {
         return left.trim().equals(right.trim());
      }
      return areEqual(left, right);
   }

}

@@ -1054,65 +1054,8 @@
 e;%0A%0A
-import java.util.Collection;%0Aimport java.util.Iterator;%0A%0A
 /**%0A
@@ -1170,16 +1170,22 @@
 %0Apublic 
+final 
 class St
@@ -1192,16 +1192,17 @@
 rings%0A%7B%0A
+%0A
    /**%0A 
@@ -1210,1192 +1210,122 @@
   * 
-Capitalize the given String: %22input%22 -%3E %22Input%22%0A    */%0A   public static String capitalize(final String input)%0A   %7B%0A      if ((input == null) %7C%7C (input.length() == 0))%0A      %7B%0A         return input;%0A      %7D%0A      return input.substring(0, 1).toUpperCase() + input.substring(1).toLowerCase();%0A   %7D%0A%0A   public static String unquote(final String value)%0A   %7B%0A      String result = null;%0A      if (value != null)%0A      %7B%0A         result = value.replaceAll(%22%5C%22(.*)%5C%22%22, %22$1%22);%0A      %7D%0A      return result;%0A   %7D%0A%0A   public static String enquote(final String value)%0A   %7B%0A      String result = null;%0A      if (value != null)%0A      %7B%0A         result = %22%5C%22%22 + value + %22%5C%22%22;%0A      %7D%0A      return result;%0A   %7D%0A%0A   public static String join(Collection%3C?%3E collection, String delimiter)%0A   %7B%0A      StringBuffer buffer = new StringBuffer();%0A      Iterator%3C?%3E iter = collection.iterator();%0A      while (iter.hasNext())%0A      %7B%0A         buffer.append(iter.next());%0A         if (iter.hasNext())%0A         %7B%0A            buffer.append(delimiter);%0A         %7D%0A      %7D%0A      return buffer.toString();%0A   %7D%0A%0A   public static boolean isNullOrEmpty(String string)%0A   %7B%0A      return string == null %7C%7C string.isEmpty(
+Internal constructor%0A    */%0A   private Strings()%0A   %7B%0A      throw new UnsupportedOperationException(%22no instances%22
 );%0A 
@@ -1361,16 +1361,22 @@
  isTrue(
+final 
 String v
@@ -1427,535 +1427,61 @@
 e : 
-%22true%22.equalsIgnoreCase(value.trim());%0A   %7D%0A%0A   public static boolean areEqual(String left, String right)%0A   %7B%0A      if (left == null && right == null)%0A      %7B%0A         return true;%0A      %7D%0A      else if (left == null %7C%7C right == null)%0A      %7B%0A         return false;%0A      %7D%0A      return left.equals(right);%0A   %7D%0A%0A   public static boolean areEqualTrimmed(String left, String right)%0A   %7B%0A      if (left != null && right != null)%0A      %7B%0A         return left.trim().equals(right.trim());%0A      %7D%0A      return areEqual(left, right
+Boolean.TRUE.toString().equalsIgnoreCase(value.trim()
 );%0A 

Trim maintenance burden of Strings util class to only what is used