|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.fuin.srcgen4javassist.SgUtils
public final class SgUtils
Some helper for the package.
| Method Summary | |
|---|---|
static void |
addToStringMethod(SgClassPool pool,
SgClass clasz,
java.util.List<SgField> fields)
Creates an toString() method with all fields. |
static void |
checkClassModifiers(int modifiers,
boolean isInterface,
boolean isInnerClass)
Checks if the modifiers are valid for a class. |
static void |
checkConstructorModifiers(int modifiers)
Checks if the modifiers are valid for a constructor. |
static void |
checkFieldModifiers(int modifiers)
Checks if the modifiers are valid for a field. |
static void |
checkMethodModifiers(int modifiers)
Checks if the modifiers are valid for a method. |
static java.lang.String |
concatPackages(java.lang.String package1,
java.lang.String package2)
Merge two packages into one. |
static java.util.List<SgAnnotation> |
createAnnotations(java.lang.annotation.Annotation[] ann)
Create a list of annotations. |
static java.lang.String |
createTypeSignature(java.lang.String methodName,
java.lang.Class<?>[] paramTypes)
Returns the "type" signature of the method. |
static java.lang.String |
firstCharUpper(java.lang.String str)
Converts the first character into upper case. |
static boolean |
isEmpty(java.lang.String str)
Checks if a String is empty ("") or null. |
static java.lang.String |
modifierMatrixToHtml()
Create a simple HTML table for the modifier matrix. |
static java.lang.String |
replace(java.lang.String text,
java.lang.String searchString,
java.lang.String replacement,
int max)
Replaces a String with another String inside a larger String, for the first max values of the search String. |
static int |
toModifiers(java.lang.String modifiers)
Returns a Java "Modifier" value for a list of modifier names. |
static java.lang.String |
uppercaseToUnderscore(java.lang.String str)
Inserts an underscore before every upper case character and returns an all lower case string. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static void checkClassModifiers(int modifiers,
boolean isInterface,
boolean isInnerClass)
IllegalArgumentException is thrown.
modifiers - Modifiers.isInterface - Are the modifiers from an interface?isInnerClass - Is it an inner class?public static void checkFieldModifiers(int modifiers)
IllegalArgumentException is thrown.
modifiers - Modifiers.public static void checkMethodModifiers(int modifiers)
IllegalArgumentException is thrown.
modifiers - Modifiers.public static void checkConstructorModifiers(int modifiers)
IllegalArgumentException is
thrown.
modifiers - Modifiers.public static java.lang.String uppercaseToUnderscore(java.lang.String str)
str - String to convert.
public static java.lang.String firstCharUpper(java.lang.String str)
str - String to convert - Can be null or empty string (In both cases
the unchanged value will be returned).
public static java.lang.String concatPackages(java.lang.String package1,
java.lang.String package2)
package1 - First package - Can also be null or empty.package2 - Second package - Can also be null or empty.
public static void addToStringMethod(SgClassPool pool,
SgClass clasz,
java.util.List<SgField> fields)
toString() method with all fields.
pool - Pool to use.clasz - Class to add the new method to.fields - List of fields to output.public static java.lang.String modifierMatrixToHtml()
public static int toModifiers(java.lang.String modifiers)
modifiers - Modifier names separated by spaces.
public static java.lang.String replace(java.lang.String text,
java.lang.String searchString,
java.lang.String replacement,
int max)
Replaces a String with another String inside a larger String, for the
first max values of the search String.
A null reference passed to this method is a no-op.
StringUtils.replace(null, *, *, *) = null
StringUtils.replace("", *, *, *) = ""
StringUtils.replace("any", null, *, *) = "any"
StringUtils.replace("any", *, null, *) = "any"
StringUtils.replace("any", "", *, *) = "any"
StringUtils.replace("any", *, *, 0) = "any"
StringUtils.replace("abaa", "a", null, -1) = "abaa"
StringUtils.replace("abaa", "a", "", -1) = "b"
StringUtils.replace("abaa", "a", "z", 0) = "abaa"
StringUtils.replace("abaa", "a", "z", 1) = "zbaa"
StringUtils.replace("abaa", "a", "z", 2) = "zbza"
StringUtils.replace("abaa", "a", "z", -1) = "zbzz"
text - text to search and replace in, may be nullsearchString - the String to search for, may be nullreplacement - the String to replace it with, may be nullmax - maximum number of values to replace, or -1 if no
maximum
null if
null String inputpublic static boolean isEmpty(java.lang.String str)
Checks if a String is empty ("") or null.
StringUtils.isEmpty(null) = true
StringUtils.isEmpty("") = true
StringUtils.isEmpty(" ") = false
StringUtils.isEmpty("bob") = false
StringUtils.isEmpty(" bob ") = false
NOTE: This method changed in Lang version 2.0. It no longer trims the String. That functionality is available in isBlank().
str - the String to check, may be null
true if the String is empty or null
public static java.lang.String createTypeSignature(java.lang.String methodName,
java.lang.Class<?>[] paramTypes)
methodName - Name of the method.paramTypes - Argument types.
public static java.util.List<SgAnnotation> createAnnotations(java.lang.annotation.Annotation[] ann)
ann - Java annotation array.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||