Framework Professional Edition Package


com.prosyst.util.beans
Class StringTools

java.lang.Object
  extended by com.prosyst.util.beans.StringTools

public class StringTools
extends java.lang.Object

This class provides some utility methods, used by BeanUtils

Author:
Krasimir Nedkov

Constructor Summary
StringTools()
           
 
Method Summary
static java.lang.String capitalize(java.lang.String lower)
          Capitalizes the first letter of the given string argument.
static java.lang.String decapitalize(java.lang.String upper)
          Decapitalizes the first letter of the given string argument.
static boolean isTrimmedEmpty(java.lang.String str)
          Checks that the given string argument is null or its length after trimming is 0.
static java.lang.String makeGetter(java.lang.String propertyName)
          Constructs a getter method name given a property name.
static java.lang.String makeIs(java.lang.String propertyName)
          Constructs an is method name given a property name.
static java.lang.String makeSetter(java.lang.String propertyName)
          Constructs a setter method name given a property name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringTools

public StringTools()
Method Detail

capitalize

public static java.lang.String capitalize(java.lang.String lower)
Capitalizes the first letter of the given string argument. For example, "value" will become "Value", "valueString" will become "ValueString", "Ready" will stay "Ready" and "READY" will stay "READY".

Parameters:
lower - the initial string. It must not be null and its length after trimming must not be 0
Returns:
the transformed string argument or null if it does not have the required form.

decapitalize

public static java.lang.String decapitalize(java.lang.String upper)
Decapitalizes the first letter of the given string argument. This method also handles the special case when the first and the second (and maybe the next) letters are upper case - then the string is not transformed. For example, "Value" will become "value", "StringValue" will become "stringValue" and "READY" will stay "READY".

Parameters:
upper - the initial string. It must not be null and its length after trimming must not be 0
Returns:
the transformed string argument or null if it does not have the required form.

makeGetter

public static java.lang.String makeGetter(java.lang.String propertyName)
Constructs a getter method name given a property name. It starts with "get", followed by the property name with capitalized first letter. For example, the getter method that corresponds to a property "value" is "getValue".

Parameters:
propertyName - the name of the property. It must not be null and its length after trimming must not be 0.
Returns:
the name of the getter method or null if the given property name does not have the required form.

makeSetter

public static java.lang.String makeSetter(java.lang.String propertyName)
Constructs a setter method name given a property name. It starts with "set", followed by the property name with capitalized first letter. For example, the setter method that corresponds to a property "value" is "setValue".

Parameters:
propertyName - the name of the property. It must not be null and its length after trimming must not be 0.
Returns:
the name of the setter method or null if the given property name does not have the required form.

makeIs

public static java.lang.String makeIs(java.lang.String propertyName)
Constructs an is method name given a property name. It starts with "is", followed by the property name with capitalized first letter. For example, the is method that corresponds to a property "ready" is "isReady".

Parameters:
propertyName - the name of the property. It must not be null and its length after trimming must not be 0.
Returns:
the name of the is method or null if the given property name does not have the required form.

isTrimmedEmpty

public static boolean isTrimmedEmpty(java.lang.String str)
Checks that the given string argument is null or its length after trimming is 0.

Parameters:
str - the string to be tested
Returns:
true if the given argument is null or its length after trimming is 0, false otherwise.

Framework Professional Edition Package


Copyright © 1999-2007 ProSyst Software GmbH. All Rights Reserved