java.lang.Object
org.eclipse.persistence.internal.core.helper.CoreHelper
org.eclipse.persistence.internal.helper.Helper
- All Implemented Interfaces:
Serializable
INTERNAL:
Purpose: Define any useful methods that are missing from the base Java.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionPERF: Used to cache a set of calendars for conversion/printing purposes.protected static String
Store CR string, for some reason \n is not platform independent.protected static String
Prime the platform-dependent current working directorystatic final String
protected static final TimeZone
PERF: Cache default timezone for calendar conversion.protected static String
Prime the platform-dependent file separatorstatic final String
static final String
static final String
static boolean
Deprecated.Instead of setting the flag to true use: session.getProject().setDefaultIdValidation(IdValidation.NULL)static final String
Store newline stringstatic final Object
Used to store null values in hashtables, is helper because need to be serializable.protected static String
Prime the platform-dependent path separatorstatic final String
static final String
static final String
static final String
static final int
static final int
static final String
static final String
static boolean
Used to configure JDBC level date optimization.static final String
formatting strings for indentingprotected static String
Prime the platform-dependent temporary directory -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <E> void
addAllToVector
(Vector<E> theVector, Vector<? extends E> elementsToAdd) static <T> List
<T> addAllUniqueToList
(List<T> objects, List<T> objectsToAdd) static <T> Vector
<T> addAllUniqueToVector
(Vector<T> objects, List<T> objectsToAdd) static Calendar
PERF: This is used to optimize Calendar conversion/printing.static boolean
areTypesAssignable
(List<Class<?>> types1, List<Class<?>> types2) PUBLIC: Compare two vectors of types.static Object[]
arrayFromVector
(Vector<?> vector) Convert the specified vector into an array.static byte[]
Convert the HEX string to a byte array.static String
buildHexStringFromBytes
(byte[] bytes) Convert the byte array to a HEX string.static <T> Vector
<T> buildVectorFromMapElements
(Map<?, T> map) Create a new Vector containing all of the map elements.static String
buildZeroPrefix
(int number, int totalDigits) Build a numerical string with leading 0s.static String
buildZeroPrefixAndTruncTrailZeros
(int number, int totalDigits) Build a numerical string with leading 0s and truncate trailing zeros.static String
buildZeroPrefixWithoutSign
(int number, int totalDigits) Build a numerical string with leading 0s.static Calendar
calendarFromUtilDate
(Date date) Answer a Calendar from a date.static <T> boolean
classImplementsInterface
(Class<T> aClass, Class<?> anInterface) INTERNAL: Return whether a Class implements a specific interface, either directly or indirectly (through interface or implementation inheritance).static boolean
classIsSubclass
(Class<?> subClass, Class<?> superClass) INTERNAL: Return whether a Class is a subclass of, or the same as, another Class.static void
Close a closeable object, eating the exceptionstatic boolean
compareArrays
(Object[] array1, Object[] array2) static boolean
compareBigDecimals
(BigDecimal one, BigDecimal two) Compare two BigDecimals.static boolean
compareByteArrays
(byte[] array1, byte[] array2) static boolean
compareCharArrays
(char[] array1, char[] array2) static boolean
compareHashtables
(Hashtable<?, ?> hashtable1, Hashtable<?, ?> hashtable2) PUBLIC: Compare the elements in 2 hashtables to see if they are equal Added Nov 9, 2000 JED Patch 2.5.1.8static boolean
comparePotentialArrays
(Object firstValue, Object secondValue) Compare two potential arrays and return true if they are the same.static int
compareVersions
(String version1, String version2) INTERNAL: Compares two version in num.num.num.num.num*** format.protected static int
compareVersions
(List<Integer> list1, List<Integer> list2) INTERNAL: Compares two lists of Integers -1, 0, 1 means the first list is less than, equal, greater than the second list.static <K,
V> Map <K, V> concatenateMaps
(Map<? extends K, ? extends V> first, Map<? extends K, ? extends V> second) Merge the two Maps into a new HashMap.static <E> List
<E> concatenateUniqueLists
(List<? extends E> first, List<? extends E> second) Return a new List with no duplicated values.static <E> Vector
<E> concatenateUniqueVectors
(Vector<? extends E> first, Vector<? extends E> second) Return a new vector with no duplicated values.static <E> Vector
<E> concatenateVectors
(Vector<? extends E> first, Vector<? extends E> second) static String
convertLikeToRegex
(String like) Convert the SQL like pattern to a regex pattern.static boolean[]
copyBooleanArray
(boolean[] original) Copy an array of boolean to a new arraystatic int[]
copyIntArray
(int[] original) Copy an array of int to a new arraystatic String[]
copyStringArray
(String[] original) Copy an array of strings to a new arraystatic <E> Vector
<E> copyVector
(List<E> originalVector, int startIndex, int stopIndex) Return a copy of the vector containing a subset starting at startIndex and ending at stopIndex.static int
countOccurrencesOf
(Object comparisonObject, List<?> list) Return an integer representing the number of occurrences (using equals()) of the specified object in the specified list.static String
cr()
Return a string containing the platform-appropriate characters for carriage return.static String
Return the name of the "current working directory".static Date
dateFromCalendar
(Calendar calendar) Answer a sql.Date from a Calendar.static Date
dateFromLong
(Long longObject) Answer a Date from a long This implementation is based on the java.sql.Date class, not java.util.Date.static Date
dateFromString
(String dateString) Answer a Date from a string representation.static Date
dateFromTimestamp
(Timestamp timestamp) Answer a Date from a timestamp This implementation is based on the java.sql.Date class, not java.util.Date.static Date
dateFromYearMonthDate
(int year, int month, int day) Answer a Date with the year, month, date.static boolean
doesFileExist
(String fileName) Returns true if the file of this name does indeed existstatic String
doubleSlashes
(String path) Double up \ to allow printing of directories for source code generation.static String
extractJarNameFromURL
(URL url) Extracts the actual path to the jar file.static String
Return a string containing the platform-appropriate characters for separating directory and file names.static String
getAttributeNameFromMethodName
(String methodName) INTERNAL: Method to convert a getXyz or isXyz method name to an xyz attribute name.PERF: Return the calendar cache use to avoid calendar creation for processing java.sql/util.Date/Time/Timestamp objects.static <T> Class
<T> getClassFromClasseName
(String className, ClassLoader classLoader) static String
static Method
getDeclaredMethod
(Class<?> javaClass, String methodName) INTERNAL: Returns a Method for the specified Class, method name, and that has no parameters.static Method
getDeclaredMethod
(Class<?> javaClass, String methodName, Class<?>[] methodParameterTypes) INTERNAL: Returns a Method for the specified Class, method name, and formal parameter types.static DateTimeFormatter
static String
static String
static TimeZone
PERF: Return the cached default platform.static Field
INTERNAL: Returns a Field for the specified Class and field name.static Object
getInstanceFromClass
(Class<?> classFullName) Return the class instance from the classstatic Class
<?> getObjectClass
(Class<?> javaClass) Returns the object class.static String
getPackageName
(Class<?> javaClass) return a package name for the specified class.static String
getShortClassName
(Class<?> javaClass) Answers the unqualified class name for the provided class.static String
getShortClassName
(Object object) Answers the unqualified class name for the specified object.static String
getShortClassName
(String javaClassName) Answers the unqualified class name from the specified String.static String
getTabs
(int noOfTabs) Return a string containing the specified number of tabs.static String
getWeavedGetMethodName
(String attributeName) Return the set method name weaved for getting attribute value.static String
getWeavedSetMethodName
(String attributeName) Return the set method name weaved for setting attribute value.static String
getWeavedValueHolderGetMethodName
(String attributeName) Return the get method name weaved for a value-holder attribute.static String
getWeavedValueHolderSetMethodName
(String attributeName) Return the set method name weaved for a value-holder attribute.static boolean
hasLob
(Collection<DatabaseField> fields) static int
indexOfNullElement
(Vector<?> v, int index) Returns the index of the the firstnull
element found in the specifiedVector
starting the search at the starting index specified.PERF: Init the calendar cache use to avoid calendar creation for processing java.sql/util.Date/Time/Timestamp objects.static String
static boolean
isEquivalentToNull
(Object value) Check if the value is 0 (int/long) for primitive ids.static boolean
isLob
(DatabaseField field) static boolean
isNumberNegativeOrZero
(Object value) Returns true if the passed value is Number that is negative or equals to zero.static boolean
isPrimitiveWrapper
(Class<?> classInQuestion) ADVANCED returns true if the class in question is a primitive wrapperstatic boolean
Returns true if the string given is an all upper case stringstatic boolean
isVowel
(char c) Returns true if the character given is a vowel.static File[]
listFilesIn
(File directory) Return an array of the files in the specified directory.static <T> Vector
<T> makeVectorFromObject
(Object theObject) Make a Vector from the passed object.static void
outputClassFile
(String className, byte[] classBytes, String outputPath) Used by our byte code weaving to enable users who are debugging to output the generated class to a filestatic String
Return a string containing the platform-appropriate characters for separating entries in a path (e.g.static String
printCalendar
(Calendar calendar) Print the Calendar.static String
printCalendar
(Calendar calendar, boolean useLocalTime) Print the Calendar.static String
printCalendarWithoutNanos
(Calendar calendar) Print the Calendar without the nanos portion.static String
Print the sql.Date.static String
Print the date part of the calendar.static String
Print the date part of the calendar.static String
printStackTraceToString
(Throwable aThrowable) Return a String containing the printed stacktrace of an exception.static String
Print the sql.Time.static String
Print the time part of the calendar.static String
Print the time part of the calendar.static String
printTimeFromMilliseconds
(long milliseconds) static String
printTimestamp
(Timestamp timestamp) Print the sql.Timestamp.static String
printTimestampWithoutNanos
(Timestamp timestamp) Print the sql.Timestamp without the nanos portion.static String
printVector
(Vector<?> vector) Given a Vector, print it, even if there is a null in itstatic <K,
V> Hashtable <K, V> rehashHashtable
(Hashtable<K, V> table) static <K,
V> Map <K, V> static void
releaseCalendar
(Calendar calendar) PERF: This is used to optimize Calendar conversion/printing.static String
removeAllButAlphaNumericToFit
(String s1, int maximumStringLength) Returns a String which has had enough non-alphanumeric characters removed to be equal to the maximumStringLength.static String
removeCharacterToFit
(String s1, char aChar, int maximumStringLength) Returns a String which has had enough of the specified character removed to be equal to the maximumStringLength.static String
removeVowels
(String s1) Returns a String which has had enough of the specified character removed to be equal to the maximumStringLength.static String
replaceFirstSubString
(String source, String subString, String replacement) Replaces the first subString of the source with the replacement.static <T> Vector
<T> reverseVector
(Vector<T> theVector) static String
rightTrimString
(String originalString) Returns a new string with all space characters removed from the rightstatic void
setDefaultEndDatabaseDelimiter
(String delimiter) static void
setDefaultStartDatabaseDelimiter
(String delimiter) static void
setShouldOptimizeDates
(boolean value) Return if JDBC date access should be optimized.static String
shortenStringsByRemovingVowelsToFit
(String s1, String s2, int maximumStringLength) Returns a String which is a concatenation of two string which have had enough vowels removed from them so that the sum of the sized of the two strings is less than or equal to the specified size.static boolean
Return if JDBC date access should be optimized.static Date
sqlDateFromUtilDate
(Date utilDate) Answer a sql.Date from a timestamp.static void
Can be used to mark code if a workaround is added for a JDBC driver or other bug.static String
Return the name of the "temporary directory".static Time
timeFromCalendar
(Calendar calendar) Answer a sql.Time from a Calendar.static Time
timeFromDate
(Date date) Answer a Time from a Date This implementation is based on the java.sql.Date class, not java.util.Date.static Time
timeFromHourMinuteSecond
(int hour, int minute, int second) Answer a Time with the hour, minute, second.static Time
timeFromLong
(Long longObject) Answer a Time from a longstatic Time
timeFromString
(String timeString) Answer a Time from a string representation.static Time
timeFromTimestamp
(Timestamp timestamp) Answer a Time from a Timestamp Usus the Hours, Minutes, Seconds instead of getTime() ms value.static Timestamp
timestampFromCalendar
(Calendar calendar) Answer a Timestamp from a Calendar.static Timestamp
timestampFromDate
(Date date) Answer a Timestamp from a java.util.Date.static Timestamp
timestampFromLong
(long millis) Answer a Time from a longstatic Timestamp
timestampFromLong
(Long millis) Answer a Time from a longstatic Timestamp
timestampFromString
(String timestampString) Answer a Timestamp from a string representation.static Timestamp
timestampFromYearMonthDateHourMinuteSecondNanos
(int year, int month, int date, int hour, int minute, int second, int nanos) Answer a Timestamp with the year, month, day, hour, minute, second.static long
static void
Can be used to mark code as need if something strange is seen.static String
toSlashedClassName
(String dottedClassName) Convert dotted format class name to slashed format class name.static URI
Convert the URL into a URI allowing for special chars.static String
If the size of the original string is larger than the passed in size, this method will remove the vowels from the original string.static Date
truncateDate
(Date date) Return a sql.Date with time component zeroed out.static Date
Return a sql.Date with time component zeroed out (with possible exception of milliseconds).static Date
utilDateFromLong
(Long longObject) Answer a Date from a long This implementation is based on the java.sql.Date class, not java.util.Date.static Date
utilDateFromSQLDate
(Date sqlDate) Answer a java.util.Date from a sql.datestatic Date
utilDateFromTime
(Time time) Answer a java.util.Date from a sql.Timestatic Date
utilDateFromTimestamp
(Timestamp timestampObject) Answer a java.util.Date from a timestampstatic <T> Vector
<T> vectorFromArray
(T[] array) Convert the specified array into a vector.INTERNAL: Expects version in ***num.num.num.num.num*** format, converts it to a List of Integers.static void
writeHexString
(byte[] bytes, Writer writer) Convert the byte array to a HEX string.
-
Field Details
-
shouldOptimizeDates
public static boolean shouldOptimizeDatesUsed to configure JDBC level date optimization. -
NULL_VALUE
Used to store null values in hashtables, is helper because need to be serializable. -
calendarCache
PERF: Used to cache a set of calendars for conversion/printing purposes. -
defaultTimeZone
PERF: Cache default timezone for calendar conversion. -
CR
Store CR string, for some reason \n is not platform independent. -
SPACE
formatting strings for indenting- See Also:
-
INDENT
- See Also:
-
NL
Store newline string- See Also:
-
PATH_SEPARATOR
Prime the platform-dependent path separator -
FILE_SEPARATOR
Prime the platform-dependent file separator -
CURRENT_WORKING_DIRECTORY
Prime the platform-dependent current working directory -
TEMP_DIRECTORY
Prime the platform-dependent temporary directory -
isZeroValidPrimaryKey
Deprecated.Instead of setting the flag to true use: session.getProject().setDefaultIdValidation(IdValidation.NULL)Backdoor to allow 0 to be used in primary keys. -
IS_PROPERTY_METHOD_PREFIX
- See Also:
-
GET_PROPERTY_METHOD_PREFIX
- See Also:
-
SET_PROPERTY_METHOD_PREFIX
- See Also:
-
SET_IS_PROPERTY_METHOD_PREFIX
- See Also:
-
POSITION_AFTER_IS_PREFIX
public static final int POSITION_AFTER_IS_PREFIX -
POSITION_AFTER_GET_PREFIX
public static final int POSITION_AFTER_GET_PREFIX -
DEFAULT_DATABASE_DELIMITER
- See Also:
-
PERSISTENCE_SET
- See Also:
-
PERSISTENCE_GET
- See Also:
-
PERSISTENCE_FIELDNAME_PREFIX
- See Also:
-
PERSISTENCE_FIELDNAME_POSTFIX
- See Also:
-
-
Constructor Details
-
Helper
public Helper()
-
-
Method Details
-
shouldOptimizeDates
public static boolean shouldOptimizeDates()Return if JDBC date access should be optimized. -
setShouldOptimizeDates
public static void setShouldOptimizeDates(boolean value) Return if JDBC date access should be optimized. -
getCalendarCache
PERF: Return the calendar cache use to avoid calendar creation for processing java.sql/util.Date/Time/Timestamp objects. -
initCalendarCache
PERF: Init the calendar cache use to avoid calendar creation for processing java.sql/util.Date/Time/Timestamp objects. -
allocateCalendar
PERF: This is used to optimize Calendar conversion/printing. This should only be used when a calendar is temporarily required, when finished it must be released back. -
getDefaultTimeZone
PERF: Return the cached default platform. Used for ensuring Calendar are in the local timezone. The JDK method clones the timezone, so cache it locally. -
getDefaultDateTimeFormatter
-
releaseCalendar
PERF: This is used to optimize Calendar conversion/printing. This should only be used when a calendar is temporarily required, when finished it must be released back. -
addAllToVector
-
addAllUniqueToVector
-
addAllUniqueToList
-
arrayFromVector
Convert the specified vector into an array. -
integerToHexString
-
buildBytesFromHexString
Convert the HEX string to a byte array. HEX allows for binary data to be printed. -
buildHexStringFromBytes
Convert the byte array to a HEX string. HEX allows for binary data to be printed. -
buildVectorFromMapElements
Create a new Vector containing all of the map elements. -
calendarFromUtilDate
Answer a Calendar from a date. -
classImplementsInterface
INTERNAL: Return whether a Class implements a specific interface, either directly or indirectly (through interface or implementation inheritance).- Returns:
- boolean
-
classIsSubclass
INTERNAL: Return whether a Class is a subclass of, or the same as, another Class.- Returns:
- boolean
-
compareVersions
INTERNAL: Compares two version in num.num.num.num.num*** format. -1, 0, 1 means the version1 is less than, equal, greater than version2. Example: compareVersions("11.1.0.6.0-Production", "11.1.0.7") == -1 Example: compareVersions("WebLogic Server 10.3.4", "10.3.3.0") == 1 -
version
INTERNAL: Expects version in ***num.num.num.num.num*** format, converts it to a List of Integers. Example: "11.1.0.6.0_Production" -> {11, 1, 0, 6, 0} Example: "WebLogic Server 10.3.3.0" -> {10, 3, 3, 0} -
compareVersions
INTERNAL: Compares two lists of Integers -1, 0, 1 means the first list is less than, equal, greater than the second list. Example: {11, 1, 0, 6, 0} < {11, 1, 0, 7} -
getClassFromClasseName
-
getComponentTypeNameFromArrayString
-
compareArrays
-
compareBigDecimals
Compare two BigDecimals. This is required because the .equals method of java.math.BigDecimal ensures that the scale of the two numbers are equal. Therefore 0.0 != 0.00.- See Also:
-
compareByteArrays
public static boolean compareByteArrays(byte[] array1, byte[] array2) -
compareCharArrays
public static boolean compareCharArrays(char[] array1, char[] array2) -
areTypesAssignable
PUBLIC: Compare two vectors of types. Return true if the size of the vectors is the same and each of the types in the first Vector are assignable from the types in the corresponding objects in the second Vector. -
compareHashtables
PUBLIC: Compare the elements in 2 hashtables to see if they are equal Added Nov 9, 2000 JED Patch 2.5.1.8 -
comparePotentialArrays
Compare two potential arrays and return true if they are the same. Will check for BigDecimals as well. -
concatenateMaps
public static <K,V> Map<K,V> concatenateMaps(Map<? extends K, ? extends V> first, Map<? extends K, ? extends V> second) Merge the two Maps into a new HashMap. -
concatenateUniqueVectors
public static <E> Vector<E> concatenateUniqueVectors(Vector<? extends E> first, Vector<? extends E> second) Return a new vector with no duplicated values. -
concatenateUniqueLists
Return a new List with no duplicated values. -
concatenateVectors
-
copyVector
public static <E> Vector<E> copyVector(List<E> originalVector, int startIndex, int stopIndex) throws ValidationException Return a copy of the vector containing a subset starting at startIndex and ending at stopIndex.- Parameters:
originalVector
- - original vectorstartIndex
- - starting position in vectorstopIndex
- - ending position in vector- Throws:
ValidationException
-
copyStringArray
Copy an array of strings to a new array -
copyIntArray
public static int[] copyIntArray(int[] original) Copy an array of int to a new array -
copyBooleanArray
public static boolean[] copyBooleanArray(boolean[] original) Copy an array of boolean to a new array- Parameters:
original
-- Returns:
-
cr
Return a string containing the platform-appropriate characters for carriage return. -
currentWorkingDirectory
Return the name of the "current working directory". -
tempDirectory
Return the name of the "temporary directory". -
dateFromLong
Answer a Date from a long This implementation is based on the java.sql.Date class, not java.util.Date.- Parameters:
longObject
- - milliseconds from the epoch (00:00:00 GMT Jan 1, 1970). Negative values represent dates prior to the epoch.
-
dateFromYearMonthDate
Answer a Date with the year, month, date. This builds a date avoiding the deprecated, inefficient and concurrency bottleneck date constructors. This implementation is based on the java.sql.Date class, not java.util.Date. The year, month, day are the values calendar uses, i.e. year is from 0, month is 0-11, date is 1-31. -
dateFromString
Answer a Date from a string representation. The string MUST be a valid date and in one of the following formats: YYYY/MM/DD, YYYY-MM-DD, YY/MM/DD, YY-MM-DD. This implementation is based on the java.sql.Date class, not java.util.Date. The Date class contains some minor gotchas that you have to watch out for.- Parameters:
dateString
- - string representation of date- Returns:
- - date representation of string
- Throws:
ConversionException
-
dateFromTimestamp
Answer a Date from a timestamp This implementation is based on the java.sql.Date class, not java.util.Date.- Parameters:
timestamp
- - timestamp representation of date- Returns:
- - date representation of timestampObject
-
doesFileExist
Returns true if the file of this name does indeed exist -
doubleSlashes
Double up \ to allow printing of directories for source code generation. -
extractJarNameFromURL
Extracts the actual path to the jar file. -
fileSeparator
Return a string containing the platform-appropriate characters for separating directory and file names. -
getField
INTERNAL: Returns a Field for the specified Class and field name. Uses Class.getDeclaredField(String) to find the field. If the field is not found on the specified class the superclass is checked, and so on, recursively. Set accessible to true, so we can access private/package/protected fields.- Throws:
NoSuchFieldException
-
getDeclaredMethod
public static Method getDeclaredMethod(Class<?> javaClass, String methodName) throws NoSuchMethodException INTERNAL: Returns a Method for the specified Class, method name, and that has no parameters. Uses Class.getDeclaredMethod(String Class[]) to find the method. If the method is not found on the specified class the superclass is checked, and so on, recursively. Set accessible to true, so we can access private/package/protected methods.- Throws:
NoSuchMethodException
-
getDeclaredMethod
public static Method getDeclaredMethod(Class<?> javaClass, String methodName, Class<?>[] methodParameterTypes) throws NoSuchMethodException INTERNAL: Returns a Method for the specified Class, method name, and formal parameter types. Uses Class.getDeclaredMethod(String Class[]) to find the method. If the method is not found on the specified class the superclass is checked, and so on, recursively. Set accessible to true, so we can access private/package/protected methods.- Throws:
NoSuchMethodException
-
getInstanceFromClass
Return the class instance from the class -
getObjectClass
Returns the object class. If a class is primitive return its non primitive class -
getShortClassName
Answers the unqualified class name for the provided class. -
getShortClassName
Answers the unqualified class name from the specified String. -
getShortClassName
Answers the unqualified class name for the specified object. -
getPackageName
return a package name for the specified class. -
getTabs
Return a string containing the specified number of tabs. -
indexOfNullElement
Returns the index of the the firstnull
element found in the specifiedVector
starting the search at the starting index specified. Return an int >= 0 and less than size if anull
element was found. Return -1 if anull
element was not found. This is needed in jdk1.1, whereVector.contains(Object)
for anull
element will result in aNullPointerException
.... -
isPrimitiveWrapper
ADVANCED returns true if the class in question is a primitive wrapper -
isUpperCaseString
Returns true if the string given is an all upper case string -
isVowel
public static boolean isVowel(char c) Returns true if the character given is a vowel. I.e. one of a,e,i,o,u,A,E,I,O,U. -
listFilesIn
Return an array of the files in the specified directory. This allows us to simplify jdk1.1 code a bit. -
makeVectorFromObject
Make a Vector from the passed object. If it's a Collection, iterate over the collection and add each item to the Vector. If it's not a collection create a Vector and add the object to it. -
outputClassFile
Used by our byte code weaving to enable users who are debugging to output the generated class to a file -
pathSeparator
Return a string containing the platform-appropriate characters for separating entries in a path (e.g. the classpath) -
printStackTraceToString
Return a String containing the printed stacktrace of an exception. -
printTimeFromMilliseconds
-
printVector
Given a Vector, print it, even if there is a null in it -
rehashHashtable
-
rehashMap
-
removeAllButAlphaNumericToFit
Returns a String which has had enough non-alphanumeric characters removed to be equal to the maximumStringLength. -
removeCharacterToFit
Returns a String which has had enough of the specified character removed to be equal to the maximumStringLength. -
removeVowels
Returns a String which has had enough of the specified character removed to be equal to the maximumStringLength. -
replaceFirstSubString
Replaces the first subString of the source with the replacement. -
reverseVector
-
rightTrimString
Returns a new string with all space characters removed from the right- Parameters:
originalString
- - timestamp representation of date- Returns:
- - String
-
shortenStringsByRemovingVowelsToFit
public static String shortenStringsByRemovingVowelsToFit(String s1, String s2, int maximumStringLength) Returns a String which is a concatenation of two string which have had enough vowels removed from them so that the sum of the sized of the two strings is less than or equal to the specified size. -
sqlDateFromUtilDate
Answer a sql.Date from a timestamp. -
printDate
Print the sql.Date. -
printDate
Print the date part of the calendar. -
printDate
Print the date part of the calendar. Normally the calendar must be printed in the local time, but if the timezone is printed, it must be printing in its timezone. -
printTime
Print the sql.Time. -
printTime
Print the time part of the calendar. -
printTime
Print the time part of the calendar. Normally the calendar must be printed in the local time, but if the timezone is printed, it must be printing in its timezone. -
printCalendar
Print the Calendar. -
printCalendar
Print the Calendar. Normally the calendar must be printed in the local time, but if the timezone is printed, it must be printing in its timezone. -
printTimestamp
Print the sql.Timestamp. -
buildZeroPrefix
Build a numerical string with leading 0s. number is an existing number that the new string will be built on. totalDigits is the number of the required digits of the string. -
buildZeroPrefixWithoutSign
Build a numerical string with leading 0s. number is an existing number that the new string will be built on. totalDigits is the number of the required digits of the string. -
buildZeroPrefixAndTruncTrailZeros
Build a numerical string with leading 0s and truncate trailing zeros. number is an existing number that the new string will be built on. totalDigits is the number of the required digits of the string. -
printTimestampWithoutNanos
Print the sql.Timestamp without the nanos portion. -
printCalendarWithoutNanos
Print the Calendar without the nanos portion. -
dateFromCalendar
Answer a sql.Date from a Calendar. -
truncateDate
Return a sql.Date with time component zeroed out. Starting with version 12.1 Oracle jdbc Statement.setDate method no longer zeroes out the time component. -
truncateDateIgnoreMilliseconds
Return a sql.Date with time component zeroed out (with possible exception of milliseconds). Starting with version 12.1 Oracle jdbc Statement.setDate method no longer zeroes out the whole time component, yet it still zeroes out milliseconds. -
systemBug
Can be used to mark code if a workaround is added for a JDBC driver or other bug. -
timeFromDate
Answer a Time from a Date This implementation is based on the java.sql.Date class, not java.util.Date.- Parameters:
date
- - time representation of date- Returns:
- - time representation of dateObject
-
timeFromLong
Answer a Time from a long- Parameters:
longObject
- - milliseconds from the epoch (00:00:00 GMT Jan 1, 1970). Negative values represent dates prior to the epoch.
-
timeFromHourMinuteSecond
Answer a Time with the hour, minute, second. This builds a time avoiding the deprecated, inefficient and concurrency bottleneck date constructors. The hour, minute, second are the values calendar uses, i.e. year is from 0, month is 0-11, date is 1-31. -
timeFromString
Answer a Time from a string representation. This method will accept times in the following formats: HH-MM-SS, HH:MM:SS- Parameters:
timeString
- - string representation of time- Returns:
- - time representation of string
- Throws:
ConversionException
-
timeFromTimestamp
Answer a Time from a Timestamp Usus the Hours, Minutes, Seconds instead of getTime() ms value. -
timeFromCalendar
Answer a sql.Time from a Calendar. -
timestampFromCalendar
Answer a Timestamp from a Calendar. -
timestampFromDate
Answer a Timestamp from a java.util.Date. -
timestampFromLong
Answer a Time from a long- Parameters:
millis
- - milliseconds from the epoch (00:00:00 GMT Jan 1, 1970). Negative values represent dates prior to the epoch.
-
timestampFromLong
Answer a Time from a long- Parameters:
millis
- - milliseconds from the epoch (00:00:00 GMT Jan 1, 1970). Negative values represent dates prior to the epoch.
-
timestampFromString
Answer a Timestamp from a string representation. This method will accept strings in the following formats: YYYY/MM/DD HH:MM:SS YY/MM/DD HH:MM:SS YYYY-MM-DD HH:MM:SS YY-MM-DD HH:MM:SS YYYY/MM/DD HH:MM:SS.NNNNNNN YYYY/MM/DD HH:MM:SS.NNNNNNN+Z- Parameters:
timestampString
- - string representation of timestamp- Returns:
- - timestamp representation of string
- Throws:
ConversionException
-
timestampFromYearMonthDateHourMinuteSecondNanos
public static Timestamp timestampFromYearMonthDateHourMinuteSecondNanos(int year, int month, int date, int hour, int minute, int second, int nanos) Answer a Timestamp with the year, month, day, hour, minute, second. The hour, minute, second are the values calendar uses, i.e. year is from 0, month is 0-11, date is 1-31, time is 0-23/59. -
toDo
Can be used to mark code as need if something strange is seen. -
toSlashedClassName
Convert dotted format class name to slashed format class name.- Returns:
- String
-
truncate
If the size of the original string is larger than the passed in size, this method will remove the vowels from the original string. The removal starts backward from the end of original string, and stops if the resulting string size is equal to the passed in size. If the resulting string is still larger than the passed in size after removing all vowels, the end of the resulting string will be truncated. -
utilDateFromLong
Answer a Date from a long This implementation is based on the java.sql.Date class, not java.util.Date.- Parameters:
longObject
- - milliseconds from the epoch (00:00:00 GMT Jan 1, 1970). Negative values represent dates prior to the epoch.
-
utilDateFromSQLDate
Answer a java.util.Date from a sql.date- Parameters:
sqlDate
- - sql.date representation of date- Returns:
- - java.util.Date representation of the sql.date
-
utilDateFromTime
Answer a java.util.Date from a sql.Time- Parameters:
time
- - time representation of util date- Returns:
- - java.util.Date representation of the time
-
utilDateFromTimestamp
Answer a java.util.Date from a timestamp- Parameters:
timestampObject
- - timestamp representation of date- Returns:
- - java.util.Date representation of timestampObject
-
vectorFromArray
Convert the specified array into a vector. -
writeHexString
Convert the byte array to a HEX string. HEX allows for binary data to be printed.- Throws:
IOException
-
isEquivalentToNull
Check if the value is 0 (int/long) for primitive ids. -
isNumberNegativeOrZero
Returns true if the passed value is Number that is negative or equals to zero. -
countOccurrencesOf
Return an integer representing the number of occurrences (using equals()) of the specified object in the specified list. If the list is null or empty (or both the object and the list is null), 0 is returned. -
toURI
Convert the URL into a URI allowing for special chars.- Throws:
URISyntaxException
-
getWeavedValueHolderGetMethodName
Return the get method name weaved for a value-holder attribute. -
getWeavedValueHolderSetMethodName
Return the set method name weaved for a value-holder attribute. -
getWeavedGetMethodName
Return the set method name weaved for getting attribute value. This method is always weaved in field access case. In property access case the method weaved only if attribute name is the same as property name: for instance, the method weaved for "manager" attribute that uses "getManager" / "setManager" access methods, but not for "m_address" attribute that uses "getAddress" / "setAddress" access methods. -
getWeavedSetMethodName
Return the set method name weaved for setting attribute value. This method is always weaved in field access case. In property access case the method weaved only if attribute name is the same as property name: for instance, the method weaved for "manager" attribute that uses "getManager" / "setManager" access methods, but not for "m_address" attribute that uses "getAddress" / "setAddress" access methods. -
close
Close a closeable object, eating the exception -
getAttributeNameFromMethodName
INTERNAL: Method to convert a getXyz or isXyz method name to an xyz attribute name. NOTE: The method name passed it may not actually be a method name, so by default return the name passed in. -
getDefaultStartDatabaseDelimiter
-
getDefaultEndDatabaseDelimiter
-
setDefaultStartDatabaseDelimiter
-
setDefaultEndDatabaseDelimiter
-
convertLikeToRegex
Convert the SQL like pattern to a regex pattern. -
isLob
-
hasLob
-
timeWithRoundMiliseconds
public static long timeWithRoundMiliseconds()
-