|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.internet2.middleware.grouper.util.GrouperUtil
public class GrouperUtil
utility methods for grouper. Generally these are static methods.
Nested Class Summary | |
---|---|
static interface |
GrouperUtil.FieldValuable
has fieldValue method |
Field Summary | |
---|---|
static java.lang.String |
DATE_FORMAT
string format of dates |
static java.lang.String |
DATE_FORMAT2
string format of dates |
static java.lang.String |
DATE_MINUTES_SECONDS_FORMAT
format including minutes and seconds: yyyy/MM/dd HH:mm:ss |
static java.lang.String |
DATE_MINUTES_SECONDS_NO_SLASH_FORMAT
format including minutes and seconds: yyyyMMdd HH:mm:ss |
static int |
DEFAULT_BUFFER_SIZE
The name says it all. |
static java.lang.String |
EMPTY
The empty String "" . |
static java.lang.Object[] |
EMPTY_OBJECT_ARRAY
An empty immutable Object array. |
static java.lang.String[] |
EMPTY_STRING_ARRAY
An empty immutable String array. |
static int |
INDEX_NOT_FOUND
Represents a failed index search. |
static java.lang.String |
JAVA_IO_TMPDIR
|
static java.lang.String |
LOG_ERROR
|
static int |
NOT_FOUND
special number when a number is not found |
static long |
ONE_GB
The number of bytes in a gigabyte. |
static long |
ONE_KB
The number of bytes in a kilobyte. |
static long |
ONE_MB
The number of bytes in a megabyte. |
static java.lang.String |
PROMPT_KEY_RESET_DATA
prompt key for reset data |
static java.lang.String |
PROMPT_KEY_SCHEMA_EXPORT_ALL_TABLES
prompt key for schema export |
static boolean |
stopPromptingUser
dont prompt while testing etc, but make sure there has been at least one prompt |
static java.util.Map<java.lang.Class<?>,java.util.Set<java.lang.String>> |
stringFieldNames
map of class to the list of fields which are string type |
static java.lang.String |
TIMESTAMP_FILE_FORMAT
string format of dates for file names |
static java.lang.String |
TIMESTAMP_FORMAT
format on screen of config for milestone: yyyy/MM/dd HH:mm:ss.SSS |
static java.lang.String |
TIMESTAMP_NO_SLASH_FORMAT
format on screen of config for milestone: yyyyMMdd HH:mm:ss.SSS |
Constructor Summary | |
---|---|
GrouperUtil()
|
Method Summary | ||
---|---|---|
static java.lang.String |
abbreviate(java.lang.String str,
int maxWidth)
Abbreviates a String using ellipses. |
|
static java.lang.String |
abbreviate(java.lang.String str,
int offset,
int maxWidth)
Abbreviates a String using ellipses. |
|
static
|
addIfNotThere(java.util.Collection<T> list,
java.util.Collection<T> listToAdd)
add each element of listToAdd if it is not already in list |
|
static void |
append(java.lang.StringBuilder result,
java.lang.String separatorIfResultNotEmpty,
java.lang.String stringToAppend)
append and maybe put a separator in there |
|
static boolean |
appendIfNotBlank(java.lang.StringBuilder result,
java.lang.Object theStringOrArrayOrList)
if theString is not blank, apppend it to the result, and if appending, |
|
static boolean |
appendIfNotBlank(java.lang.StringBuilder result,
java.lang.String prefix,
java.lang.Object theStringOrArrayOrList)
if theString is not Blank, apppend it to the result, and if appending, add a prefix (if not null) |
|
static boolean |
appendIfNotBlank(java.lang.StringBuilder result,
java.lang.String prefix,
java.lang.Object theStringOrArrayOrList,
java.lang.String suffix)
if theString is not Blank, apppend it to the result, and if appending, add a prefix and suffix (if not null) |
|
static boolean |
appendIfNotBlank(java.lang.StringBuilder result,
java.lang.String prefix,
java.lang.String prefixIfNotBlank,
java.lang.Object theStringOrArrayOrList,
java.lang.String suffix)
if theString is not Blank, apppend it to the result, and if appending, add a prefix and suffix (if not null) |
|
static java.lang.String |
appendIfNotBlankString(java.lang.String string,
java.lang.String separator,
java.lang.String suffix)
append a string to another string if both not blank, with separator. |
|
static boolean |
appendIfNotEmpty(java.lang.StringBuilder result,
java.lang.Object theStringOrArrayOrList)
if theString is not empty, apppend it to the result, and if appending, |
|
static boolean |
appendIfNotEmpty(java.lang.StringBuilder result,
java.lang.String prefix,
java.lang.Object theStringOrArrayOrList)
if theString is not empty, apppend it to the result, and if appending, add a prefix (if not null) |
|
static boolean |
appendIfNotEmpty(java.lang.StringBuilder result,
java.lang.String prefix,
java.lang.Object theStringOrArrayOrList,
java.lang.String suffix)
if theString is not empty, apppend it to the result, and if appending, add a prefix and suffix (if not null) |
|
static boolean |
appendIfNotEmpty(java.lang.StringBuilder result,
java.lang.String prefix,
java.lang.String prefixIfNotEmpty,
java.lang.Object theStringOrArrayOrList,
java.lang.String suffix)
if theString is not empty, apppend it to the result, and if appending, add a prefix and suffix (if not null) |
|
static java.lang.String |
appendPrefixIfStringNotBlank(java.lang.String prefix,
java.lang.String separator,
java.lang.String string)
append a prefix to another string if both not blank. |
|
static java.lang.String |
argAfter(java.lang.String[] args,
java.lang.String argBefore)
return the arg after the argBefore, or null if not there, or exception if argBefore is not found |
|
static
|
arrayPopOne(T[] array)
Return the zero element of the array, if it exists, null if the array is empty. |
|
static void |
assertion(boolean isTrue,
java.lang.String reason)
If false, throw an assertException, and give a reason |
|
static void |
assignField(java.lang.Class theClass,
java.lang.Object invokeOn,
java.lang.String fieldName,
java.lang.Object dataToAssign,
boolean callOnSupers,
boolean overrideSecurity,
boolean typeCast,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationWithValueOverride)
assign data to a field |
|
static void |
assignField(java.lang.Class theClass,
java.lang.Object invokeOn,
java.lang.String fieldName,
java.lang.Object dataToAssign,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationWithValueOverride)
assign data to a field. |
|
static void |
assignField(java.lang.reflect.Field field,
java.lang.Object invokeOn,
java.lang.Object dataToAssign,
boolean overrideSecurity,
boolean typeCast)
assign data to a field |
|
static void |
assignField(java.lang.reflect.Field field,
java.lang.Object invokeOn,
java.lang.Object dataToAssign,
boolean overrideSecurity,
boolean typeCast,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationWithValueOverride)
assign data to a field |
|
static void |
assignField(java.lang.Object invokeOn,
java.lang.String fieldName,
java.lang.Object dataToAssign)
assign data to a field. |
|
static void |
assignSetter(java.lang.Object invokeOn,
java.lang.String fieldName,
java.lang.Object dataToAssign,
boolean typeCast)
assign data to a setter. |
|
static
|
batchList(java.util.List<T> collection,
int batchSize,
int batchIndex)
retrieve a batch by 0 index. |
|
static int |
batchNumberOfBatches(java.util.Collection<?> collection,
int batchSize)
If batching this is the number of batches |
|
static int |
batchNumberOfBatches(int count,
int batchSize)
If batching this is the number of batches |
|
static java.math.BigDecimal |
bigDecimalObjectValue(java.lang.Object input)
Convert an object to a byte, allow nulls |
|
static java.lang.Boolean |
booleanObjectValue(java.lang.Object object)
get the Boolean value for an object |
|
static boolean |
booleanValue(java.lang.Object object)
get the boolean value for an object, cant be null or blank |
|
static boolean |
booleanValue(java.lang.Object object,
boolean defaultBoolean)
get the boolean value for an object |
|
static java.lang.String |
byteCountToDisplaySize(long size)
Returns a human-readable version of the file size (original is in bytes). |
|
static java.lang.Byte |
byteObjectValue(java.lang.Object input)
Convert an object to a byte, allow nulls |
|
static byte |
byteValue(java.lang.Object input)
convert an object to a byte |
|
static java.lang.Object |
callMethod(java.lang.Class theClass,
java.lang.Object invokeOn,
java.lang.String methodName)
helper method for calling a method with no params (could be in superclass) |
|
static java.lang.Object |
callMethod(java.lang.Class theClass,
java.lang.Object invokeOn,
java.lang.String methodName,
java.lang.Object paramTypesOrArrayOrList,
java.lang.Object paramsOrListOrArray)
helper method for calling a method (could be in superclass) |
|
static java.lang.Object |
callMethod(java.lang.Class theClass,
java.lang.Object invokeOn,
java.lang.String methodName,
java.lang.Object paramTypesOrArrayOrList,
java.lang.Object paramsOrListOrArray,
boolean callOnSupers)
helper method for calling a method |
|
static java.lang.Object |
callMethod(java.lang.Class theClass,
java.lang.Object invokeOn,
java.lang.String methodName,
java.lang.Object paramTypesOrArrayOrList,
java.lang.Object paramsOrListOrArray,
boolean callOnSupers,
boolean overrideSecurity)
helper method for calling a method |
|
static java.lang.Object |
callMethod(java.lang.Class theClass,
java.lang.String methodName)
helper method for calling a static method up the stack. method takes no args (could be in superclass) |
|
static java.lang.Object |
callMethod(java.lang.Class theClass,
java.lang.String methodName,
boolean callOnSupers)
helper method for calling a static method with no params |
|
static java.lang.Object |
callMethod(java.lang.Class theClass,
java.lang.String methodName,
java.lang.Object paramTypesOrArrayOrList,
java.lang.Object paramsOrListOrArray)
helper method for calling a static method up the stack |
|
static java.lang.Object |
callMethod(java.lang.Object invokeOn,
java.lang.String methodName)
helper method for calling a method with no params (could be in superclass), will override security |
|
static java.lang.Object |
callMethodWithMoreParams(java.lang.Object instance,
java.lang.Class<?> theType,
java.lang.String methodName,
java.lang.Object[] params)
call method with more params. |
|
static java.lang.String |
capitalize(java.lang.String str)
Capitalizes a String changing the first letter to title case as per Character.toTitleCase(char) . |
|
static java.lang.Object |
changeToVersion(java.lang.Object input,
java.lang.String newPackage)
convert an object from one version to another |
|
static java.lang.Object |
changeToVersionHelper(java.lang.Object input,
java.lang.String newPackage,
int timeToLive)
convert an object from one version to another |
|
static java.lang.Character |
charObjectValue(java.lang.Object input)
get the Character wrapper value for the input |
|
static char |
charValue(java.lang.Object input)
convert an object to a char |
|
static java.lang.String |
classesString(java.lang.Object object)
print the simple names of a list of classes |
|
static java.lang.ClassLoader |
classLoader()
fast class loader |
|
static java.lang.String |
className(java.lang.Object object)
null safe classname method, gets the unenhanced name |
|
static java.lang.String |
classNameCollection(java.lang.Object object)
null safe classname method, max out at 20 |
|
static
|
clone(T object,
java.util.Set<java.lang.String> fieldsToClone)
clone an object, assign primitives, Strings, maps of string attributes. |
|
static
|
cloneFields(T object,
T result,
java.util.Set<java.lang.String> fieldsToClone)
clone an object, assign primitives, Strings, maps of string attributes. |
|
static
|
cloneValue(T value)
helper method to clone the value of a field. |
|
static void |
closeQuietly(java.sql.Connection connection)
close a connection null safe and dont throw exception |
|
static void |
closeQuietly(java.io.InputStream input)
Unconditionally close an InputStream . |
|
static void |
closeQuietly(java.io.OutputStream output)
Unconditionally close an OutputStream . |
|
static void |
closeQuietly(java.io.Reader input)
Unconditionally close an Reader . |
|
static void |
closeQuietly(java.sql.ResultSet resultSet)
close a resultSet null safe and dont throw exception |
|
static void |
closeQuietly(org.hibernate.Session session)
close a session null safe and dont throw exception |
|
static void |
closeQuietly(java.sql.Statement statement)
close a statement null safe and dont throw exception |
|
static void |
closeQuietly(java.io.Writer writer)
close a writer quietly |
|
static void |
closeQuietly(javax.xml.stream.XMLStreamWriter writer)
close a writer quietly |
|
static
|
collectionPopOne(java.util.Collection<T> collection,
boolean exceptionIfMoreThanOne)
Return the zero element of the list, if it exists, null if the list is empty. |
|
static java.lang.String |
collectionToString(java.util.Collection collection)
convert a set to a string (comma separate) |
|
static int |
compare(java.lang.Comparable first,
java.lang.Comparable second)
compare null safe |
|
static java.util.Set<java.lang.String> |
compareObjectFields(java.lang.Object first,
java.lang.Object second,
java.util.Set<java.lang.String> fieldsToCompare,
java.lang.String mapPrefix)
compare two objects, compare primitives, Strings, maps of string attributes. |
|
static java.net.URL |
computeUrl(java.lang.String resourceName,
boolean canBeNull)
compute a url of a resource |
|
static java.lang.String |
concat(java.lang.String a,
java.lang.String b)
concat two strings |
|
static java.lang.String |
concat(java.lang.String a,
java.lang.String b,
java.lang.String c)
concat strings |
|
static java.lang.String |
concat(java.lang.String a,
java.lang.String b,
java.lang.String c,
java.lang.String d)
concat strings |
|
static java.lang.String |
concat(java.lang.String a,
java.lang.String b,
java.lang.String c,
java.lang.String d,
java.lang.String e)
concat strings |
|
static
|
construct(java.lang.Class<T> theClass,
java.lang.Class[] types,
java.lang.Object[] args)
construct an instance by reflection |
|
static boolean |
contains(java.lang.Object[] array,
java.lang.Object objectToFind)
Checks if the object is in the given array. |
|
static boolean |
contains(java.lang.String str,
char searchChar)
Checks if String contains a search character, handling null . |
|
static boolean |
contains(java.lang.String str,
java.lang.String searchStr)
Checks if String contains a search String, handling null . |
|
static java.lang.String |
convertLongToChar(long theLong)
this method takes a long (less than 62) and converts it to a 1 character string (a-z, A-Z, 0-9) |
|
static java.lang.String |
convertLongToCharSmall(long theLong)
this method takes a long (less than 36) and converts it to a 1 character string (A-Z, 0-9) |
|
static java.lang.String |
convertLongToString(long theLong)
convert a long to a string by converting it to base 62 (26 lower, 26 upper, 10 digits) |
|
static java.lang.String |
convertLongToStringSmall(long theLong)
convert a long to a string by converting it to base 36 (26 upper, 10 digits) |
|
static java.lang.String |
convertMillisToFriendlyString(java.lang.Integer duration)
convert millis to friendly string |
|
static java.lang.String |
convertMillisToFriendlyString(java.lang.Long duration)
convert millis to friendly string |
|
static java.util.Set<edu.internet2.middleware.subject.Source> |
convertSources(java.lang.String sources)
e.g. |
|
static java.util.Set<edu.internet2.middleware.subject.Source> |
convertSources(java.lang.String[] sourceIds)
e.g. |
|
static java.lang.String |
convertSourcesToSqlInString(java.util.Set<edu.internet2.middleware.subject.Source> sources)
Deprecated. moved to @See HibUtils |
|
static void |
copy(java.io.InputStream input,
java.io.Writer output)
Copy bytes from an InputStream to chars on a
Writer using the default character encoding of the platform. |
|
static void |
copy(java.io.InputStream input,
java.io.Writer output,
java.lang.String encoding)
Copy and convert bytes from an InputStream to chars on a
Writer , using the specified encoding. |
|
static int |
copy(java.io.Reader input,
java.io.Writer output)
Copy chars from a Reader to a Writer . |
|
static void |
createParentDirectories(java.io.File file)
Create the parent directories for a file if they do not already exist |
|
static java.lang.Long |
dateLongValue(java.lang.String date)
convert a string date into a long date (e.g. for xml export) |
|
static java.lang.String |
dateStringValue(java.util.Date date)
date object to a string: |
|
static java.lang.String |
dateStringValue(java.lang.Long theDate)
date object to a string: |
|
static java.lang.String |
dateToString(java.util.Date date)
convert a date to a string using the standard web service pattern yyyy/MM/dd HH:mm:ss.SSS Note that HH is 0-23 |
|
static java.util.Date |
dateValue(java.lang.Object inputObject)
Convert an object to a java.util.Date. |
|
static java.lang.String |
dbVersionDescribeDifferences(java.lang.Object theOld,
java.lang.Object theNew,
java.util.Set<java.lang.String> differentFieldNames)
put in english how an object changed |
|
static java.lang.String |
defaultIfBlank(java.lang.String string,
java.lang.String defaultStringIfBlank)
return the string or the other if the first is blank |
|
static java.lang.String |
defaultIfEmpty(java.lang.String str,
java.lang.String defaultStr)
Returns either the passed in String, or if the String is empty or null , the value of defaultStr . |
|
static
|
defaultIfNull(T theValue,
T defaultIfTheValueIsNull)
genericized method to see if first is null, if so then return second, else first. |
|
static java.lang.String |
defaultString(java.lang.String str)
Returns either the passed in String, or if the String is null , an empty String (""). |
|
static java.lang.String |
defaultString(java.lang.String str,
java.lang.String defaultStr)
Returns either the passed in String, or if the String is null , the value of defaultStr . |
|
static void |
deleteFile(java.io.File file)
Delete a file, throw exception if cannot |
|
static java.lang.Double |
doubleObjectValue(java.lang.Object input,
boolean allowNullBlank)
get the Double value of an object |
|
static double |
doubleValue(java.lang.Object input)
get the double value of an object |
|
static double |
doubleValueNoError(java.lang.Object input)
get the double value of an object, do not throw an exception if there is an error |
|
static java.lang.String |
encryptSha(java.lang.String plaintext)
encrypt a message to SHA |
|
static
|
enumValueOfIgnoreCase(java.lang.Class<E> theEnumClass,
java.lang.String string,
boolean exceptionOnNotFound)
do a case-insensitive matching |
|
static
|
enumValueOfIgnoreCase(java.lang.Class<E> theEnumClass,
java.lang.String string,
boolean exceptionOnNotFound,
boolean exceptionIfInvalid)
do a case-insensitive matching |
|
static boolean |
equals(java.lang.Object object1,
java.lang.Object object2)
Compares two objects for equality, where either one or both objects may be null . |
|
static boolean |
equals(java.lang.String first,
java.lang.String second)
null safe string compare |
|
static boolean |
equalsIgnoreCase(java.lang.String str1,
java.lang.String str2)
equalsignorecase |
|
static boolean |
equalsList(java.util.List<?> list1,
java.util.List<?> list2)
see if two lists are deep equals using the equals() method on each item |
|
static java.lang.String |
escapeDoubleQuotes(java.lang.String string)
escape double quotes in javascript |
|
static java.lang.String |
escapeDoubleQuotesForString(java.lang.String string)
escape double quotes in javascript |
|
static java.lang.String |
escapeDoubleQuotesSlashesAndNewlinesForString(java.lang.String string)
escape double quotes in javascript |
|
static java.lang.String |
escapeNewlinesForString(java.lang.String string)
escape double quotes in javascript |
|
static java.lang.String |
escapeSingleQuotes(java.lang.String string)
escape single quotes in javascript |
|
static java.lang.String |
escapeSlashesForString(java.lang.String string)
escape slashes |
|
static java.lang.String |
escapeUrlDecode(java.lang.String string)
unescape url chars (e.g. a space is %20) |
|
static java.lang.String |
escapeUrlEncode(java.lang.String string)
escape url chars (e.g. a # is %23) |
|
static GrouperFuture |
executorServiceSubmit(java.util.concurrent.ExecutorService executorService,
java.util.concurrent.Callable callable)
|
|
static java.lang.String |
extensionFromName(java.lang.String name)
get the extension from name. |
|
static java.lang.reflect.Field |
field(java.lang.Class theClass,
java.lang.String fieldName,
boolean callOnSupers,
boolean throwExceptionIfNotFound)
get a field object for a class, potentially in superclasses |
|
static java.util.Set<java.lang.String> |
fieldNames(java.lang.Class theClass,
java.lang.Class fieldType,
boolean includeStaticFields)
return a set of Strings for a class and type. |
|
static java.util.Set<java.lang.String> |
fieldNames(java.lang.Class theClass,
java.lang.Class superclassToStopAt,
java.lang.Class<?> fieldType,
boolean includeSuperclassToStopAt,
boolean includeStaticFields,
boolean includeFinalFields)
get all field names from a class, including superclasses (if specified) |
|
static java.util.Set<java.lang.String> |
fieldNames(java.lang.Class theClass,
java.lang.Class superclassToStopAt,
java.lang.Class<?> fieldType,
boolean includeSuperclassToStopAt,
boolean includeStaticFields,
boolean includeFinalFields,
java.lang.Class<? extends java.lang.annotation.Annotation> markerAnnotationToIngore)
get all field names from a class, including superclasses (if specified). |
|
static java.util.Set<java.lang.String> |
fieldNames(java.lang.Class theClass,
java.lang.Class superclassToStopAt,
java.lang.Class<? extends java.lang.annotation.Annotation> markerAnnotationToIngore)
get all field names from a class, including superclasses (if specified) (up to and including the specified superclass). ignore a certain marker annotation. |
|
static java.util.Set<java.lang.reflect.Field> |
fields(java.lang.Class theClass,
java.lang.Class superclassToStopAt,
java.lang.Class<? extends java.lang.annotation.Annotation> markerAnnotation,
boolean includeAnnotation)
get all fields from a class, including superclasses (if specified) (up to and including the specified superclass). ignore a certain marker annotation, or only include it. |
|
static java.util.Set<java.lang.reflect.Field> |
fields(java.lang.Class theClass,
java.lang.Class superclassToStopAt,
java.lang.Class fieldType,
boolean includeSuperclassToStopAt,
boolean includeStaticFields,
boolean includeFinalFields,
java.lang.Class<? extends java.lang.annotation.Annotation> markerAnnotation,
boolean includeAnnotation)
get all fields from a class, including superclasses (if specified) |
|
static java.lang.Object |
fieldValue(java.lang.Class theClass,
java.lang.Object invokeOn,
java.lang.String fieldName,
boolean callOnSupers,
boolean overrideSecurity,
boolean considerFieldValuable)
find out a field value |
|
static java.lang.Object |
fieldValue(java.lang.reflect.Field field,
java.lang.Object invokeOn)
get the value of a field, override security if needbe |
|
static java.lang.Object |
fieldValue(java.lang.reflect.Field field,
java.lang.Object invokeOn,
boolean overrideSecurity)
get the value of a field |
|
static java.lang.Object |
fieldValue(java.lang.Object invokeOn,
java.lang.String fieldName)
find out a field value (invoke on supers, override security) |
|
static java.lang.String |
fileCanonicalPath(java.io.File file)
get canonical path of file |
|
static java.io.File |
fileFromResourceName(java.lang.String resourceName)
get a file name from a resource name |
|
static boolean |
findGrouperPropertiesDbMatch(boolean whitelist,
java.lang.String user,
java.lang.String url)
see if there is a grouper properties db match |
|
static java.util.Set<java.lang.String> |
findParentStemNames(java.util.Collection<Group> groups)
if the groups are: a:b:c:d and a:d:r, then return the strings: :, a, a:b, a:b:c, a:d |
|
static java.util.Set<java.lang.String> |
findParentStemNames(java.lang.String objectName)
if the groups are: a:b:c:d, then return the strings: :, a, a:b, a:b:c |
|
static java.lang.String |
fixRelativePath(java.lang.String inPath)
|
|
static java.lang.Float |
floatObjectValue(java.lang.Object input,
boolean allowNullBlank)
get the Float value of an object |
|
static float |
floatValue(java.lang.Object input)
get the float value of an object |
|
static float |
floatValueNoError(java.lang.Object input)
get the float value of an object, do not throw an exception if there is an error |
|
static java.lang.String |
formatNumberWithCommas(java.lang.Long number)
|
|
static java.lang.Class |
forName(java.lang.String origClassName)
Returns the class object. |
|
static java.lang.Object |
get(java.lang.Object arrayOrCollection,
int index)
Get a specific index of an array or collection (note for collections and iterating, it is more efficient to get an iterator and iterate |
|
static java.lang.Throwable |
getCause(java.lang.Throwable throwable)
Introspects the Throwable to obtain the cause. |
|
static java.lang.Throwable |
getCause(java.lang.Throwable throwable,
java.lang.String[] methodNames)
Introspects the Throwable to obtain the cause. |
|
static Stem |
getFirstParentStemOfName(java.lang.String name)
Returns the first existing parent stem of a given name. |
|
static java.lang.String |
getFullStackTrace(java.lang.Throwable throwable)
A way to get the entire nested stack-trace of an throwable. |
|
static org.apache.commons.logging.Log |
getLog(java.lang.Class<?> theClass)
get a logger, and auto-create log dirs if havent done yet |
|
static java.lang.Long |
getMaxLongValue(java.lang.Long... values)
|
|
static java.lang.Long |
getMinLongValue(java.lang.Long... values)
|
|
static java.lang.reflect.Method |
getter(java.lang.Class theClass,
java.lang.String fieldName,
boolean callOnSupers,
boolean throwExceptionIfNotFound)
get a getter method object for a class, potentially in superclasses |
|
static java.lang.reflect.Method |
getterHelper(java.lang.Class theClass,
java.lang.String fieldName,
java.lang.String getterName,
boolean callOnSupers,
boolean throwExceptionIfNotFound)
get a setter method object for a class, potentially in superclasses |
|
static java.lang.String |
getterNameFromPropertyName(java.lang.String propertyName)
generate getBb from bb |
|
static java.util.Set<java.lang.reflect.Method> |
getters(java.lang.Class theClass,
java.lang.Class superclassToStopAt,
java.lang.Class<? extends java.lang.annotation.Annotation> markerAnnotation,
java.lang.Boolean includeAnnotation)
get all getters from a class, including superclasses (if specified) (up to and including the specified superclass). |
|
static java.lang.Throwable[] |
getThrowables(java.lang.Throwable throwable)
Returns the list of Throwable objects in the
exception chain. |
|
static boolean |
hasOption(int options,
int option)
see if options have a specific option by int bits |
|
static java.lang.String |
hostname()
get the hostname of this machine |
|
static char |
incrementChar(char theChar)
increment a character (A-Z then 0-9) |
|
static char[] |
incrementStringInt(char[] string)
Increment a string with A-Z and 0-9 (no lower case so case insensitive apps like windows IE will still work) |
|
static java.lang.String |
indent(java.lang.String string,
boolean failIfTypeNotFound)
this method will indent xml or json. |
|
static int |
indexOf(java.lang.Object[] array,
java.lang.Object objectToFind)
Find the index of the given object in the array. |
|
static int |
indexOf(java.lang.Object[] array,
java.lang.Object objectToFind,
int startIndex)
Find the index of the given object in the array starting at the given index. |
|
static boolean |
injectInException(java.lang.Throwable t,
java.lang.String message)
If we can, inject this into the exception, else return false |
|
static java.lang.Integer |
intObjectValue(java.lang.Object input,
boolean allowNullBlank)
get the Integer value of an object |
|
static int |
intValue(java.lang.Object input)
convert an object to a int |
|
static int |
intValue(java.lang.Object input,
int valueIfNull)
convert an object to a int |
|
static int |
intValueNoError(java.lang.Object input)
get the int value of an object, do not throw an exception if there is an error |
|
static java.lang.Object |
invokeMethod(java.lang.reflect.Method method,
java.lang.Object invokeOn)
Safely invoke a reflection method that takes no args |
|
static java.lang.Object |
invokeMethod(java.lang.reflect.Method method,
java.lang.Object invokeOn,
java.lang.Object paramsOrListOrArray)
Safely invoke a reflection method |
|
static int |
ipInt(java.lang.String ip)
get the ip addres integer from a string ip address |
|
static boolean |
ipOnNetwork(java.lang.String ipString,
java.lang.String networkIpString,
int mask)
see if an ip address is on a network |
|
static boolean |
ipOnNetworks(java.lang.String ipString,
java.lang.String networkIpStrings)
see if an ip address is on a network |
|
static int |
ipReadyForAnd(int ip,
int maskLength)
get the ip address after putting 1's where the subnet mask is not |
|
static boolean |
isAscii(char input)
is ascii char |
|
static boolean |
isBlank(java.lang.Object input)
See if the input is null or if string, if it is empty or blank (whitespace) |
|
static boolean |
isBlank(java.lang.String str)
Checks if a String is whitespace, empty ("") or null. |
|
static boolean |
isEmpty(java.lang.String str)
Checks if a String is empty ("") or null. |
|
static boolean |
isGetter(java.lang.reflect.Method method)
if the method name starts with get, and takes no args, and returns something, then getter |
|
static boolean |
isNestedThrowable(java.lang.Throwable throwable)
Checks whether this Throwable class can store a cause. |
|
static boolean |
isNotBlank(java.lang.String str)
|
|
static boolean |
isPrintGrouperLogsToConsole()
if the grouper logs go to the console or not |
|
static boolean |
isScalar(java.lang.Class<?> type)
see if a class is a scalar (not bean, not array or list, etc) |
|
static boolean |
isSetter(java.lang.reflect.Method method)
if the method name starts with get, and takes no args, and returns something, then getter |
|
static boolean |
isThrowableNested()
Checks if the Throwable class has a getCause method. |
|
static java.util.Iterator |
iterator(java.lang.Object collection)
null safe iterator getter if the type if collection |
|
static java.io.File |
jarFile(java.lang.Class sampleClass,
boolean printError)
get a jar file from a sample class |
|
static java.lang.String |
join(java.util.Iterator iterator,
char separator)
Joins the elements of the provided Iterator into
a single String containing the provided elements. |
|
static java.lang.String |
join(java.util.Iterator iterator,
java.lang.String separator)
Joins the elements of the provided Iterator into
a single String containing the provided elements. |
|
static java.lang.String |
join(java.lang.Object[] array)
Joins the elements of the provided array into a single String containing the provided list of elements. |
|
static java.lang.String |
join(java.lang.Object[] array,
char separator)
Joins the elements of the provided array into a single String containing the provided list of elements. |
|
static java.lang.String |
join(java.lang.Object[] array,
java.lang.String separator)
Joins the elements of the provided array into a single String containing the provided list of elements. |
|
static java.lang.Object |
jsonConvertFrom(java.util.Map<java.lang.String,java.lang.Class<?>> conversionMap,
java.lang.String json)
convert an object from json. |
|
static
|
jsonConvertFrom(java.lang.String json,
java.lang.Class<T> theClass)
convert an object from json. |
|
static java.lang.String |
jsonConvertTo(java.lang.Object object)
convert an object to json. |
|
static java.lang.String |
jsonConvertTo(java.lang.Object object,
boolean includeObjectNameWrapper)
convert an object to json. |
|
static void |
jsonConvertTo(java.lang.Object object,
java.io.Writer writer)
convert an object to json. |
|
static java.lang.String |
jsonConvertToNoWrap(java.lang.Object object)
convert an object to json without wrapping it with the simple class name. |
|
static java.lang.String |
leftPad(java.lang.String str,
int size)
Left pad a String with spaces (' '). |
|
static java.lang.String |
leftPad(java.lang.String str,
int size,
char padChar)
Left pad a String with a specified character. |
|
static java.lang.String |
leftPad(java.lang.String str,
int size,
java.lang.String padStr)
Left pad a String with a specified String. |
|
static int |
length(java.lang.Object arrayOrCollection)
Null safe array length or map |
|
static int |
lengthAscii(java.lang.String input)
find the length of ascii chars (non ascii are counted as two) |
|
static
|
listFromCollection(java.util.Collection<T> collection)
null safe convert collection to list |
|
static
|
listPopOne(java.util.List<T> list)
Return the zero element of the list, if it exists, null if the list is empty. |
|
static
|
listToMap(java.util.List<V> list,
java.lang.Class<K> keyClass,
java.lang.Class<V> valueClass,
java.lang.String keyPropertyName)
turn a list into map |
|
static java.lang.String |
logDirPrint()
print the log dir to the console so the logs are easy to find |
|
static void |
logDirsCreateIfNotDone()
auto-create log dirs if not done yet |
|
static void |
logErrorNextException(org.apache.commons.logging.Log log,
java.lang.Throwable throwable,
int timeToLive)
find a next exception in the stack and log it |
|
static java.lang.Long |
longObjectValue(java.lang.Object input,
boolean allowNullBlank)
get the Long value of an object |
|
static long |
longValue(java.lang.Object input)
convert an object to a long |
|
static long |
longValue(java.lang.Object input,
long valueIfNull)
convert an object to a long |
|
static long |
longValueNoError(java.lang.Object input)
get the long value of an object, do not throw an exception if there is an error |
|
static
|
mapDifferences(java.util.Map<K,V> first,
java.util.Map<K,V> second,
java.util.Set<K> differences,
java.lang.String prefix)
see if two maps are the equivalent (based on number of entries, and the equals() method of the keys and values) |
|
static
|
mapEquals(java.util.Map<K,V> first,
java.util.Map<K,V> second)
see if two maps are the equivalent (based on number of entries, and the equals() method of the keys and values) |
|
static java.lang.String |
mapToString(java.util.Map map)
convert a set to a string (comma separate) |
|
static java.lang.String |
MapToString(java.util.Map map)
Deprecated. use mapToString(map) |
|
static boolean |
matchSqlString(java.lang.String sqlMatcher,
java.lang.String testText)
see if a sql like string matches a real string. |
|
static java.lang.reflect.Method |
method(java.lang.Class<?> theClass,
java.lang.String methodName,
java.lang.Object paramTypesOrArrayOrList,
java.lang.Class<?> superclassToStopAt,
boolean includeSuperclassToStopAt,
boolean isStaticOrInstance,
java.lang.Class<? extends java.lang.annotation.Annotation> markerAnnotation,
boolean includeAnnotation)
get the set of methods |
|
static java.lang.reflect.Method |
methodByName(java.lang.Class<?> theClass,
java.lang.String methodName,
java.lang.Class<?> superclassToStopAt,
boolean includeSuperclassToStopAt,
boolean includeStaticMethods,
boolean exceptionIfNotFound)
simple method to get method names |
|
static java.util.Set<java.lang.String> |
methodNames(java.lang.Class<?> theClass,
java.lang.Class<?> superclassToStopAt,
boolean includeSuperclassToStopAt,
boolean includeStaticMethods)
simple method to get method names |
|
static void |
methodsByNameHelper(java.lang.Class<?> theClass,
java.lang.String methodName,
java.lang.Class<?> superclassToStopAt,
boolean includeSuperclassToStopAt,
boolean includeStaticMethods,
java.lang.Class<? extends java.lang.annotation.Annotation> markerAnnotation,
boolean includeAnnotation,
java.util.Set<java.lang.reflect.Method> methodSet)
get the set of methods |
|
static void |
methodsHelper(java.lang.Class<?> theClass,
java.lang.Class<?> superclassToStopAt,
boolean includeSuperclassToStopAt,
boolean includeStaticMethods,
java.lang.Class<? extends java.lang.annotation.Annotation> markerAnnotation,
boolean includeAnnotation,
java.util.Set<java.lang.reflect.Method> methodSet)
get the set of methods |
|
static void |
mkdirs(java.io.File dir)
Create directories, throw exception if not possible. |
|
static int |
monthInt(java.lang.String mon)
convert a month string to an int (1 indexed). |
|
static boolean |
nameInFolderDirect(java.lang.String name,
java.lang.String folder)
see if a name is in a folder (not subfolder). |
|
static java.io.File |
newFileUniqueName(java.lang.String parentDirName,
java.lang.String namePrefix,
java.lang.String nameSuffix,
boolean createFile)
make a new file in the name prefix dir. |
|
static
|
newInstance(java.lang.Class<T> theClass)
Construct a class |
|
static java.lang.Object |
next(java.lang.Object arrayOrCollection,
java.util.Iterator iterator,
int index)
If array, get the element based on index, if Collection, get it based on iterator. |
|
static
|
nonNull(java.util.Collection<T> list)
make sure a collection is non null. |
|
static
|
nonNull(java.util.List<T> list)
make sure a list is non null. |
|
static
|
nonNull(java.util.Map<K,V> map)
make sure it is non null, if null, then give new map |
|
static
|
nonNull(java.util.Set<T> set)
make sure a list is non null. |
|
static
|
nonNull(T[] array,
java.lang.Class<?> theClass)
make sure a array is non null. |
|
static java.lang.String |
normalizeEmailAddresses(java.lang.String emailAddresses)
take email addresses from a textarea and turn them into semi separated |
|
static boolean |
nullOrBlank(java.lang.Object object)
is an object null or blank |
|
static java.lang.String |
oracleStandardNameFromJava(java.lang.String javaName)
get the oracle underscore name e.g. javaNameHere -> JAVA_NAME_HERE |
|
static long |
packInts(int first,
int second)
pack two ints into a long. |
|
static java.lang.String |
parentStemNameFromName(java.lang.String name)
get the parent stem name from name. |
|
static java.lang.String |
parentStemNameFromName(java.lang.String name,
boolean nullForRoot)
get the parent stem name from name. |
|
static java.lang.String |
prefixOrSuffix(java.lang.String startString,
java.lang.String separator,
boolean isPrefix)
get the prefix or suffix of a string based on a separator |
|
static void |
promptUserAboutChanges(java.lang.String reason,
boolean checkResponse,
java.lang.String dbType,
java.lang.String url,
java.lang.String user)
prompt the user about db changes |
|
static void |
promptUserAboutDbChanges(java.lang.String reason,
boolean checkResponse)
prompt the user about db changes |
|
static java.util.Properties |
propertiesFromFile(java.io.File file,
boolean useCache)
properties from file |
|
static java.util.Properties |
propertiesFromResourceName(java.lang.String resourceName)
read properties from a resource, dont modify the properties returned since they are cached |
|
static java.util.Properties |
propertiesFromResourceName(java.lang.String resourceName,
boolean useCache,
boolean exceptionIfNotExist)
read properties from a resource, dont modify the properties returned since they are cached |
|
static java.util.Properties |
propertiesFromUrl(java.lang.String urlString,
boolean useCache,
boolean useFailSafeCache,
GrouperHtmlFilter grouperHtmlFilter)
this will get the properties from an external url. |
|
static java.util.Map<java.lang.String,java.lang.String> |
propertiesThreadLocalOverrideMap(java.lang.String propertiesFileName)
override map for properties in thread local to be used in a web server or the like, based on property file name |
|
static java.lang.String |
propertiesValue(java.util.Properties properties,
java.util.Map<java.lang.String,java.lang.String> overrideMap,
java.util.Map<java.lang.String,java.lang.String> overrideMap2,
java.lang.String key)
get a value (trimmed to e) from a property file |
|
static java.lang.String |
propertiesValue(java.util.Properties properties,
java.util.Map<java.lang.String,java.lang.String> overrideMap,
java.lang.String key)
get a value (trimmed to e) from a property file |
|
static java.lang.String |
propertiesValue(java.util.Properties properties,
java.lang.String key)
get a value (trimmed to e) from a property file |
|
static boolean |
propertiesValueBoolean(java.util.Properties properties,
java.util.Map<java.lang.String,java.lang.String> overrideMap,
java.util.Map<java.lang.String,java.lang.String> overrideMap2,
java.lang.String propertyName,
boolean defaultValue)
get a boolean property, or the default if cant find |
|
static boolean |
propertiesValueBoolean(java.util.Properties properties,
java.util.Map<java.lang.String,java.lang.String> overrideMap,
java.lang.String propertyName,
boolean defaultValue)
get a boolean property, or the default if cant find |
|
static boolean |
propertiesValueBoolean(java.util.Properties properties,
java.lang.String propertyName,
boolean defaultValue)
get a boolean property, or the default if cant find |
|
static
|
propertyList(java.util.Collection<?> collection,
java.lang.String propertyName,
java.lang.Class<T> fieldType)
take a collection of beans, and go through and get all the values of one of the javabean properties, and make a list of those values. |
|
static java.lang.String |
propertyName(java.lang.reflect.Method method)
If this is a getter or setter, then get the property name |
|
static java.lang.Class |
propertyType(java.lang.Class theClass,
java.lang.String propertyName)
use reflection to get a property type based on getter or setter or field |
|
static java.lang.Object |
propertyValue(java.lang.Object object,
java.lang.String property)
this assumes the property exists, and is a simple property |
|
static java.lang.String |
readFileIntoString(java.io.File file)
|
|
static java.lang.String |
readFileToString(java.io.File file,
java.lang.String encoding)
Reads the contents of a file into a String. |
|
static java.lang.String |
readFromFileIfFile(java.lang.String in,
boolean disableExternalFileLookup)
if the input is a file, read string from file. |
|
static java.lang.String |
readResourceIntoString(java.lang.String resourceName,
boolean allowNull)
|
|
static java.lang.Object |
remove(java.lang.Object arrayOrCollection,
int index)
Remove the iterator or index |
|
static java.lang.Object |
remove(java.lang.Object arrayOrCollection,
java.util.Iterator iterator,
int index)
Remove the iterator or index |
|
static java.lang.String |
repeat(java.lang.String str,
int repeat)
Repeat a String repeat times to form a
new String. |
|
static void |
replace(java.lang.StringBuffer outBuffer,
java.lang.String text,
java.lang.Object searchFor,
java.lang.Object replaceWith)
replace a string or strings from a string, and put the output in a string buffer. |
|
static void |
replace(java.lang.StringBuffer outBuffer,
java.lang.String text,
java.lang.Object searchFor,
java.lang.Object replaceWith,
boolean recurse)
replace a string or strings from a string, and put the output in a string buffer |
|
static java.lang.String |
replace(java.lang.String text,
java.lang.Object searchFor,
java.lang.Object replaceWith)
replace a string or strings from a string, and put the output in a string buffer. |
|
static java.lang.String |
replace(java.lang.String text,
java.lang.Object searchFor,
java.lang.Object replaceWith,
boolean recurse)
replace a string or strings from a string, and put the output in a string buffer |
|
static java.lang.String |
replace(java.lang.String text,
java.lang.Object searchFor,
java.lang.Object replaceWith,
boolean recurse,
boolean removeIfFound)
replace a string or strings from a string, and put the output in a string buffer |
|
static java.lang.String |
replace(java.lang.String text,
java.lang.String repl,
java.lang.String with)
Replaces all occurrences of a String within another String. |
|
static java.lang.String |
replace(java.lang.String text,
java.lang.String repl,
java.lang.String with,
int max)
Replaces a String with another String inside a larger String, for the first max values of the search String. |
|
static void |
replace(java.io.Writer outWriter,
java.lang.String text,
java.lang.Object searchFor,
java.lang.Object replaceWith)
replace a string or strings from a string, and put the output in a string buffer. |
|
static void |
replace(java.io.Writer outWriter,
java.lang.String text,
java.lang.Object searchFor,
java.lang.Object replaceWith,
boolean recurse)
replace a string or strings from a string, and put the output in a string buffer |
|
static java.lang.String |
replaceWhitespaceWithSpace(java.lang.String input)
replace all whitespace with space |
|
static
|
retrieveByProperties(java.util.Collection<T> collection,
java.util.List<java.lang.String> propertyNames,
java.util.List<java.lang.Object> propertyValues)
find an object (or objects) in a collection based on fields |
|
static
|
retrieveByProperty(java.util.Collection<T> collection,
java.lang.String propertyName,
java.lang.Object propertyValue)
find an object (or objects) in a collection based on fields |
|
static java.util.concurrent.ExecutorService |
retrieveExecutorService()
might want to use GrouperCallable with this |
|
static
|
retrieveListByProperties(java.util.Collection<T> collection,
java.util.List<java.lang.String> propertyNames,
java.util.List<java.lang.Object> propertyValues)
find an object (or objects) in a collection based on fields |
|
static
|
retrieveListByProperty(java.util.Collection<T> collection,
java.lang.String propertyName,
java.lang.Object propertyValue)
find an object (or objects) in a collection based on fields |
|
static java.lang.String |
retrievePasswordFromStdin(boolean dontMask,
java.lang.String prompt)
retrieve a password from stdin |
|
static char[] |
retrievePasswordFromStdin(java.io.InputStream in,
java.lang.String prompt)
|
|
static java.beans.PropertyDescriptor |
retrievePropertyDescriptor(java.lang.Object object,
java.lang.String property)
if there is a valid accessible property descriptor, get it |
|
static java.lang.String |
rightPad(java.lang.String str,
int size)
Right pad a String with spaces (' '). |
|
static java.lang.String |
rightPad(java.lang.String str,
int size,
char padChar)
Right pad a String with a specified character. |
|
static java.lang.String |
rightPad(java.lang.String str,
int size,
java.lang.String padStr)
Right pad a String with a specified String. |
|
static void |
rollbackQuietly(java.sql.Connection connection)
rollback a connection quietly |
|
static void |
rollbackQuietly(org.hibernate.Transaction transaction)
rollback a transaction quietly |
|
static void |
saveStringIntoFile(java.io.File file,
java.lang.String contents)
save a string into a file, file does not have to exist |
|
static boolean |
saveStringIntoFile(java.io.File file,
java.lang.String contents,
boolean onlyIfDifferentContents,
boolean ignoreWhitespace)
save a string into a file, file does not have to exist |
|
static
|
setPopOne(java.util.Set<T> set)
Return the zero element of the set, if it exists, null if the list is empty. |
|
static
|
setShorten(java.util.Set<T> theSet,
int maxSize)
shorten a set if it is too long |
|
static java.lang.reflect.Method |
setter(java.lang.Class theClass,
java.lang.String fieldName,
boolean callOnSupers,
boolean throwExceptionIfNotFound)
get a setter method object for a class, potentially in superclasses |
|
static java.lang.reflect.Method |
setterHelper(java.lang.Class theClass,
java.lang.String fieldName,
java.lang.String setterName,
boolean callOnSupers,
boolean throwExceptionIfNotFound)
get a setter method object for a class, potentially in superclasses |
|
static java.lang.String |
setterNameFromPropertyName(java.lang.String propertyName)
generate setBb from bb |
|
static java.util.Set<java.lang.reflect.Method> |
setters(java.lang.Class theClass,
java.lang.Class superclassToStopAt,
java.lang.Class<?> fieldType,
boolean includeSuperclassToStopAt,
java.lang.Class<? extends java.lang.annotation.Annotation> markerAnnotation,
boolean includeAnnotation)
get all setters from a class, including superclasses (if specified) |
|
static java.lang.String |
setToString(java.util.Set set)
convert a set to a string (comma separate) |
|
static java.lang.Short |
shortObjectValue(java.lang.Object input)
get the Short value of an object. |
|
static short |
shortValue(java.lang.Object input)
convert an object to a short |
|
static void |
sleep(long millis)
sleep, if interrupted, throw runtime |
|
static void |
sleepWithStdoutCountdown(int seconds)
|
|
static
|
sortByIds(java.util.Collection<java.lang.String> ids,
java.util.Collection<T> grouperObjects)
based on some ids, sort a set of grouper objects by that |
|
static java.lang.String[] |
split(java.lang.String str)
Splits the provided text into an array, using whitespace as the separator. |
|
static java.lang.String[] |
split(java.lang.String str,
char separatorChar)
Splits the provided text into an array, separator specified. |
|
static java.lang.String[] |
split(java.lang.String str,
java.lang.String separatorChars)
Splits the provided text into an array, separators specified. |
|
static java.lang.String[] |
split(java.lang.String str,
java.lang.String separatorChars,
int max)
Splits the provided text into an array with a maximum length, separators specified. |
|
static java.lang.String[] |
splitByWholeSeparator(java.lang.String str,
java.lang.String separator)
Splits the provided text into an array, separator string specified. |
|
static java.lang.String[] |
splitByWholeSeparator(java.lang.String str,
java.lang.String separator,
int max)
Splits the provided text into an array, separator string specified. |
|
static java.lang.String[] |
splitPreserveAllTokens(java.lang.String str)
Splits the provided text into an array, using whitespace as the separator, preserving all tokens, including empty tokens created by adjacent separators. |
|
static java.lang.String[] |
splitPreserveAllTokens(java.lang.String str,
char separatorChar)
Splits the provided text into an array, separator specified, preserving all tokens, including empty tokens created by adjacent separators. |
|
static java.lang.String[] |
splitPreserveAllTokens(java.lang.String str,
java.lang.String separatorChars)
Splits the provided text into an array, separators specified, preserving all tokens, including empty tokens created by adjacent separators. |
|
static java.lang.String[] |
splitPreserveAllTokens(java.lang.String str,
java.lang.String separatorChars,
int max)
Splits the provided text into an array with a maximum length, separators specified, preserving all tokens, including empty tokens created by adjacent separators. |
|
static java.lang.String[] |
splitTrim(java.lang.String input,
java.lang.String separator)
split a string based on a separator into an array, and trim each entry (see the Commons Util trim() for more details) |
|
static java.lang.String[] |
splitTrim(java.lang.String input,
java.lang.String separator,
boolean treatAdjacentSeparatorsAsOne)
split a string based on a separator into an array, and trim each entry (see the Commons Util trim() for more details) |
|
static java.lang.String |
splitTrimEmailAddresses(java.lang.String emailAddresses)
take email addresses from a textarea and turn them into semi separated |
|
static java.util.List<java.lang.String> |
splitTrimToList(java.lang.String input,
java.lang.String separator)
split a string based on a separator into an array, and trim each entry (see the Commons Util trim() for more details) |
|
static java.util.Set<java.lang.String> |
splitTrimToSet(java.lang.String input,
java.lang.String separator)
split a string based on a separator into an array, and trim each entry (see the Commons Util trim() for more details) |
|
static java.lang.String |
stack()
get a couple of lines of stack |
|
static java.util.Set<java.lang.String> |
stringFieldNames(java.lang.Class<?> theClass)
get the list of string field names based on class, and cache this |
|
static int |
stringLength(java.lang.String string)
string length |
|
static java.util.Date |
stringToDate(java.lang.String dateString)
convert a string to a date using the standard web service pattern Note that HH is 0-23 |
|
static java.util.Date |
stringToDate2(java.lang.String input)
take as input: yyyy/mm/dd yyyy-mm-dd dd-mon-yyyy yyyy/mm/dd hh:mm:ss dd-mon-yyyy hh:mm:ss yyyy/mm/dd hh:mm:ss.SSS dd-mon-yyyy hh:mm:ss.SSS |
|
static java.sql.Timestamp |
stringToTimestamp(java.lang.String input)
convert a string to timestamp based on the following formats: yyyyMMdd yyyy/MM/dd yyyy/MM/dd HH:mm:ss yyyy/MM/dd HH:mm:ss.SSS yyyy/MM/dd HH:mm:ss.SSSSSS |
|
static java.lang.String |
stringValue(java.util.Date date)
convert a date to the standard string yyyymmdd |
|
static java.lang.String |
stringValue(java.lang.Object input)
convert an object to a string |
|
static java.lang.String |
stripEnd(java.lang.String str,
java.lang.String stripChars)
Strips any of a set of characters from the end of a String. |
|
static java.lang.String |
stripLastSlashIfExists(java.lang.String input)
strip the last slash (/ or \) from a string if it exists |
|
static java.lang.String |
stripStart(java.lang.String str,
java.lang.String stripChars)
Strips any of a set of characters from the start of a String. |
|
static java.lang.String |
stripSuffix(java.lang.String string,
java.lang.String suffix)
strip the suffix off |
|
static boolean |
subjectHasAttribute(edu.internet2.middleware.subject.Subject subject,
java.lang.String attributeName)
see if a subject has an attribute |
|
static java.lang.String |
subjectToString(edu.internet2.middleware.subject.Subject subject)
convert a subject to string safely |
|
static java.lang.String |
substituteExpressionLanguage(java.lang.String stringToParse,
java.util.Map<java.lang.String,java.lang.Object> variableMap)
substitute an EL for objects |
|
static java.lang.String |
substituteExpressionLanguage(java.lang.String stringToParse,
java.util.Map<java.lang.String,java.lang.Object> variableMap,
boolean allowStaticClasses)
Deprecated. |
|
static java.lang.String |
substituteExpressionLanguage(java.lang.String stringToParse,
java.util.Map<java.lang.String,java.lang.Object> variableMap,
boolean allowStaticClasses,
boolean silent)
substitute an EL for objects |
|
static java.lang.String |
substituteExpressionLanguage(java.lang.String stringToParse,
java.util.Map<java.lang.String,java.lang.Object> variableMap,
boolean allowStaticClasses,
boolean silent,
boolean lenient)
substitute an EL for objects |
|
static boolean |
substituteStrings(java.util.Map<java.lang.String,java.lang.String> stringSubstituteMap,
java.lang.Object object)
see if the object has string fields with members in them (by memberUuid), and if so, export that member |
|
static java.lang.String |
substringAfter(java.lang.String str,
java.lang.String separator)
Gets the substring after the first occurrence of a separator. |
|
static java.lang.String |
substringAfterLast(java.lang.String str,
java.lang.String separator)
Gets the substring after the last occurrence of a separator. |
|
static java.lang.String |
substringBefore(java.lang.String str,
java.lang.String separator)
Gets the substring before the first occurrence of a separator. |
|
static java.lang.String |
substringBeforeLast(java.lang.String str,
java.lang.String separator)
Gets the substring before the last occurrence of a separator. |
|
static java.lang.String |
suffixAfterChar(java.lang.String input,
char theChar)
return the suffix after a char. |
|
static void |
threadJoin(java.lang.Thread thread)
join a thread |
|
static java.lang.String |
timestampToFileString(java.util.Date timestamp)
Convert a timestamp into a string: yyyy/MM/dd HH:mm:ss.SSS |
|
static java.lang.String |
timestampToString(java.util.Date timestamp)
Convert a timestamp into a string: yyyy/MM/dd HH:mm:ss.SSS |
|
static java.lang.String |
tmpDir()
return the temp dir, either what is in the java env var, or something in the grouper conf |
|
static
|
toArray(java.util.Collection collection,
java.lang.Class<T> theClass)
convert a list into an array of type of theClass |
|
static java.lang.Object |
toArray(java.lang.Object objectOrArrayOrCollection)
Convert a list to an array with the type of the first element e.g. if it is a list of Person objects, then the array is Person[] |
|
static
|
toList(T... objects)
return a list of objects from varargs. |
|
static java.util.List<java.lang.Class<?>> |
toListClasses(java.lang.Class<?>... classes)
convert classes to a list |
|
static java.util.List<java.lang.Object> |
toListObject(java.lang.Object... objects)
return a list of objects from varargs. |
|
static java.util.Map<java.lang.String,java.lang.String> |
toMap(java.lang.String... strings)
turn some strings into a map |
|
static
|
toSet(T... objects)
return a set of objects from varargs. |
|
static
|
toSetObject(T object)
return a set of string |
|
static java.lang.String |
toString(java.util.Collection<edu.internet2.middleware.subject.Source> sources)
convert a collection of sources to a string |
|
static java.lang.String |
toString(java.io.InputStream input,
java.lang.String encoding)
Get the contents of an InputStream as a String. |
|
static java.lang.String |
toStringFields(java.lang.Object object,
java.util.Set<java.lang.String> fieldNames)
print out an object by fields |
|
static java.lang.String |
toStringForLog(java.lang.Object object)
print out various types of objects |
|
static java.lang.String |
toStringForLog(java.lang.Object object,
int maxChars)
print out various types of objects |
|
static java.util.Map<java.lang.String,java.lang.Object> |
toStringObjectMap(java.lang.Object... stringObjects)
turn some strings into a map |
|
static java.lang.String |
toStringSafe(java.lang.Object object)
fail safe toString for Exception blocks, and include the stack if there is a problem with toString() |
|
static java.sql.Timestamp |
toTimestamp(java.lang.Object input)
Convert a string or object to a timestamp (could be string, date, timestamp, etc) yyyymmdd or yyyy/MM/dd or yyyy/MM/dd HH:mm:ss or yyyy/MM/dd HH:mm:ss.SSS or yyyy/MM/dd HH:mm:ss.SSSSSS |
|
static java.lang.String |
trim(java.lang.String str)
trim whitespace from string |
|
static java.lang.String |
trimToEmpty(java.lang.String str)
trim to empty, convert null to empty |
|
static java.lang.String |
truncateAscii(java.lang.String input,
int requiredLength)
find the length of ascii chars (non ascii are counted as three) |
|
static
|
typeCast(java.lang.Object value,
java.lang.Class<T> theClass)
If necessary, convert an object to another type. |
|
static
|
typeCast(java.lang.Object value,
java.lang.Class<T> theClass,
boolean convertNullToDefaultPrimitive,
boolean useNewInstanceHooks)
If necessary, convert an object to another type. |
|
static java.util.Map<java.lang.String,java.lang.Object> |
typeCastStringStringMap(java.util.Map<java.lang.String,java.lang.Object> limitEnvVars)
process a string / string map and convert the values to a string/object map. |
|
static java.lang.Class |
unenhanceClass(java.lang.Class theClass)
if a class is enhanced, get the unenhanced version |
|
static java.lang.String |
uniqueId()
get a unique string identifier based on the current time, this is not globally unique, just unique for as long as this server is running... |
|
static int |
unpackInt(long theLong,
boolean isFirst)
take a long |
|
static boolean |
validEmail(java.lang.String email)
|
|
static void |
waitForInput()
wait for input |
|
static void |
writeStringToFile(java.io.File file,
java.lang.String data,
java.lang.String encoding)
Writes data to a file. |
|
static void |
xmlAttribute(java.io.Writer writer,
java.lang.String attributeName,
java.lang.String attributeValue)
|
|
static java.lang.String |
xmlEscape(java.lang.String input)
Convert an XML string to HTML to display on the screen |
|
static java.lang.String |
xmlEscape(java.lang.String input,
boolean isEscape)
Convert an XML string to HTML to display on the screen |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String LOG_ERROR
public static final long ONE_KB
public static final long ONE_MB
public static final long ONE_GB
public static java.lang.String PROMPT_KEY_SCHEMA_EXPORT_ALL_TABLES
public static java.lang.String PROMPT_KEY_RESET_DATA
public static boolean stopPromptingUser
public static final java.lang.String DATE_FORMAT
public static final java.lang.String TIMESTAMP_FILE_FORMAT
public static final java.lang.String DATE_FORMAT2
public static final java.lang.String DATE_MINUTES_SECONDS_FORMAT
public static final java.lang.String DATE_MINUTES_SECONDS_NO_SLASH_FORMAT
public static final java.lang.String TIMESTAMP_FORMAT
public static final java.lang.String TIMESTAMP_NO_SLASH_FORMAT
public static final int NOT_FOUND
public static final int DEFAULT_BUFFER_SIZE
public static final java.lang.String[] EMPTY_STRING_ARRAY
String
array.
public static final java.lang.Object[] EMPTY_OBJECT_ARRAY
Object
array.
public static final java.lang.String EMPTY
""
.
public static final int INDEX_NOT_FOUND
public static java.util.Map<java.lang.Class<?>,java.util.Set<java.lang.String>> stringFieldNames
public static final java.lang.String JAVA_IO_TMPDIR
Constructor Detail |
---|
public GrouperUtil()
Method Detail |
---|
public static java.lang.String splitTrimEmailAddresses(java.lang.String emailAddresses)
emailAddresses
-
public static java.lang.String normalizeEmailAddresses(java.lang.String emailAddresses)
emailAddresses
- can be whitespace, comma, or semi separated
public static boolean validEmail(java.lang.String email)
email
-
public static boolean subjectHasAttribute(edu.internet2.middleware.subject.Subject subject, java.lang.String attributeName)
subject
- attributeName
-
public static boolean matchSqlString(java.lang.String sqlMatcher, java.lang.String testText)
sqlMatcher
- testText
-
public static <T> java.util.Set<T> setShorten(java.util.Set<T> theSet, int maxSize)
T
- theSet
- maxSize
-
public static java.lang.String formatNumberWithCommas(java.lang.Long number)
number
- e.g. 12345678
public static int compare(java.lang.Comparable first, java.lang.Comparable second)
first
- second
-
public static java.util.Set<edu.internet2.middleware.subject.Source> convertSources(java.lang.String sources)
sources
- is comma separated source id's
public static java.util.Set<edu.internet2.middleware.subject.Source> convertSources(java.lang.String[] sourceIds)
sourceIds
- is an array of source ids
public static java.lang.String escapeSingleQuotes(java.lang.String string)
string
-
public static java.lang.String escapeDoubleQuotes(java.lang.String string)
string
-
public static java.lang.String escapeDoubleQuotesForString(java.lang.String string)
string
-
public static java.lang.String escapeDoubleQuotesSlashesAndNewlinesForString(java.lang.String string)
string
-
public static java.lang.String escapeNewlinesForString(java.lang.String string)
string
-
public static java.lang.String escapeSlashesForString(java.lang.String string)
string
-
@Deprecated public static java.lang.String convertSourcesToSqlInString(java.util.Set<edu.internet2.middleware.subject.Source> sources)
sources
-
public static java.util.Map<java.lang.String,java.lang.String> toMap(java.lang.String... strings)
strings
-
public static java.util.Map<java.lang.String,java.lang.Object> toStringObjectMap(java.lang.Object... stringObjects)
stringObjects
- is an array of String,Object,String,Object etc where the
Strings are the key, and the Object is the value
public static java.lang.String convertMillisToFriendlyString(java.lang.Integer duration)
duration
-
public static java.lang.String convertMillisToFriendlyString(java.lang.Long duration)
duration
-
public static void deleteFile(java.io.File file)
file
- public static java.lang.String argAfter(java.lang.String[] args, java.lang.String argBefore)
args
- argBefore
-
public static void append(java.lang.StringBuilder result, java.lang.String separatorIfResultNotEmpty, java.lang.String stringToAppend)
result
- separatorIfResultNotEmpty
- stringToAppend
- public static java.lang.String byteCountToDisplaySize(long size)
size
- The number of bytes.
public static org.apache.commons.logging.Log getLog(java.lang.Class<?> theClass)
theClass
-
public static void logDirsCreateIfNotDone()
public static void logErrorNextException(org.apache.commons.logging.Log log, java.lang.Throwable throwable, int timeToLive)
log
- loggerthrowable
- exception to look for next exceptions intimeToLive
- so we dont loop foreverpublic static boolean hasOption(int options, int option)
options
- option
-
public static boolean isPrintGrouperLogsToConsole()
public static java.lang.String fileCanonicalPath(java.io.File file)
file
-
public static java.lang.String logDirPrint()
public static java.lang.String suffixAfterChar(java.lang.String input, char theChar)
input
- stringtheChar
- char
public static java.lang.String oracleStandardNameFromJava(java.lang.String javaName)
javaName
- the java convention name
public static <K,V> boolean mapEquals(java.util.Map<K,V> first, java.util.Map<K,V> second)
K
- V
- first
- second
-
public static <K,V> void mapDifferences(java.util.Map<K,V> first, java.util.Map<K,V> second, java.util.Set<K> differences, java.lang.String prefix)
K
- V
- first
- map to check diffssecond
- map to check diffsdifferences
- set of keys (with prefix) of the diffsprefix
- for the entries in the diffs (e.g. "attribute__"public static void sleep(long millis)
millis
- public static void sleepWithStdoutCountdown(int seconds)
seconds
- public static java.lang.String encryptSha(java.lang.String plaintext)
plaintext
-
public static boolean injectInException(java.lang.Throwable t, java.lang.String message)
t
- message
-
public static boolean findGrouperPropertiesDbMatch(boolean whitelist, java.lang.String user, java.lang.String url)
whitelist
- true if whitelist, false if blacklistuser
- is the db userurl
- is the db url
public static void promptUserAboutDbChanges(java.lang.String reason, boolean checkResponse)
reason
- e.g. delete all tablescheckResponse
- true if the response from the user should be checked, or just display the promptpublic static void promptUserAboutChanges(java.lang.String reason, boolean checkResponse, java.lang.String dbType, java.lang.String url, java.lang.String user)
reason
- e.g. delete all tablescheckResponse
- true if the response from the user should be checked, or just display the promptdbType
- should be db or ldapurl
- to check foruser
- user for dbpublic static java.lang.String uniqueId()
public static java.io.File fileFromResourceName(java.lang.String resourceName)
resourceName
- is the classpath location
public static java.net.URL computeUrl(java.lang.String resourceName, boolean canBeNull)
resourceName
- canBeNull
- if cant be null, throw runtime
public static java.lang.ClassLoader classLoader()
public static <T> T[] nonNull(T[] array, java.lang.Class<?> theClass)
T
- array
- theClass
- to make array from
public static java.lang.String stripSuffix(java.lang.String string, java.lang.String suffix)
string
- suffix
-
public static java.lang.String prefixOrSuffix(java.lang.String startString, java.lang.String separator, boolean isPrefix)
startString
- is the string to start withseparator
- is the separator to split onisPrefix
- if thre prefix or suffix should be returned
public static java.lang.String indent(java.lang.String string, boolean failIfTypeNotFound)
this method will indent xml or json. this is for logging or documentations purposes only and should not be used for a production use (since it is not 100% tested or compliant with all constructs like xml CDATA For xml, assumes elements either have text or sub elements, not both. No cdata, nothing fancy. If the input is <a><b><c>hey</c><d><e>there</e></d></b></a> It would output: <a> <b> <c>hey</c> <d> <e>there</e> </d> </b> </a> For , if the input is: {"a":{"b\"b":{"c\\":"d"},"e":"f","g":["h":"i"]}} It would output: { "a":{ "b\"b":{ "c\\":"d" }, "e":"f", "g":[ "h":"i" ] } }
string
- failIfTypeNotFound
-
public static java.lang.String jsonConvertTo(java.lang.Object object)
object
-
public static java.lang.String jsonConvertTo(java.lang.Object object, boolean includeObjectNameWrapper)
object
-
public static java.lang.String jsonConvertToNoWrap(java.lang.Object object)
object
-
public static void jsonConvertTo(java.lang.Object object, java.io.Writer writer)
object
- writer
- public static java.lang.Object jsonConvertFrom(java.util.Map<java.lang.String,java.lang.Class<?>> conversionMap, java.lang.String json)
conversionMap
- is the class simple name to class of objects which are allowed to be brought back.
Note: only the top level object needs to be registeredjson
-
public static <T> T jsonConvertFrom(java.lang.String json, java.lang.Class<T> theClass)
json
- is the json string, not wrapped with a simple class nametheClass
- is the class that the object should be coverted into.
Note: only the top level object needs to be registered
public static java.lang.String extensionFromName(java.lang.String name)
name
-
public static boolean nameInFolderDirect(java.lang.String name, java.lang.String folder)
see if a name is in a folder (not subfolder). if name is a:b:c, and folder is a:b, then yes if a:b:c and a:c, then no if a:b:c and a, then no
name
- folder
-
public static java.lang.Class forName(java.lang.String origClassName)
Returns the class object.
origClassName
- is fully qualified
public static <T> T newInstance(java.lang.Class<T> theClass)
T
- template typetheClass
-
public static java.lang.String parentStemNameFromName(java.lang.String name)
name
-
public static java.lang.String parentStemNameFromName(java.lang.String name, boolean nullForRoot)
name
- nullForRoot
- null for root, otherwise colon
public static java.lang.String defaultIfBlank(java.lang.String string, java.lang.String defaultStringIfBlank)
string
- defaultStringIfBlank
-
public static <T> T defaultIfNull(T theValue, T defaultIfTheValueIsNull)
T
- theValue
- first inputdefaultIfTheValueIsNull
- second input
public static <T> void addIfNotThere(java.util.Collection<T> list, java.util.Collection<T> listToAdd)
T
- list
- to add tolistToAdd
- each element will be added to list, or null if nonepublic static java.lang.String toStringFields(java.lang.Object object, java.util.Set<java.lang.String> fieldNames)
object
- fieldNames
-
public static java.lang.String collectionToString(java.util.Collection collection)
collection
-
public static java.lang.String setToString(java.util.Set set)
set
-
@Deprecated public static java.lang.String MapToString(java.util.Map map)
map
-
public static java.lang.String mapToString(java.util.Map map)
map
-
public static java.lang.String toStringForLog(java.lang.Object object)
object
-
public static java.lang.String toStringForLog(java.lang.Object object, int maxChars)
object
- maxChars
- is the max chars that should be returned (abbreviate if longer), or -1 for any amount
public static int batchNumberOfBatches(int count, int batchSize)
count
- is size of setbatchSize
-
public static int batchNumberOfBatches(java.util.Collection<?> collection, int batchSize)
collection
- batchSize
-
public static java.util.Set<java.lang.String> findParentStemNames(java.util.Collection<Group> groups)
groups
-
public static java.util.Set<java.lang.String> findParentStemNames(java.lang.String objectName)
objectName
-
public static <T> java.util.List<T> batchList(java.util.List<T> collection, int batchSize, int batchIndex)
T
- template typecollection
- batchSize
- batchIndex
-
public static java.lang.String[] splitTrim(java.lang.String input, java.lang.String separator)
input
- is the delimited input to split and trimseparator
- is what to split on
public static java.util.List<java.lang.String> splitTrimToList(java.lang.String input, java.lang.String separator)
input
- is the delimited input to split and trimseparator
- is what to split on
public static java.util.Set<java.lang.String> splitTrimToSet(java.lang.String input, java.lang.String separator)
input
- is the delimited input to split and trimseparator
- is what to split on
public static java.lang.String[] splitTrim(java.lang.String input, java.lang.String separator, boolean treatAdjacentSeparatorsAsOne)
input
- is the delimited input to split and trimseparator
- is what to split ontreatAdjacentSeparatorsAsOne
-
public static java.lang.String escapeUrlEncode(java.lang.String string)
string
- input
public static java.lang.String escapeUrlDecode(java.lang.String string)
string
- input
public static <T> java.util.List<T> nonNull(java.util.List<T> list)
T
- list
-
public static <T> java.util.Collection<T> nonNull(java.util.Collection<T> list)
T
- list
-
public static <T> java.util.Set<T> nonNull(java.util.Set<T> set)
T
- set
-
public static <K,V> java.util.Map<K,V> nonNull(java.util.Map<K,V> map)
K
- key of mapV
- value of mapmap
- is map
public static <T> java.util.List<T> toList(T... objects)
T
- template type of the objectsobjects
-
public static java.util.List<java.lang.Object> toListObject(java.lang.Object... objects)
objects
-
public static java.util.List<java.lang.Class<?>> toListClasses(java.lang.Class<?>... classes)
classes
-
public static <T> java.util.Set<T> toSet(T... objects)
T
- template type of the objectsobjects
-
public static <T> java.util.Set<T> toSetObject(T object)
T
- template type of the objectsobject
-
public static void assertion(boolean isTrue, java.lang.String reason)
isTrue
- reason
- public static void assignField(java.lang.Class theClass, java.lang.Object invokeOn, java.lang.String fieldName, java.lang.Object dataToAssign, boolean callOnSupers, boolean overrideSecurity, boolean typeCast, java.lang.Class<? extends java.lang.annotation.Annotation> annotationWithValueOverride)
theClass
- the class which has the methodinvokeOn
- to call on or null for staticfieldName
- method name to calldataToAssign
- datacallOnSupers
- if static and method not exists, try on supersoverrideSecurity
- true to call on protected or private etc methodstypeCast
- true if we should typecastannotationWithValueOverride
- annotation with value of overridepublic static void assignField(java.lang.Class theClass, java.lang.Object invokeOn, java.lang.String fieldName, java.lang.Object dataToAssign, java.lang.Class<? extends java.lang.annotation.Annotation> annotationWithValueOverride)
theClass
- the class which has the methodinvokeOn
- to call on or null for staticfieldName
- method name to calldataToAssign
- dataannotationWithValueOverride
- annotation with value of overridepublic static void assignField(java.lang.reflect.Field field, java.lang.Object invokeOn, java.lang.Object dataToAssign, boolean overrideSecurity, boolean typeCast)
field
- is the field to assign toinvokeOn
- to call on or null for staticdataToAssign
- dataoverrideSecurity
- true to call on protected or private etc methodstypeCast
- true if we should typecastpublic static java.util.Iterator iterator(java.lang.Object collection)
collection
-
public static int length(java.lang.Object arrayOrCollection)
arrayOrCollection
-
public static java.lang.Object next(java.lang.Object arrayOrCollection, java.util.Iterator iterator, int index)
arrayOrCollection
- iterator
- index
-
public static java.lang.Object remove(java.lang.Object arrayOrCollection, int index)
arrayOrCollection
- index
-
public static java.lang.Object remove(java.lang.Object arrayOrCollection, java.util.Iterator iterator, int index)
arrayOrCollection
- iterator
- index
-
public static java.lang.String classesString(java.lang.Object object)
object
-
public static java.lang.String classNameCollection(java.lang.Object object)
object
-
public static java.lang.String className(java.lang.Object object)
object
-
public static java.lang.Class unenhanceClass(java.lang.Class theClass)
theClass
-
public static void assignField(java.lang.reflect.Field field, java.lang.Object invokeOn, java.lang.Object dataToAssign, boolean overrideSecurity, boolean typeCast, java.lang.Class<? extends java.lang.annotation.Annotation> annotationWithValueOverride)
field
- is the field to assign toinvokeOn
- to call on or null for staticdataToAssign
- dataoverrideSecurity
- true to call on protected or private etc methodstypeCast
- true if we should typecastannotationWithValueOverride
- annotation with value of override, or null if nonepublic static void assignField(java.lang.Object invokeOn, java.lang.String fieldName, java.lang.Object dataToAssign)
invokeOn
- to call on or null for staticfieldName
- method name to calldataToAssign
- datapublic static java.lang.reflect.Field field(java.lang.Class theClass, java.lang.String fieldName, boolean callOnSupers, boolean throwExceptionIfNotFound)
theClass
- fieldName
- callOnSupers
- true if superclasses should be looked in for the fieldthrowExceptionIfNotFound
- will throw runtime exception if not found
public static java.util.Set<java.lang.String> fieldNames(java.lang.Class theClass, java.lang.Class fieldType, boolean includeStaticFields)
theClass
- fieldType
- or null for allincludeStaticFields
-
public static java.lang.String dbVersionDescribeDifferences(java.lang.Object theOld, java.lang.Object theNew, java.util.Set<java.lang.String> differentFieldNames)
theOld
- theNew
- differentFieldNames
-
public static java.util.Set<java.lang.String> fieldNames(java.lang.Class theClass, java.lang.Class superclassToStopAt, java.lang.Class<?> fieldType, boolean includeSuperclassToStopAt, boolean includeStaticFields, boolean includeFinalFields)
theClass
- to look for fields insuperclassToStopAt
- to go up to or null to go up to ObjectfieldType
- is the type of the field to getincludeSuperclassToStopAt
- if we should include the superclassincludeStaticFields
- if include static fieldsincludeFinalFields
- if final fields should be included
public static java.util.Set<java.lang.String> fieldNames(java.lang.Class theClass, java.lang.Class superclassToStopAt, java.lang.Class<?> fieldType, boolean includeSuperclassToStopAt, boolean includeStaticFields, boolean includeFinalFields, java.lang.Class<? extends java.lang.annotation.Annotation> markerAnnotationToIngore)
theClass
- to look for fields insuperclassToStopAt
- to go up to or null to go up to ObjectfieldType
- is the type of the field to getincludeSuperclassToStopAt
- if we should include the superclassincludeStaticFields
- if include static fieldsincludeFinalFields
- if final fields should be includedmarkerAnnotationToIngore
- if this is not null, then if the field has this annotation,
then do not include in list
public static java.util.Set<java.lang.String> fieldNames(java.lang.Class theClass, java.lang.Class superclassToStopAt, java.lang.Class<? extends java.lang.annotation.Annotation> markerAnnotationToIngore)
theClass
- to look for fields insuperclassToStopAt
- to go up to or null to go up to ObjectmarkerAnnotationToIngore
- if this is not null, then if the field has this annotation,
then do not include in list
public static java.util.Set<java.lang.reflect.Field> fields(java.lang.Class theClass, java.lang.Class superclassToStopAt, java.lang.Class fieldType, boolean includeSuperclassToStopAt, boolean includeStaticFields, boolean includeFinalFields, java.lang.Class<? extends java.lang.annotation.Annotation> markerAnnotation, boolean includeAnnotation)
theClass
- to look for fields insuperclassToStopAt
- to go up to or null to go up to ObjectfieldType
- is the type of the field to getincludeSuperclassToStopAt
- if we should include the superclassincludeStaticFields
- if include static fieldsincludeFinalFields
- if final fields should be includedmarkerAnnotation
- if this is not null, then if the field has this annotation,
then do not include in list (if includeAnnotation is false)includeAnnotation
- true if the attribute should be included if annotation is
present, false if exclude
public static java.util.Set<java.lang.reflect.Field> fields(java.lang.Class theClass, java.lang.Class superclassToStopAt, java.lang.Class<? extends java.lang.annotation.Annotation> markerAnnotation, boolean includeAnnotation)
theClass
- to look for fields insuperclassToStopAt
- to go up to or null to go up to ObjectmarkerAnnotation
- if this is not null, then if the field has this annotation,
then do not include in list (if includeAnnotation is false)includeAnnotation
- true if the attribute should be included if annotation is
present, false if exclude
public static java.util.Set<java.lang.String> compareObjectFields(java.lang.Object first, java.lang.Object second, java.util.Set<java.lang.String> fieldsToCompare, java.lang.String mapPrefix)
first
- second
- fieldsToCompare
- mapPrefix
- is the prefix for maps which are compared (e.g. attribute__)
public static <T> T clone(T object, java.util.Set<java.lang.String> fieldsToClone)
T
- templateobject
- fieldsToClone
-
public static <T> void cloneFields(T object, T result, java.util.Set<java.lang.String> fieldsToClone)
T
- templateobject
- result
- fieldsToClone
- public static <T> T cloneValue(T value)
T
- templatevalue
-
public static java.util.Set<java.lang.String> methodNames(java.lang.Class<?> theClass, java.lang.Class<?> superclassToStopAt, boolean includeSuperclassToStopAt, boolean includeStaticMethods)
theClass
- superclassToStopAt
- includeSuperclassToStopAt
- includeStaticMethods
-
public static java.lang.reflect.Method methodByName(java.lang.Class<?> theClass, java.lang.String methodName, java.lang.Class<?> superclassToStopAt, boolean includeSuperclassToStopAt, boolean includeStaticMethods, boolean exceptionIfNotFound)
theClass
- methodName
- superclassToStopAt
- includeSuperclassToStopAt
- includeStaticMethods
- exceptionIfNotFound
-
public static void methodsHelper(java.lang.Class<?> theClass, java.lang.Class<?> superclassToStopAt, boolean includeSuperclassToStopAt, boolean includeStaticMethods, java.lang.Class<? extends java.lang.annotation.Annotation> markerAnnotation, boolean includeAnnotation, java.util.Set<java.lang.reflect.Method> methodSet)
theClass
- superclassToStopAt
- includeSuperclassToStopAt
- includeStaticMethods
- markerAnnotation
- includeAnnotation
- methodSet
- public static java.lang.reflect.Method method(java.lang.Class<?> theClass, java.lang.String methodName, java.lang.Object paramTypesOrArrayOrList, java.lang.Class<?> superclassToStopAt, boolean includeSuperclassToStopAt, boolean isStaticOrInstance, java.lang.Class<? extends java.lang.annotation.Annotation> markerAnnotation, boolean includeAnnotation)
theClass
- methodName
- paramTypesOrArrayOrList
- types of the paramssuperclassToStopAt
- includeSuperclassToStopAt
- isStaticOrInstance
- true if staticmarkerAnnotation
- includeAnnotation
-
public static java.lang.Object fieldValue(java.lang.Class theClass, java.lang.Object invokeOn, java.lang.String fieldName, boolean callOnSupers, boolean overrideSecurity, boolean considerFieldValuable)
theClass
- the class which has the methodinvokeOn
- to call on or null for staticfieldName
- method name to callcallOnSupers
- if static and method not exists, try on supersoverrideSecurity
- true to call on protected or private etc methodsconsiderFieldValuable
- if the FieldValueable interface should be considered
public static java.lang.Object fieldValue(java.lang.reflect.Field field, java.lang.Object invokeOn)
field
- invokeOn
-
public static java.lang.Object fieldValue(java.lang.reflect.Field field, java.lang.Object invokeOn, boolean overrideSecurity)
field
- invokeOn
- overrideSecurity
-
public static java.lang.Object fieldValue(java.lang.Object invokeOn, java.lang.String fieldName)
invokeOn
- to call on or null for staticfieldName
- method name to call
public static java.lang.Object callMethod(java.lang.Class theClass, java.lang.Object invokeOn, java.lang.String methodName)
theClass
- the class which has the methodinvokeOn
- to call on or null for staticmethodName
- method name to call
public static java.lang.Object callMethod(java.lang.Class theClass, java.lang.Object invokeOn, java.lang.String methodName, java.lang.Object paramTypesOrArrayOrList, java.lang.Object paramsOrListOrArray)
theClass
- the class which has the methodinvokeOn
- to call on or null for staticmethodName
- method name to callparamTypesOrArrayOrList
- types of the paramsparamsOrListOrArray
- data
public static java.lang.Object callMethod(java.lang.Class theClass, java.lang.Object invokeOn, java.lang.String methodName, java.lang.Object paramTypesOrArrayOrList, java.lang.Object paramsOrListOrArray, boolean callOnSupers)
theClass
- the class which has the methodinvokeOn
- to call on or null for staticmethodName
- method name to callparamTypesOrArrayOrList
- types of the paramsparamsOrListOrArray
- datacallOnSupers
- if static and method not exists, try on supers
public static <T> T construct(java.lang.Class<T> theClass, java.lang.Class[] types, java.lang.Object[] args)
T
- theClass
- args
- types
-
public static <K,V> java.util.Map<K,V> listToMap(java.util.List<V> list, java.lang.Class<K> keyClass, java.lang.Class<V> valueClass, java.lang.String keyPropertyName)
turn a list into map
K
- is the template of the key of the mapV
- is the template of the value of the maplist
- is the list to convertvalueClass
- type of the result (can typecast)keyClass
- is the type of the key of the mapkeyPropertyName
- name of the javabeans property for the key in the map
public static java.lang.Object callMethod(java.lang.Class theClass, java.lang.Object invokeOn, java.lang.String methodName, java.lang.Object paramTypesOrArrayOrList, java.lang.Object paramsOrListOrArray, boolean callOnSupers, boolean overrideSecurity)
theClass
- the class which has the methodinvokeOn
- to call on or null for staticmethodName
- method name to callparamTypesOrArrayOrList
- types of the paramsparamsOrListOrArray
- datacallOnSupers
- if static and method not exists, try on supersoverrideSecurity
- true to call on protected or private etc methods
public static java.lang.Object invokeMethod(java.lang.reflect.Method method, java.lang.Object invokeOn)
method
- to invokeinvokeOn
- if NO_PARAMS then will not pass in params.
public static java.lang.Object invokeMethod(java.lang.reflect.Method method, java.lang.Object invokeOn, java.lang.Object paramsOrListOrArray)
method
- to invokeinvokeOn
- paramsOrListOrArray
- must be an arg. If null, will pass null.
if NO_PARAMS then will not pass in params.
public static java.lang.Object toArray(java.lang.Object objectOrArrayOrCollection)
objectOrArrayOrCollection
- is a list
public static <T> T[] toArray(java.util.Collection collection, java.lang.Class<T> theClass)
T
- is the type of the arraycollection
- list to converttheClass
- type of array to return
public static java.lang.Object callMethod(java.lang.Class theClass, java.lang.String methodName)
theClass
- the class which has the methodmethodName
- method name to call
public static java.lang.Object callMethod(java.lang.Class theClass, java.lang.String methodName, boolean callOnSupers)
theClass
- the class which has the methodmethodName
- method name to callcallOnSupers
- if we should try the super classes if not exists in this class
public static java.lang.Object callMethod(java.lang.Class theClass, java.lang.String methodName, java.lang.Object paramTypesOrArrayOrList, java.lang.Object paramsOrListOrArray)
theClass
- the class which has the methodmethodName
- method name to callparamTypesOrArrayOrList
- types of the paramsparamsOrListOrArray
- data
public static java.lang.Object callMethod(java.lang.Object invokeOn, java.lang.String methodName)
invokeOn
- instance to invoke onmethodName
- method name to call not exists in this class
public static java.lang.String replace(java.lang.String text, java.lang.Object searchFor, java.lang.Object replaceWith)
text
- string to look insearchFor
- string array to search forreplaceWith
- string array to replace with
public static java.lang.String replace(java.lang.String text, java.lang.Object searchFor, java.lang.Object replaceWith, boolean recurse)
text
- string to look insearchFor
- string array to search forreplaceWith
- string array to replace withrecurse
- if true then do multiple replaces (on the replacements)
public static java.lang.String replace(java.lang.String text, java.lang.Object searchFor, java.lang.Object replaceWith, boolean recurse, boolean removeIfFound)
text
- string to look insearchFor
- string array to search forreplaceWith
- string array to replace withrecurse
- if true then do multiple replaces (on the replacements)removeIfFound
- true if removing from searchFor and replaceWith if found
public static java.lang.String replace(java.lang.String text, java.lang.String repl, java.lang.String with)
Replaces all occurrences of a String within another String.
A null
reference passed to this method is a no-op.
replace(null, *, *) = null replace("", *, *) = "" replace("any", null, *) = "any" replace("any", *, null) = "any" replace("any", "", *) = "any" replace("aba", "a", null) = "aba" replace("aba", "a", "") = "b" replace("aba", "a", "z") = "zbz"
text
- text to search and replace in, may be nullrepl
- the String to search for, may be nullwith
- the String to replace with, may be null
null
if
null String inputreplace(String text, String repl, String with, int max)
public static java.lang.String replace(java.lang.String text, java.lang.String repl, java.lang.String with, 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.
replace(null, *, *, *) = null replace("", *, *, *) = "" replace("any", null, *, *) = "any" replace("any", *, null, *) = "any" replace("any", "", *, *) = "any" replace("any", *, *, 0) = "any" replace("abaa", "a", null, -1) = "abaa" replace("abaa", "a", "", -1) = "b" replace("abaa", "a", "z", 0) = "abaa" replace("abaa", "a", "z", 1) = "zbaa" replace("abaa", "a", "z", 2) = "zbza" replace("abaa", "a", "z", -1) = "zbzz"
text
- text to search and replace in, may be nullrepl
- the String to search for, may be nullwith
- the String to replace 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.
isEmpty(null) = true isEmpty("") = true isEmpty(" ") = false isEmpty("bob") = false 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 nullpublic static void replace(java.lang.StringBuffer outBuffer, java.lang.String text, java.lang.Object searchFor, java.lang.Object replaceWith)
outBuffer
- stringbuffer to write totext
- string to look insearchFor
- string array to search forreplaceWith
- string array to replace withpublic static void replace(java.lang.StringBuffer outBuffer, java.lang.String text, java.lang.Object searchFor, java.lang.Object replaceWith, boolean recurse)
outBuffer
- stringbuffer to write totext
- string to look insearchFor
- string array to search forreplaceWith
- string array to replace withrecurse
- if true then do multiple replaces (on the replacements)public static void replace(java.io.Writer outWriter, java.lang.String text, java.lang.Object searchFor, java.lang.Object replaceWith)
outWriter
- writer to write totext
- string to look insearchFor
- string array to search forreplaceWith
- string array to replace withpublic static void replace(java.io.Writer outWriter, java.lang.String text, java.lang.Object searchFor, java.lang.Object replaceWith, boolean recurse)
outWriter
- writer to write totext
- string to look insearchFor
- string array to search forreplaceWith
- string array to replace withrecurse
- if true then do multiple replaces (on the replacements)public static long packInts(int first, int second)
first
- is first intsecond
- is second int
public static int unpackInt(long theLong, boolean isFirst)
theLong
- to unpackisFirst
- true for first, false for second
public static java.lang.Object get(java.lang.Object arrayOrCollection, int index)
arrayOrCollection
- index
-
public static java.lang.String toString(java.util.Collection<edu.internet2.middleware.subject.Source> sources)
sources
-
public static java.lang.String toStringSafe(java.lang.Object object)
object
-
public static boolean booleanValue(java.lang.Object object)
object
-
public static boolean booleanValue(java.lang.Object object, boolean defaultBoolean)
object
- defaultBoolean
- if object is null or empty
public static java.lang.Boolean booleanObjectValue(java.lang.Object object)
object
-
public static boolean nullOrBlank(java.lang.Object object)
object
-
public static java.lang.reflect.Method getter(java.lang.Class theClass, java.lang.String fieldName, boolean callOnSupers, boolean throwExceptionIfNotFound)
theClass
- fieldName
- callOnSupers
- true if superclasses should be looked in for the getterthrowExceptionIfNotFound
- will throw runtime exception if not found
public static java.lang.reflect.Method getterHelper(java.lang.Class theClass, java.lang.String fieldName, java.lang.String getterName, boolean callOnSupers, boolean throwExceptionIfNotFound)
theClass
- fieldName
- getterName
- name of settercallOnSupers
- true if superclasses should be looked in for the setterthrowExceptionIfNotFound
- will throw runtime exception if not found
public static java.lang.String getterNameFromPropertyName(java.lang.String propertyName)
propertyName
-
public static java.util.Set<java.lang.reflect.Method> getters(java.lang.Class theClass, java.lang.Class superclassToStopAt, java.lang.Class<? extends java.lang.annotation.Annotation> markerAnnotation, java.lang.Boolean includeAnnotation)
theClass
- to look for fields insuperclassToStopAt
- to go up to or null to go up to ObjectmarkerAnnotation
- if this is not null, then if the field has this annotation, then do not
include in list (if includeAnnotation is false)includeAnnotation
- true if the attribute should be included if annotation is present, false if exclude
public static boolean isGetter(java.lang.reflect.Method method)
method
-
public static void assignSetter(java.lang.Object invokeOn, java.lang.String fieldName, java.lang.Object dataToAssign, boolean typeCast)
invokeOn
- to call on or null for staticfieldName
- method name to calldataToAssign
- datatypeCast
- will typecast if true
PropertyDoesNotExistUnchecked
- if not therepublic static boolean isSetter(java.lang.reflect.Method method)
method
-
public static java.lang.reflect.Method setter(java.lang.Class theClass, java.lang.String fieldName, boolean callOnSupers, boolean throwExceptionIfNotFound)
theClass
- fieldName
- callOnSupers
- true if superclasses should be looked in for the setterthrowExceptionIfNotFound
- will throw runtime exception if not found
public static java.lang.reflect.Method setterHelper(java.lang.Class theClass, java.lang.String fieldName, java.lang.String setterName, boolean callOnSupers, boolean throwExceptionIfNotFound)
theClass
- fieldName
- setterName
- name of settercallOnSupers
- true if superclasses should be looked in for the setterthrowExceptionIfNotFound
- will throw runtime exception if not found
public static java.lang.String setterNameFromPropertyName(java.lang.String propertyName)
propertyName
-
public static java.util.Set<java.lang.reflect.Method> setters(java.lang.Class theClass, java.lang.Class superclassToStopAt, java.lang.Class<?> fieldType, boolean includeSuperclassToStopAt, java.lang.Class<? extends java.lang.annotation.Annotation> markerAnnotation, boolean includeAnnotation)
theClass
- to look for fields insuperclassToStopAt
- to go up to or null to go up to ObjectfieldType
- is the type of the field to getincludeSuperclassToStopAt
- if we should include the superclassmarkerAnnotation
- if this is not null, then if the field has this annotation, then do not
include in list (if includeAnnotation is false)includeAnnotation
- true if the attribute should be included if annotation is present, false if exclude
public static java.lang.String propertyName(java.lang.reflect.Method method)
method
-
public static <T> java.util.List<T> propertyList(java.util.Collection<?> collection, java.lang.String propertyName, java.lang.Class<T> fieldType)
T
- collection
- propertyName
- fieldType
-
public static java.lang.Class propertyType(java.lang.Class theClass, java.lang.String propertyName)
theClass
- propertyName
-
public static <T> T typeCast(java.lang.Object value, java.lang.Class<T> theClass)
T
- is template typevalue
- theClass
-
public static java.io.File newFileUniqueName(java.lang.String parentDirName, java.lang.String namePrefix, java.lang.String nameSuffix, boolean createFile)
make a new file in the name prefix dir. If parent dir name is c:\temp and namePrefix is grouperDdl and nameSuffix is sql, then the file will be: c:\temp\grouperDdl_20080721_13_45_43_123.sql If the file exists, it will make a new filename, and create the empty file, and return it
parentDirName
- can be blank for current dirnamePrefix
- the part before the date partnameSuffix
- the last part of file name (can contain dot or will be the extensioncreateFile
- true to create the file
public static java.lang.Long dateLongValue(java.lang.String date)
date
-
public static java.lang.String dateStringValue(java.util.Date date)
date
-
public static java.lang.String dateStringValue(java.lang.Long theDate)
theDate
-
public static java.util.Date dateValue(java.lang.Object inputObject)
Convert an object to a java.util.Date. allows, dates, null, blank, yyyymmdd or yyyymmdd hh24:mm:ss or yyyy/MM/dd HH:mm:ss.SSS
inputObject
- is the String or Date to convert
public static java.util.Date stringToDate2(java.lang.String input)
input
-
public static int monthInt(java.lang.String mon)
mon
-
public static boolean isBlank(java.lang.Object input)
input
-
public static <T> T typeCast(java.lang.Object value, java.lang.Class<T> theClass, boolean convertNullToDefaultPrimitive, boolean useNewInstanceHooks)
T
- is the type to returnvalue
- theClass
- convertNullToDefaultPrimitive
- if the value is null, and theClass is primitive, should we
convert the null to a primitive default valueuseNewInstanceHooks
- if theClass is not recognized, then honor the string "null", "newInstance",
or get a constructor with one param, and call it
public static boolean isScalar(java.lang.Class<?> type)
type
-
public static java.sql.Timestamp toTimestamp(java.lang.Object input)
Convert a string or object to a timestamp (could be string, date, timestamp, etc) yyyymmdd or yyyy/MM/dd or yyyy/MM/dd HH:mm:ss or yyyy/MM/dd HH:mm:ss.SSS or yyyy/MM/dd HH:mm:ss.SSSSSS
input
-
java.lang.RuntimeException
- if invalid formatpublic static java.lang.String stringValue(java.lang.Object input)
input
- is the object to convert
public static java.lang.String timestampToString(java.util.Date timestamp)
timestamp
-
public static java.lang.String timestampToFileString(java.util.Date timestamp)
timestamp
-
public static java.lang.String stringValue(java.util.Date date)
date
-
public static java.sql.Timestamp stringToTimestamp(java.lang.String input)
convert a string to timestamp based on the following formats: yyyyMMdd yyyy/MM/dd yyyy/MM/dd HH:mm:ss yyyy/MM/dd HH:mm:ss.SSS yyyy/MM/dd HH:mm:ss.SSSSSS
input
-
public static java.math.BigDecimal bigDecimalObjectValue(java.lang.Object input)
input
-
public static java.lang.Byte byteObjectValue(java.lang.Object input)
input
-
public static byte byteValue(java.lang.Object input)
input
-
public static java.lang.Double doubleObjectValue(java.lang.Object input, boolean allowNullBlank)
input
- is a number or StringallowNullBlank
- used to default to false, if true, return null if nul inputted
public static double doubleValue(java.lang.Object input)
input
- is a number or String
public static double doubleValueNoError(java.lang.Object input)
input
- is a number or String
public static java.lang.Float floatObjectValue(java.lang.Object input, boolean allowNullBlank)
input
- is a number or StringallowNullBlank
- true if allow null or blank
public static float floatValue(java.lang.Object input)
input
- is a number or String
public static float floatValueNoError(java.lang.Object input)
input
- is a number or String
public static java.lang.Integer intObjectValue(java.lang.Object input, boolean allowNullBlank)
input
- is a number or StringallowNullBlank
- true if convert null or blank to null
public static int intValue(java.lang.Object input)
input
-
public static int intValue(java.lang.Object input, int valueIfNull)
input
- valueIfNull
- is if the input is null or empty, return this value
public static int intValueNoError(java.lang.Object input)
input
- is a number or String
public static java.lang.Long longObjectValue(java.lang.Object input, boolean allowNullBlank)
input
- is a number or StringallowNullBlank
- true if null or blank converts to null
public static long longValue(java.lang.Object input)
input
-
public static long longValue(java.lang.Object input, long valueIfNull)
input
- valueIfNull
- is if the input is null or empty, return this value
public static long longValueNoError(java.lang.Object input)
input
- is a number or String
public static java.lang.Short shortObjectValue(java.lang.Object input)
input
- is a number or String
public static short shortValue(java.lang.Object input)
input
-
public static java.lang.Character charObjectValue(java.lang.Object input)
input
- allow null, return null
public static char charValue(java.lang.Object input)
input
-
public static void createParentDirectories(java.io.File file)
file
- public static void saveStringIntoFile(java.io.File file, java.lang.String contents)
file
- is the file to save tocontents
- is the contents of the filepublic static boolean saveStringIntoFile(java.io.File file, java.lang.String contents, boolean onlyIfDifferentContents, boolean ignoreWhitespace)
file
- is the file to save tocontents
- is the contents of the fileonlyIfDifferentContents
- true if only saving due to different contentsignoreWhitespace
- true to ignore whitespace
public static void writeStringToFile(java.io.File file, java.lang.String data, java.lang.String encoding) throws java.io.IOException
Writes data to a file. The file will be created if it does not exist.
There is no readFileToString method without encoding parameter because the default encoding can differ between platforms and therefore results in inconsistent results.
file
- the file to write.data
- The content to write to the file.encoding
- encoding to use
java.io.IOException
- in case of an I/O error
java.io.UnsupportedEncodingException
- if the encoding is not supported
by the VMpublic static java.lang.String readFileIntoString(java.io.File file)
file
- is the file to read into a string
public static java.lang.String readResourceIntoString(java.lang.String resourceName, boolean allowNull)
resourceName
- is the string resource from classpath to read (e.g. grouper.properties)allowNull
- is true if its ok if the resource is null or if it is not found or blank or whatever.
public static java.lang.String readFileToString(java.io.File file, java.lang.String encoding) throws java.io.IOException
Reads the contents of a file into a String.
There is no readFileToString method without encoding parameter because the default encoding can differ between platforms and therefore results in inconsistent results.
file
- the file to read.encoding
- the encoding to use
java.io.IOException
- in case of an I/O errorpublic static java.lang.String replaceWhitespaceWithSpace(java.lang.String input)
input
-
public static void closeQuietly(java.io.InputStream input)
InputStream
.
Equivalent to InputStream.close()
, except any exceptions will be ignored.
input
- A (possibly null) InputStreampublic static void closeQuietly(java.io.OutputStream output)
OutputStream
.
Equivalent to OutputStream.close()
, except any exceptions will be ignored.
output
- A (possibly null) OutputStreampublic static void closeQuietly(java.io.Reader input)
Reader
.
Equivalent to Reader.close()
, except any exceptions will be ignored.
input
- A (possibly null) Readerpublic static void closeQuietly(java.io.Writer writer)
writer
- public static void closeQuietly(javax.xml.stream.XMLStreamWriter writer)
writer
- public static java.lang.String toString(java.io.InputStream input, java.lang.String encoding) throws java.io.IOException
InputStream
as a String.
input
- the InputStream
to read fromencoding
- The name of a supported character encoding. See the
IANA
Charset Registry for a list of valid encoding types.
String
java.io.IOException
- In case of an I/O problempublic static void copy(java.io.InputStream input, java.io.Writer output, java.lang.String encoding) throws java.io.IOException
InputStream
to chars on a
Writer
, using the specified encoding.
input
- the InputStream
to read fromoutput
- the Writer
to write toencoding
- The name of a supported character encoding. See the
IANA
Charset Registry for a list of valid encoding types.
java.io.IOException
- In case of an I/O problempublic static int copy(java.io.Reader input, java.io.Writer output) throws java.io.IOException
Reader
to a Writer
.
input
- the Reader
to read fromoutput
- the Writer
to write to
java.io.IOException
- In case of an I/O problempublic static void threadJoin(java.lang.Thread thread)
thread
- public static java.lang.String convertLongToChar(long theLong)
theLong
- is the long (less than 62) to convert to a 1 character string
public static java.lang.String convertLongToCharSmall(long theLong)
theLong
- is the long (less than 36) to convert to a 1 character string
public static java.lang.String convertLongToString(long theLong)
theLong
- is the long to convert
public static java.lang.String convertLongToStringSmall(long theLong)
theLong
- is the long to convert
public static char incrementChar(char theChar)
theChar
-
public static char[] incrementStringInt(char[] string)
string
-
public static java.util.Properties propertiesFromResourceName(java.lang.String resourceName)
resourceName
-
public static java.util.Properties propertiesFromUrl(java.lang.String urlString, boolean useCache, boolean useFailSafeCache, GrouperHtmlFilter grouperHtmlFilter)
urlString
- e.g. http://localhost:8090/grouper/test.propertiesuseCache
- if should cache for 2 minutesuseFailSafeCache
- if should use this cache for 1 day if the url cant connectgrouperHtmlFilter
-
public static java.util.Properties propertiesFromFile(java.io.File file, boolean useCache)
file
- useCache
-
public static java.util.Properties propertiesFromResourceName(java.lang.String resourceName, boolean useCache, boolean exceptionIfNotExist)
resourceName
- useCache
- exceptionIfNotExist
-
public static <E extends java.lang.Enum<?>> E enumValueOfIgnoreCase(java.lang.Class<E> theEnumClass, java.lang.String string, boolean exceptionOnNotFound) throws java.lang.RuntimeException
E
- generic typetheEnumClass
- class of the enumstring
- exceptionOnNotFound
- true if exception should be thrown on not found
java.lang.RuntimeException
- if there is a problempublic static <E extends java.lang.Enum<?>> E enumValueOfIgnoreCase(java.lang.Class<E> theEnumClass, java.lang.String string, boolean exceptionOnNotFound, boolean exceptionIfInvalid) throws java.lang.RuntimeException
E
- generic typetheEnumClass
- class of the enumstring
- exceptionOnNotFound
- true if exception should be thrown on not foundexceptionIfInvalid
- if there is a string, but it is invalid, if should throw exception
java.lang.RuntimeException
- if there is a problempublic static java.beans.PropertyDescriptor retrievePropertyDescriptor(java.lang.Object object, java.lang.String property)
object
- property
-
public static java.lang.Object propertyValue(java.lang.Object object, java.lang.String property)
object
- property
-
public static java.lang.String propertiesValue(java.util.Properties properties, java.lang.String key)
properties
- key
-
public static java.lang.String propertiesValue(java.util.Properties properties, java.util.Map<java.lang.String,java.lang.String> overrideMap, java.lang.String key)
properties
- overrideMap
- for testing, to override some properties valueskey
-
public static java.lang.String propertiesValue(java.util.Properties properties, java.util.Map<java.lang.String,java.lang.String> overrideMap, java.util.Map<java.lang.String,java.lang.String> overrideMap2, java.lang.String key)
properties
- overrideMap
- for testing or threadlocal, to override some properties valuesoverrideMap2
- for testing, to provide some properties valueskey
-
public static boolean propertiesValueBoolean(java.util.Properties properties, java.lang.String propertyName, boolean defaultValue)
properties
- propertyName
- defaultValue
-
public static boolean propertiesValueBoolean(java.util.Properties properties, java.util.Map<java.lang.String,java.lang.String> overrideMap, java.lang.String propertyName, boolean defaultValue)
properties
- overrideMap
- for testing to override propertiespropertyName
- defaultValue
-
public static boolean propertiesValueBoolean(java.util.Properties properties, java.util.Map<java.lang.String,java.lang.String> overrideMap, java.util.Map<java.lang.String,java.lang.String> overrideMap2, java.lang.String propertyName, boolean defaultValue)
properties
- overrideMap
- for testing or threadlocal to override propertiesoverrideMap2
- for testing or threadlocal to override propertiespropertyName
- defaultValue
-
public static void closeQuietly(java.sql.Connection connection)
connection
- public static void closeQuietly(org.hibernate.Session session)
session
- public static void closeQuietly(java.sql.Statement statement)
statement
- public static void closeQuietly(java.sql.ResultSet resultSet)
resultSet
- public static java.lang.String hostname()
public static boolean isAscii(char input)
input
-
public static int lengthAscii(java.lang.String input)
input
-
public static void rollbackQuietly(org.hibernate.Transaction transaction)
transaction
- public static void rollbackQuietly(java.sql.Connection connection)
connection
- public static int stringLength(java.lang.String string)
string
-
public static java.lang.String truncateAscii(java.lang.String input, int requiredLength)
input
- is the string to operate onrequiredLength
- length we need the string to be
public static java.lang.String subjectToString(edu.internet2.middleware.subject.Subject subject)
subject
-
public static java.lang.String readFromFileIfFile(java.lang.String in, boolean disableExternalFileLookup)
in
- disableExternalFileLookup
-
public static void mkdirs(java.io.File dir)
dir
- public static java.lang.String fixRelativePath(java.lang.String inPath)
inPath
-
public static boolean equals(java.lang.String first, java.lang.String second)
first
- second
-
public static boolean isBlank(java.lang.String str)
Checks if a String is whitespace, empty ("") or null.
isBlank(null) = true isBlank("") = true isBlank(" ") = true isBlank("bob") = false isBlank(" bob ") = false
str
- the String to check, may be null
true
if the String is null, empty or whitespacepublic static boolean isNotBlank(java.lang.String str)
str
-
public static java.lang.String trim(java.lang.String str)
str
-
public static boolean equalsIgnoreCase(java.lang.String str1, java.lang.String str2)
str1
- str2
-
public static java.lang.String trimToEmpty(java.lang.String str)
str
-
public static java.lang.String abbreviate(java.lang.String str, int maxWidth)
Abbreviates a String using ellipses. This will turn "Now is the time for all good men" into "Now is the time for..."
Specifically:
str
is less than maxWidth
characters
long, return it.(substring(str, 0, max-3) + "...")
.maxWidth
is less than 4
, throw an
IllegalArgumentException
.maxWidth
.StringUtils.abbreviate(null, *) = null StringUtils.abbreviate("", 4) = "" StringUtils.abbreviate("abcdefg", 6) = "abc..." StringUtils.abbreviate("abcdefg", 7) = "abcdefg" StringUtils.abbreviate("abcdefg", 8) = "abcdefg" StringUtils.abbreviate("abcdefg", 4) = "a..." StringUtils.abbreviate("abcdefg", 3) = IllegalArgumentException
str
- the String to check, may be nullmaxWidth
- maximum length of result String, must be at least 4
null
if null String input
java.lang.IllegalArgumentException
- if the width is too smallpublic static java.lang.String abbreviate(java.lang.String str, int offset, int maxWidth)
Abbreviates a String using ellipses. This will turn "Now is the time for all good men" into "...is the time for..."
Works like abbreviate(String, int)
, but allows you to specify
a "left edge" offset. Note that this left edge is not necessarily going to
be the leftmost character in the result, or the first character following the
ellipses, but it will appear somewhere in the result.
In no case will it return a String of length greater than
maxWidth
.
StringUtils.abbreviate(null, *, *) = null StringUtils.abbreviate("", 0, 4) = "" StringUtils.abbreviate("abcdefghijklmno", -1, 10) = "abcdefg..." StringUtils.abbreviate("abcdefghijklmno", 0, 10) = "abcdefg..." StringUtils.abbreviate("abcdefghijklmno", 1, 10) = "abcdefg..." StringUtils.abbreviate("abcdefghijklmno", 4, 10) = "abcdefg..." StringUtils.abbreviate("abcdefghijklmno", 5, 10) = "...fghi..." StringUtils.abbreviate("abcdefghijklmno", 6, 10) = "...ghij..." StringUtils.abbreviate("abcdefghijklmno", 8, 10) = "...ijklmno" StringUtils.abbreviate("abcdefghijklmno", 10, 10) = "...ijklmno" StringUtils.abbreviate("abcdefghijklmno", 12, 10) = "...ijklmno" StringUtils.abbreviate("abcdefghij", 0, 3) = IllegalArgumentException StringUtils.abbreviate("abcdefghij", 5, 6) = IllegalArgumentException
str
- the String to check, may be nulloffset
- left edge of source StringmaxWidth
- maximum length of result String, must be at least 4
null
if null String input
java.lang.IllegalArgumentException
- if the width is too smallpublic static java.lang.String[] split(java.lang.String str)
Splits the provided text into an array, using whitespace as the
separator.
Whitespace is defined by Character.isWhitespace(char)
.
The separator is not included in the returned String array. Adjacent separators are treated as one separator. For more control over the split use the StrTokenizer class.
A null
input String returns null
.
StringUtils.split(null) = null StringUtils.split("") = [] StringUtils.split("abc def") = ["abc", "def"] StringUtils.split("abc def") = ["abc", "def"] StringUtils.split(" abc ") = ["abc"]
str
- the String to parse, may be null
null
if null String inputpublic static java.lang.String[] split(java.lang.String str, char separatorChar)
Splits the provided text into an array, separator specified. This is an alternative to using StringTokenizer.
The separator is not included in the returned String array. Adjacent separators are treated as one separator. For more control over the split use the StrTokenizer class.
A null
input String returns null
.
StringUtils.split(null, *) = null StringUtils.split("", *) = [] StringUtils.split("a.b.c", '.') = ["a", "b", "c"] StringUtils.split("a..b.c", '.') = ["a", "b", "c"] StringUtils.split("a:b:c", '.') = ["a:b:c"] StringUtils.split("a\tb\nc", null) = ["a", "b", "c"] StringUtils.split("a b c", ' ') = ["a", "b", "c"]
str
- the String to parse, may be nullseparatorChar
- the character used as the delimiter,
null
splits on whitespace
null
if null String inputpublic static java.lang.String[] split(java.lang.String str, java.lang.String separatorChars)
Splits the provided text into an array, separators specified. This is an alternative to using StringTokenizer.
The separator is not included in the returned String array. Adjacent separators are treated as one separator. For more control over the split use the StrTokenizer class.
A null
input String returns null
.
A null
separatorChars splits on whitespace.
StringUtils.split(null, *) = null StringUtils.split("", *) = [] StringUtils.split("abc def", null) = ["abc", "def"] StringUtils.split("abc def", " ") = ["abc", "def"] StringUtils.split("abc def", " ") = ["abc", "def"] StringUtils.split("ab:cd:ef", ":") = ["ab", "cd", "ef"]
str
- the String to parse, may be nullseparatorChars
- the characters used as the delimiters,
null
splits on whitespace
null
if null String inputpublic static java.lang.String[] split(java.lang.String str, java.lang.String separatorChars, int max)
Splits the provided text into an array with a maximum length, separators specified.
The separator is not included in the returned String array. Adjacent separators are treated as one separator.
A null
input String returns null
.
A null
separatorChars splits on whitespace.
If more than max
delimited substrings are found, the last
returned string includes all characters after the first max - 1
returned strings (including separator characters).
StringUtils.split(null, *, *) = null StringUtils.split("", *, *) = [] StringUtils.split("ab de fg", null, 0) = ["ab", "cd", "ef"] StringUtils.split("ab de fg", null, 0) = ["ab", "cd", "ef"] StringUtils.split("ab:cd:ef", ":", 0) = ["ab", "cd", "ef"] StringUtils.split("ab:cd:ef", ":", 2) = ["ab", "cd:ef"]
str
- the String to parse, may be nullseparatorChars
- the characters used as the delimiters,
null
splits on whitespacemax
- the maximum number of elements to include in the
array. A zero or negative value implies no limit
null
if null String inputpublic static java.lang.String[] splitByWholeSeparator(java.lang.String str, java.lang.String separator)
Splits the provided text into an array, separator string specified.
The separator(s) will not be included in the returned String array. Adjacent separators are treated as one separator.
A null
input String returns null
.
A null
separator splits on whitespace.
StringUtils.split(null, *) = null StringUtils.split("", *) = [] StringUtils.split("ab de fg", null) = ["ab", "de", "fg"] StringUtils.split("ab de fg", null) = ["ab", "de", "fg"] StringUtils.split("ab:cd:ef", ":") = ["ab", "cd", "ef"] StringUtils.split("abstemiouslyaeiouyabstemiously", "aeiouy") = ["bst", "m", "sl", "bst", "m", "sl"] StringUtils.split("abstemiouslyaeiouyabstemiously", "aeiouy") = ["abstemiously", "abstemiously"]
str
- the String to parse, may be nullseparator
- String containing the String to be used as a delimiter,
null
splits on whitespace
null
if null String was inputpublic static java.lang.String[] splitByWholeSeparator(java.lang.String str, java.lang.String separator, int max)
Splits the provided text into an array, separator string specified.
Returns a maximum of max
substrings.
The separator(s) will not be included in the returned String array. Adjacent separators are treated as one separator.
A null
input String returns null
.
A null
separator splits on whitespace.
StringUtils.splitByWholeSeparator(null, *, *) = null StringUtils.splitByWholeSeparator("", *, *) = [] StringUtils.splitByWholeSeparator("ab de fg", null, 0) = ["ab", "de", "fg"] StringUtils.splitByWholeSeparator("ab de fg", null, 0) = ["ab", "de", "fg"] StringUtils.splitByWholeSeparator("ab:cd:ef", ":", 2) = ["ab", "cd"] StringUtils.splitByWholeSeparator("abstemiouslyaeiouyabstemiously", "aeiouy", 2) = ["bst", "m"] StringUtils.splitByWholeSeparator("abstemiouslyaeiouyabstemiously", "aeiouy", 2) = ["abstemiously", "abstemiously"]
str
- the String to parse, may be nullseparator
- String containing the String to be used as a delimiter,
null
splits on whitespacemax
- the maximum number of elements to include in the returned
array. A zero or negative value implies no limit.
null
if null String was inputpublic static java.lang.String[] splitPreserveAllTokens(java.lang.String str)
Splits the provided text into an array, using whitespace as the
separator, preserving all tokens, including empty tokens created by
adjacent separators. This is an alternative to using StringTokenizer.
Whitespace is defined by Character.isWhitespace(char)
.
The separator is not included in the returned String array. Adjacent separators are treated as separators for empty tokens. For more control over the split use the StrTokenizer class.
A null
input String returns null
.
StringUtils.splitPreserveAllTokens(null) = null StringUtils.splitPreserveAllTokens("") = [] StringUtils.splitPreserveAllTokens("abc def") = ["abc", "def"] StringUtils.splitPreserveAllTokens("abc def") = ["abc", "", "def"] StringUtils.splitPreserveAllTokens(" abc ") = ["", "abc", ""]
str
- the String to parse, may be null
null
if null String inputpublic static java.lang.String[] splitPreserveAllTokens(java.lang.String str, char separatorChar)
Splits the provided text into an array, separator specified, preserving all tokens, including empty tokens created by adjacent separators. This is an alternative to using StringTokenizer.
The separator is not included in the returned String array. Adjacent separators are treated as separators for empty tokens. For more control over the split use the StrTokenizer class.
A null
input String returns null
.
StringUtils.splitPreserveAllTokens(null, *) = null StringUtils.splitPreserveAllTokens("", *) = [] StringUtils.splitPreserveAllTokens("a.b.c", '.') = ["a", "b", "c"] StringUtils.splitPreserveAllTokens("a..b.c", '.') = ["a", "b", "c"] StringUtils.splitPreserveAllTokens("a:b:c", '.') = ["a:b:c"] StringUtils.splitPreserveAllTokens("a\tb\nc", null) = ["a", "b", "c"] StringUtils.splitPreserveAllTokens("a b c", ' ') = ["a", "b", "c"] StringUtils.splitPreserveAllTokens("a b c ", ' ') = ["a", "b", "c", ""] StringUtils.splitPreserveAllTokens("a b c ", ' ') = ["a", "b", "c", "", ""] StringUtils.splitPreserveAllTokens(" a b c", ' ') = ["", a", "b", "c"] StringUtils.splitPreserveAllTokens(" a b c", ' ') = ["", "", a", "b", "c"] StringUtils.splitPreserveAllTokens(" a b c ", ' ') = ["", a", "b", "c", ""]
str
- the String to parse, may be null
separatorChar
- the character used as the delimiter,
null
splits on whitespace
null
if null String inputpublic static java.lang.String[] splitPreserveAllTokens(java.lang.String str, java.lang.String separatorChars)
Splits the provided text into an array, separators specified, preserving all tokens, including empty tokens created by adjacent separators. This is an alternative to using StringTokenizer.
The separator is not included in the returned String array. Adjacent separators are treated as separators for empty tokens. For more control over the split use the StrTokenizer class.
A null
input String returns null
.
A null
separatorChars splits on whitespace.
StringUtils.splitPreserveAllTokens(null, *) = null StringUtils.splitPreserveAllTokens("", *) = [] StringUtils.splitPreserveAllTokens("abc def", null) = ["abc", "def"] StringUtils.splitPreserveAllTokens("abc def", " ") = ["abc", "def"] StringUtils.splitPreserveAllTokens("abc def", " ") = ["abc", "", def"] StringUtils.splitPreserveAllTokens("ab:cd:ef", ":") = ["ab", "cd", "ef"] StringUtils.splitPreserveAllTokens("ab:cd:ef:", ":") = ["ab", "cd", "ef", ""] StringUtils.splitPreserveAllTokens("ab:cd:ef::", ":") = ["ab", "cd", "ef", "", ""] StringUtils.splitPreserveAllTokens("ab::cd:ef", ":") = ["ab", "", cd", "ef"] StringUtils.splitPreserveAllTokens(":cd:ef", ":") = ["", cd", "ef"] StringUtils.splitPreserveAllTokens("::cd:ef", ":") = ["", "", cd", "ef"] StringUtils.splitPreserveAllTokens(":cd:ef:", ":") = ["", cd", "ef", ""]
str
- the String to parse, may be null
separatorChars
- the characters used as the delimiters,
null
splits on whitespace
null
if null String inputpublic static java.lang.String[] splitPreserveAllTokens(java.lang.String str, java.lang.String separatorChars, int max)
Splits the provided text into an array with a maximum length, separators specified, preserving all tokens, including empty tokens created by adjacent separators.
The separator is not included in the returned String array. Adjacent separators are treated as separators for empty tokens. Adjacent separators are treated as one separator.
A null
input String returns null
.
A null
separatorChars splits on whitespace.
If more than max
delimited substrings are found, the last
returned string includes all characters after the first max - 1
returned strings (including separator characters).
StringUtils.splitPreserveAllTokens(null, *, *) = null StringUtils.splitPreserveAllTokens("", *, *) = [] StringUtils.splitPreserveAllTokens("ab de fg", null, 0) = ["ab", "cd", "ef"] StringUtils.splitPreserveAllTokens("ab de fg", null, 0) = ["ab", "cd", "ef"] StringUtils.splitPreserveAllTokens("ab:cd:ef", ":", 0) = ["ab", "cd", "ef"] StringUtils.splitPreserveAllTokens("ab:cd:ef", ":", 2) = ["ab", "cd:ef"] StringUtils.splitPreserveAllTokens("ab de fg", null, 2) = ["ab", " de fg"] StringUtils.splitPreserveAllTokens("ab de fg", null, 3) = ["ab", "", " de fg"] StringUtils.splitPreserveAllTokens("ab de fg", null, 4) = ["ab", "", "", "de fg"]
str
- the String to parse, may be null
separatorChars
- the characters used as the delimiters,
null
splits on whitespacemax
- the maximum number of elements to include in the
array. A zero or negative value implies no limit
null
if null String inputpublic static java.lang.String join(java.lang.Object[] array)
Joins the elements of the provided array into a single String containing the provided list of elements.
No separator is added to the joined String. Null objects or empty strings within the array are represented by empty strings.
StringUtils.join(null) = null StringUtils.join([]) = "" StringUtils.join([null]) = "" StringUtils.join(["a", "b", "c"]) = "abc" StringUtils.join([null, "", "a"]) = "a"
array
- the array of values to join together, may be null
null
if null array inputpublic static java.lang.String join(java.lang.Object[] array, char separator)
Joins the elements of the provided array into a single String containing the provided list of elements.
No delimiter is added before or after the list. Null objects or empty strings within the array are represented by empty strings.
StringUtils.join(null, *) = null StringUtils.join([], *) = "" StringUtils.join([null], *) = "" StringUtils.join(["a", "b", "c"], ';') = "a;b;c" StringUtils.join(["a", "b", "c"], null) = "abc" StringUtils.join([null, "", "a"], ';') = ";;a"
array
- the array of values to join together, may be nullseparator
- the separator character to use
null
if null array inputpublic static java.lang.String join(java.lang.Object[] array, java.lang.String separator)
Joins the elements of the provided array into a single String containing the provided list of elements.
No delimiter is added before or after the list.
A null
separator is the same as an empty String ("").
Null objects or empty strings within the array are represented by
empty strings.
StringUtils.join(null, *) = null StringUtils.join([], *) = "" StringUtils.join([null], *) = "" StringUtils.join(["a", "b", "c"], "--") = "a--b--c" StringUtils.join(["a", "b", "c"], null) = "abc" StringUtils.join(["a", "b", "c"], "") = "abc" StringUtils.join([null, "", "a"], ',') = ",,a"
array
- the array of values to join together, may be nullseparator
- the separator character to use, null treated as ""
null
if null array inputpublic static java.lang.String join(java.util.Iterator iterator, char separator)
Joins the elements of the provided Iterator
into
a single String containing the provided elements.
No delimiter is added before or after the list. Null objects or empty strings within the iteration are represented by empty strings.
See the examples here: join(Object[],char)
.
iterator
- the Iterator
of values to join together, may be nullseparator
- the separator character to use
null
if null iterator inputpublic static java.lang.String join(java.util.Iterator iterator, java.lang.String separator)
Joins the elements of the provided Iterator
into
a single String containing the provided elements.
No delimiter is added before or after the list.
A null
separator is the same as an empty String ("").
See the examples here: join(Object[],String)
.
iterator
- the Iterator
of values to join together, may be nullseparator
- the separator character to use, null treated as ""
null
if null iterator inputpublic static java.lang.String defaultString(java.lang.String str)
Returns either the passed in String,
or if the String is null
, an empty String ("").
StringUtils.defaultString(null) = "" StringUtils.defaultString("") = "" StringUtils.defaultString("bat") = "bat"
str
- the String to check, may be null
null
String.valueOf(Object)
public static java.lang.String defaultString(java.lang.String str, java.lang.String defaultStr)
Returns either the passed in String, or if the String is
null
, the value of defaultStr
.
StringUtils.defaultString(null, "NULL") = "NULL" StringUtils.defaultString("", "NULL") = "" StringUtils.defaultString("bat", "NULL") = "bat"
str
- the String to check, may be nulldefaultStr
- the default String to return
if the input is null
, may be null
null
String.valueOf(Object)
public static java.lang.String defaultIfEmpty(java.lang.String str, java.lang.String defaultStr)
Returns either the passed in String, or if the String is
empty or null
, the value of defaultStr
.
StringUtils.defaultIfEmpty(null, "NULL") = "NULL" StringUtils.defaultIfEmpty("", "NULL") = "NULL" StringUtils.defaultIfEmpty("bat", "NULL") = "bat"
str
- the String to check, may be nulldefaultStr
- the default String to return
if the input is empty ("") or null
, may be null
public static java.lang.String capitalize(java.lang.String str)
Capitalizes a String changing the first letter to title case as
per Character.toTitleCase(char)
. No other letters are changed.
null
input String returns null
.
StringUtils.capitalize(null) = null StringUtils.capitalize("") = "" StringUtils.capitalize("cat") = "Cat" StringUtils.capitalize("cAt") = "CAt"
str
- the String to capitalize, may be null
null
if null String inputpublic static boolean contains(java.lang.String str, char searchChar)
Checks if String contains a search character, handling null
.
This method uses String.indexOf(int)
.
A null
or empty ("") String will return false
.
StringUtils.contains(null, *) = false StringUtils.contains("", *) = false StringUtils.contains("abc", 'a') = true StringUtils.contains("abc", 'z') = false
str
- the String to check, may be nullsearchChar
- the character to find
null
string inputpublic static boolean contains(java.lang.String str, java.lang.String searchStr)
Checks if String contains a search String, handling null
.
This method uses String.indexOf(int)
.
A null
String will return false
.
StringUtils.contains(null, *) = false StringUtils.contains(*, null) = false StringUtils.contains("", "") = true StringUtils.contains("abc", "") = true StringUtils.contains("abc", "a") = true StringUtils.contains("abc", "z") = false
str
- the String to check, may be nullsearchStr
- the String to find, may be null
null
string inputpublic static boolean equals(java.lang.Object object1, java.lang.Object object2)
Compares two objects for equality, where either one or both
objects may be null
.
ObjectUtils.equals(null, null) = true ObjectUtils.equals(null, "") = false ObjectUtils.equals("", null) = false ObjectUtils.equals("", "") = true ObjectUtils.equals(Boolean.TRUE, null) = false ObjectUtils.equals(Boolean.TRUE, "true") = false ObjectUtils.equals(Boolean.TRUE, Boolean.TRUE) = true ObjectUtils.equals(Boolean.TRUE, Boolean.FALSE) = false
object1
- the first object, may be null
object2
- the second object, may be null
true
if the values of both objects are the samepublic static boolean equalsList(java.util.List<?> list1, java.util.List<?> list2)
list1
- list2
-
public static java.lang.String getFullStackTrace(java.lang.Throwable throwable)
A way to get the entire nested stack-trace of an throwable.
throwable
- the Throwable
to be examined
public static java.lang.String substituteExpressionLanguage(java.lang.String stringToParse, java.util.Map<java.lang.String,java.lang.Object> variableMap)
stringToParse
- variableMap
-
@Deprecated public static java.lang.String substituteExpressionLanguage(java.lang.String stringToParse, java.util.Map<java.lang.String,java.lang.Object> variableMap, boolean allowStaticClasses)
stringToParse
- variableMap
- allowStaticClasses
- if true allow static classes not registered with context
public static java.lang.String substituteExpressionLanguage(java.lang.String stringToParse, java.util.Map<java.lang.String,java.lang.Object> variableMap, boolean allowStaticClasses, boolean silent)
stringToParse
- variableMap
- allowStaticClasses
- if true allow static classes not registered with contextsilent
- if silent mode, swallow exceptions (warn), and dont warn when variable not found
public static java.lang.String substituteExpressionLanguage(java.lang.String stringToParse, java.util.Map<java.lang.String,java.lang.Object> variableMap, boolean allowStaticClasses, boolean silent, boolean lenient)
stringToParse
- variableMap
- allowStaticClasses
- if true allow static classes not registered with contextsilent
- if silent mode, swallow exceptions (warn), and dont warn when variable not foundlenient
- false if undefined variables should throw an exception. if lenient is true (default)
then undefined variables are null
public static java.lang.Throwable[] getThrowables(java.lang.Throwable throwable)
Returns the list of Throwable
objects in the
exception chain.
A throwable without cause will return an array containing
one element - the input throwable.
A throwable with one cause will return an array containing
two elements. - the input throwable and the cause throwable.
A null
throwable will return an array size zero.
throwable
- the throwable to inspect, may be null
public static boolean isNestedThrowable(java.lang.Throwable throwable)
Checks whether this Throwable
class can store a cause.
This method does not check whether it actually does store a cause.
throwable
- the Throwable
to examine, may be null
true
if nested otherwise false
public static boolean isThrowableNested()
Checks if the Throwable class has a getCause
method.
This is true for JDK 1.4 and above.
public static java.lang.Throwable getCause(java.lang.Throwable throwable)
Introspects the Throwable
to obtain the cause.
The method searches for methods with specific names that return a
Throwable
object. This will pick up most wrapping exceptions,
including those from JDK 1.4, and
NestableException
.
The default list searched for are:
getCause()
getNextException()
getTargetException()
getException()
getSourceException()
getRootCause()
getCausedByException()
getNested()
In the absence of any such method, the object is inspected for a
detail
field assignable to a Throwable
.
If none of the above is found, returns null
.
throwable
- the throwable to introspect for a cause, may be null
Throwable
,
null
if none found or null throwable inputpublic static java.lang.Throwable getCause(java.lang.Throwable throwable, java.lang.String[] methodNames)
Introspects the Throwable
to obtain the cause.
A null
set of method names means use the default set.
A null
in the set of method names will be ignored.
throwable
- the throwable to introspect for a cause, may be nullmethodNames
- the method names, null treated as default set
Throwable
,
null
if none found or null throwable inputpublic static void copy(java.io.InputStream input, java.io.Writer output) throws java.io.IOException
InputStream
to chars on a
Writer
using the default character encoding of the platform.
This method buffers the input internally, so there is no need to use a
BufferedInputStream
.
This method uses InputStreamReader
.
input
- the InputStream
to read fromoutput
- the Writer
to write to
java.lang.NullPointerException
- if the input or output is null
java.io.IOException
- if an I/O error occurspublic static java.io.File jarFile(java.lang.Class sampleClass, boolean printError)
sampleClass
- printError
- if error should be printed when there is a problem
public static java.lang.String stripLastSlashIfExists(java.lang.String input)
input
-
public static java.lang.String retrievePasswordFromStdin(boolean dontMask, java.lang.String prompt)
dontMask
- prompt
- to print to user
public static final char[] retrievePasswordFromStdin(java.io.InputStream in, java.lang.String prompt) throws java.io.IOException
in
- stream to be used (e.g. System.in)prompt
- The prompt to display to the user.
java.io.IOException
public static java.lang.String stripStart(java.lang.String str, java.lang.String stripChars)
Strips any of a set of characters from the start of a String.
A null
input String returns null
.
An empty string ("") input returns the empty string.
If the stripChars String is null
, whitespace is
stripped as defined by Character.isWhitespace(char)
.
StringUtils.stripStart(null, *) = null StringUtils.stripStart("", *) = "" StringUtils.stripStart("abc", "") = "abc" StringUtils.stripStart("abc", null) = "abc" StringUtils.stripStart(" abc", null) = "abc" StringUtils.stripStart("abc ", null) = "abc " StringUtils.stripStart(" abc ", null) = "abc " StringUtils.stripStart("yxabc ", "xyz") = "abc "
str
- the String to remove characters from, may be nullstripChars
- the characters to remove, null treated as whitespace
null
if null String inputpublic static java.lang.String stripEnd(java.lang.String str, java.lang.String stripChars)
Strips any of a set of characters from the end of a String.
A null
input String returns null
.
An empty string ("") input returns the empty string.
If the stripChars String is null
, whitespace is
stripped as defined by Character.isWhitespace(char)
.
StringUtils.stripEnd(null, *) = null StringUtils.stripEnd("", *) = "" StringUtils.stripEnd("abc", "") = "abc" StringUtils.stripEnd("abc", null) = "abc" StringUtils.stripEnd(" abc", null) = " abc" StringUtils.stripEnd("abc ", null) = "abc" StringUtils.stripEnd(" abc ", null) = " abc" StringUtils.stripEnd(" abcyx", "xyz") = " abc"
str
- the String to remove characters from, may be nullstripChars
- the characters to remove, null treated as whitespace
null
if null String inputpublic static java.lang.String repeat(java.lang.String str, int repeat)
Repeat a String repeat
times to form a
new String.
StringUtils.repeat(null, 2) = null StringUtils.repeat("", 0) = "" StringUtils.repeat("", 2) = "" StringUtils.repeat("a", 3) = "aaa" StringUtils.repeat("ab", 2) = "abab" StringUtils.repeat("a", -2) = ""
str
- the String to repeat, may be nullrepeat
- number of times to repeat str, negative treated as zero
null
if null String inputpublic static java.lang.String rightPad(java.lang.String str, int size)
Right pad a String with spaces (' ').
The String is padded to the size of size
.
StringUtils.rightPad(null, *) = null StringUtils.rightPad("", 3) = " " StringUtils.rightPad("bat", 3) = "bat" StringUtils.rightPad("bat", 5) = "bat " StringUtils.rightPad("bat", 1) = "bat" StringUtils.rightPad("bat", -1) = "bat"
str
- the String to pad out, may be nullsize
- the size to pad to
null
if null String inputpublic static java.lang.String rightPad(java.lang.String str, int size, char padChar)
Right pad a String with a specified character.
The String is padded to the size of size
.
StringUtils.rightPad(null, *, *) = null StringUtils.rightPad("", 3, 'z') = "zzz" StringUtils.rightPad("bat", 3, 'z') = "bat" StringUtils.rightPad("bat", 5, 'z') = "batzz" StringUtils.rightPad("bat", 1, 'z') = "bat" StringUtils.rightPad("bat", -1, 'z') = "bat"
str
- the String to pad out, may be nullsize
- the size to pad topadChar
- the character to pad with
null
if null String inputpublic static java.lang.String rightPad(java.lang.String str, int size, java.lang.String padStr)
Right pad a String with a specified String.
The String is padded to the size of size
.
StringUtils.rightPad(null, *, *) = null StringUtils.rightPad("", 3, "z") = "zzz" StringUtils.rightPad("bat", 3, "yz") = "bat" StringUtils.rightPad("bat", 5, "yz") = "batyz" StringUtils.rightPad("bat", 8, "yz") = "batyzyzy" StringUtils.rightPad("bat", 1, "yz") = "bat" StringUtils.rightPad("bat", -1, "yz") = "bat" StringUtils.rightPad("bat", 5, null) = "bat " StringUtils.rightPad("bat", 5, "") = "bat "
str
- the String to pad out, may be nullsize
- the size to pad topadStr
- the String to pad with, null or empty treated as single space
null
if null String inputpublic static java.lang.String leftPad(java.lang.String str, int size)
Left pad a String with spaces (' ').
The String is padded to the size of size
.
StringUtils.leftPad(null, *) = null StringUtils.leftPad("", 3) = " " StringUtils.leftPad("bat", 3) = "bat" StringUtils.leftPad("bat", 5) = " bat" StringUtils.leftPad("bat", 1) = "bat" StringUtils.leftPad("bat", -1) = "bat"
str
- the String to pad out, may be nullsize
- the size to pad to
null
if null String inputpublic static java.lang.String leftPad(java.lang.String str, int size, char padChar)
Left pad a String with a specified character.
Pad to a size of size
.
StringUtils.leftPad(null, *, *) = null StringUtils.leftPad("", 3, 'z') = "zzz" StringUtils.leftPad("bat", 3, 'z') = "bat" StringUtils.leftPad("bat", 5, 'z') = "zzbat" StringUtils.leftPad("bat", 1, 'z') = "bat" StringUtils.leftPad("bat", -1, 'z') = "bat"
str
- the String to pad out, may be nullsize
- the size to pad topadChar
- the character to pad with
null
if null String inputpublic static java.lang.String leftPad(java.lang.String str, int size, java.lang.String padStr)
Left pad a String with a specified String.
Pad to a size of size
.
StringUtils.leftPad(null, *, *) = null StringUtils.leftPad("", 3, "z") = "zzz" StringUtils.leftPad("bat", 3, "yz") = "bat" StringUtils.leftPad("bat", 5, "yz") = "yzbat" StringUtils.leftPad("bat", 8, "yz") = "yzyzybat" StringUtils.leftPad("bat", 1, "yz") = "bat" StringUtils.leftPad("bat", -1, "yz") = "bat" StringUtils.leftPad("bat", 5, null) = " bat" StringUtils.leftPad("bat", 5, "") = " bat"
str
- the String to pad out, may be nullsize
- the size to pad topadStr
- the String to pad with, null or empty treated as single space
null
if null String inputpublic static java.lang.String substringBefore(java.lang.String str, java.lang.String separator)
Gets the substring before the first occurrence of a separator. The separator is not returned.
A null
string input will return null
.
An empty ("") string input will return the empty string.
A null
separator will return the input string.
StringUtils.substringBefore(null, *) = null StringUtils.substringBefore("", *) = "" StringUtils.substringBefore("abc", "a") = "" StringUtils.substringBefore("abcba", "b") = "a" StringUtils.substringBefore("abc", "c") = "ab" StringUtils.substringBefore("abc", "d") = "abc" StringUtils.substringBefore("abc", "") = "" StringUtils.substringBefore("abc", null) = "abc"
str
- the String to get a substring from, may be nullseparator
- the String to search for, may be null
null
if null String inputpublic static java.lang.String substringAfter(java.lang.String str, java.lang.String separator)
Gets the substring after the first occurrence of a separator. The separator is not returned.
A null
string input will return null
.
An empty ("") string input will return the empty string.
A null
separator will return the empty string if the
input string is not null
.
StringUtils.substringAfter(null, *) = null StringUtils.substringAfter("", *) = "" StringUtils.substringAfter(*, null) = "" StringUtils.substringAfter("abc", "a") = "bc" StringUtils.substringAfter("abcba", "b") = "cba" StringUtils.substringAfter("abc", "c") = "" StringUtils.substringAfter("abc", "d") = "" StringUtils.substringAfter("abc", "") = "abc"
str
- the String to get a substring from, may be nullseparator
- the String to search for, may be null
null
if null String inputpublic static java.lang.String substringBeforeLast(java.lang.String str, java.lang.String separator)
Gets the substring before the last occurrence of a separator. The separator is not returned.
A null
string input will return null
.
An empty ("") string input will return the empty string.
An empty or null
separator will return the input string.
StringUtils.substringBeforeLast(null, *) = null StringUtils.substringBeforeLast("", *) = "" StringUtils.substringBeforeLast("abcba", "b") = "abc" StringUtils.substringBeforeLast("abc", "c") = "ab" StringUtils.substringBeforeLast("a", "a") = "" StringUtils.substringBeforeLast("a", "z") = "a" StringUtils.substringBeforeLast("a", null) = "a" StringUtils.substringBeforeLast("a", "") = "a"
str
- the String to get a substring from, may be nullseparator
- the String to search for, may be null
null
if null String inputpublic static java.lang.String substringAfterLast(java.lang.String str, java.lang.String separator)
Gets the substring after the last occurrence of a separator. The separator is not returned.
A null
string input will return null
.
An empty ("") string input will return the empty string.
An empty or null
separator will return the empty string if
the input string is not null
.
StringUtils.substringAfterLast(null, *) = null StringUtils.substringAfterLast("", *) = "" StringUtils.substringAfterLast(*, "") = "" StringUtils.substringAfterLast(*, null) = "" StringUtils.substringAfterLast("abc", "a") = "bc" StringUtils.substringAfterLast("abcba", "b") = "a" StringUtils.substringAfterLast("abc", "c") = "" StringUtils.substringAfterLast("a", "a") = "" StringUtils.substringAfterLast("a", "z") = ""
str
- the String to get a substring from, may be nullseparator
- the String to search for, may be null
null
if null String inputpublic static void waitForInput()
public static <T> T retrieveByProperties(java.util.Collection<T> collection, java.util.List<java.lang.String> propertyNames, java.util.List<java.lang.Object> propertyValues)
T
- collection
- propertyNames
- propertyValues
-
public static <T> T retrieveByProperty(java.util.Collection<T> collection, java.lang.String propertyName, java.lang.Object propertyValue)
T
- collection
- propertyName
- propertyValue
-
public static Stem getFirstParentStemOfName(java.lang.String name)
name
-
public static <T> java.util.List<T> retrieveListByProperties(java.util.Collection<T> collection, java.util.List<java.lang.String> propertyNames, java.util.List<java.lang.Object> propertyValues)
T
- collection
- propertyNames
- propertyValues
-
public static <T> java.util.List<T> retrieveListByProperty(java.util.Collection<T> collection, java.lang.String propertyName, java.lang.Object propertyValue)
T
- collection
- propertyName
- propertyValue
-
public static <T> T listPopOne(java.util.List<T> list)
T
- list
- is the container of objects to get the first of.
public static <T> T setPopOne(java.util.Set<T> set)
T
- set
- is the container of objects to get the first of.
public static <T> T collectionPopOne(java.util.Collection<T> collection, boolean exceptionIfMoreThanOne)
T
- collection
- is the container of objects to get the first of.exceptionIfMoreThanOne
- will throw exception if there is more than one item in list
public static java.lang.String xmlEscape(java.lang.String input)
input
- is the XML to convertisEscape
- true to escape chars, false to unescape
public static java.lang.String xmlEscape(java.lang.String input, boolean isEscape)
input
- is the XML to convertisEscape
- true to escape chars, false to unescape
public static void xmlAttribute(java.io.Writer writer, java.lang.String attributeName, java.lang.String attributeValue)
writer
- attributeName
- attributeValue
- public static boolean substituteStrings(java.util.Map<java.lang.String,java.lang.String> stringSubstituteMap, java.lang.Object object)
object
- stringSubstituteMap
-
public static java.util.Set<java.lang.String> stringFieldNames(java.lang.Class<?> theClass)
theClass
-
public static boolean appendIfNotBlank(java.lang.StringBuilder result, java.lang.Object theStringOrArrayOrList)
result
- to append to
add a prefix and suffix (if not null)theStringOrArrayOrList
- is a string, array, list, or set of strings
public static java.lang.String appendIfNotBlankString(java.lang.String string, java.lang.String separator, java.lang.String suffix)
append a string to another string if both not blank, with separator. trim to empty everything
string
- separator
- suffix
-
public static java.lang.String appendPrefixIfStringNotBlank(java.lang.String prefix, java.lang.String separator, java.lang.String string)
append a prefix to another string if both not blank. trim to empty everything i.e. appendPrefixIfStringNotBlank("[]", " - ", "a") returns [] - a i.e. appendPrefixIfStringNotBlank("", " - ", "a") returns a i.e. appendPrefixIfStringNotBlank("[]", " - ", "") returns "" i.e. appendPrefixIfStringNotBlank("", " - ", "") returns ""
prefix
- separator
- string
-
public static boolean appendIfNotBlank(java.lang.StringBuilder result, java.lang.String prefix, java.lang.Object theStringOrArrayOrList)
result
- to append toprefix
- theStringOrArrayOrList
- is a string, array, list, or set of strings
public static boolean appendIfNotBlank(java.lang.StringBuilder result, java.lang.String prefix, java.lang.Object theStringOrArrayOrList, java.lang.String suffix)
result
- to append to, assumed to be not nullprefix
- theStringOrArrayOrList
- is a string, array, list, or set of stringssuffix
-
public static boolean appendIfNotBlank(java.lang.StringBuilder result, java.lang.String prefix, java.lang.String prefixIfNotBlank, java.lang.Object theStringOrArrayOrList, java.lang.String suffix)
result
- to append to, assumed to be not nullprefix
- prepend this prefix always (when a result not empty). Will be after the other prefixprefixIfNotBlank
- prepend this prefix if the result is not emptytheStringOrArrayOrList
- is a string, array, list, or set of stringssuffix
-
public static boolean appendIfNotEmpty(java.lang.StringBuilder result, java.lang.Object theStringOrArrayOrList)
result
- to append to
add a prefix and suffix (if not null)theStringOrArrayOrList
- is a string, array, list, or set of strings
public static boolean appendIfNotEmpty(java.lang.StringBuilder result, java.lang.String prefix, java.lang.Object theStringOrArrayOrList)
result
- to append toprefix
- theStringOrArrayOrList
- is a string, array, list, or set of strings
public static boolean appendIfNotEmpty(java.lang.StringBuilder result, java.lang.String prefix, java.lang.Object theStringOrArrayOrList, java.lang.String suffix)
result
- to append to, assumed to be not nullprefix
- theStringOrArrayOrList
- is a string, array, list, or set of stringssuffix
-
public static boolean appendIfNotEmpty(java.lang.StringBuilder result, java.lang.String prefix, java.lang.String prefixIfNotEmpty, java.lang.Object theStringOrArrayOrList, java.lang.String suffix)
result
- to append to, assumed to be not nullprefix
- prepend this prefix always (when a result not empty). Will be after the other prefixprefixIfNotEmpty
- prepend this prefix if the result is not emptytheStringOrArrayOrList
- is a string, array, list, or set of stringssuffix
-
public static int indexOf(java.lang.Object[] array, java.lang.Object objectToFind)
Find the index of the given object in the array.
This method returns -1
if null
array input.
array
- the array to search through for the object, may be null
objectToFind
- the object to find, may be null
-1
if not found or null
array inputpublic static boolean contains(java.lang.Object[] array, java.lang.Object objectToFind)
Checks if the object is in the given array.
The method returns false
if a null
array is passed in.
array
- the array to search throughobjectToFind
- the object to find
true
if the array contains the objectpublic static int indexOf(java.lang.Object[] array, java.lang.Object objectToFind, int startIndex)
Find the index of the given object in the array starting at the given index.
This method returns -1
if null
array input.
A negative startIndex is treated as zero. A startIndex larger than the array
length will return -1
.
array
- the array to search through for the object, may be null
objectToFind
- the object to find, may be null
startIndex
- the index to start searching at
-1
if not found or null
array inputpublic static <T> T arrayPopOne(T[] array)
T
- array
- is the container of objects to get the first of.
public static java.lang.String dateToString(java.util.Date date)
date
-
public static java.util.Date stringToDate(java.lang.String dateString)
dateString
-
public static java.lang.Long getMaxLongValue(java.lang.Long... values)
values
-
public static java.lang.Long getMinLongValue(java.lang.Long... values)
values
-
public static java.util.Map<java.lang.String,java.lang.String> propertiesThreadLocalOverrideMap(java.lang.String propertiesFileName)
propertiesFileName
-
public static java.util.Map<java.lang.String,java.lang.Object> typeCastStringStringMap(java.util.Map<java.lang.String,java.lang.Object> limitEnvVars)
limitEnvVars
- if processing limits, pass in a map of limits. The name is the
name of the variable, and the value is the value. Note, you can typecast the
values by putting a valid type in parens in front of the param name. e.g.
name: (integer)amount, value: 50 (will convert to long)
name: (decimal)amount, value: 50.3 (will convert to double)
name: (timestamp)amount, value: 2011/01/26 19:02:04 (will convert to date/timestamp)
public static boolean ipOnNetwork(java.lang.String ipString, java.lang.String networkIpString, int mask)
ipString
- is the ip address to checknetworkIpString
- is the ip address of the networkmask
- is the length of the mask (0-32)
public static boolean ipOnNetworks(java.lang.String ipString, java.lang.String networkIpStrings)
ipString
- is the ip address to checknetworkIpStrings
- are the ip addresses of the networks, e.g. 1.2.3.4/12, 2.3.4.5/24
public static int ipReadyForAnd(int ip, int maskLength)
ip
- intmaskLength
- int
public static int ipInt(java.lang.String ip)
ip
- String
public static void methodsByNameHelper(java.lang.Class<?> theClass, java.lang.String methodName, java.lang.Class<?> superclassToStopAt, boolean includeSuperclassToStopAt, boolean includeStaticMethods, java.lang.Class<? extends java.lang.annotation.Annotation> markerAnnotation, boolean includeAnnotation, java.util.Set<java.lang.reflect.Method> methodSet)
theClass
- methodName
- superclassToStopAt
- includeSuperclassToStopAt
- includeStaticMethods
- markerAnnotation
- includeAnnotation
- methodSet
- public static java.lang.Object callMethodWithMoreParams(java.lang.Object instance, java.lang.Class<?> theType, java.lang.String methodName, java.lang.Object[] params)
instance
- theType
- of object to call method onmethodName
- params
-
public static java.lang.Object changeToVersion(java.lang.Object input, java.lang.String newPackage)
input
- input objectnewPackage
- is the package where the other version of things are
public static java.lang.Object changeToVersionHelper(java.lang.Object input, java.lang.String newPackage, int timeToLive)
input
- input objectnewPackage
- is the package where the other version of things aretimeToLive
- avoid circular references
public static java.lang.String tmpDir()
public static <T> java.util.List<T> listFromCollection(java.util.Collection<T> collection)
T
- collection
-
public static java.util.concurrent.ExecutorService retrieveExecutorService()
public static GrouperFuture executorServiceSubmit(java.util.concurrent.ExecutorService executorService, java.util.concurrent.Callable callable)
executorService
- callable
-
public static java.lang.String concat(java.lang.String a, java.lang.String b)
a
- b
-
public static java.lang.String concat(java.lang.String a, java.lang.String b, java.lang.String c)
a
- b
- c
-
public static java.lang.String concat(java.lang.String a, java.lang.String b, java.lang.String c, java.lang.String d)
a
- b
- c
- d
-
public static java.lang.String concat(java.lang.String a, java.lang.String b, java.lang.String c, java.lang.String d, java.lang.String e)
a
- b
- c
- d
-
public static java.lang.String stack()
public static <T extends GrouperId> java.util.Set<T> sortByIds(java.util.Collection<java.lang.String> ids, java.util.Collection<T> grouperObjects)
T
- ids
- grouperObjects
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |