public class EntityUtil
extends java.lang.Object
| Modifier and Type | Field | Description |
|---|---|---|
static java.lang.String |
CLASS |
|
static java.lang.String |
CONTROLCHARACTER |
|
static java.lang.String |
emfTypes |
|
static java.lang.String |
HTMLTOKEN |
Map to convert extended characters in html entities.
|
static java.lang.String |
javaKeyWords |
|
static java.lang.String |
NON_FILE_CHARSSIMPLE |
| Constructor | Description |
|---|---|
EntityUtil() |
| Modifier and Type | Method | Description |
|---|---|---|
static java.lang.String |
basicUnQuote(java.lang.String value) |
|
static byte[] |
clone(byte[] entity) |
|
static boolean |
compareEntity(Entity entityA,
Entity entityB) |
|
static boolean |
compareEntity(java.lang.Object entityA,
java.lang.Object entityB,
TextDiff diffList,
BaseItem sameObject) |
|
static boolean |
compareEntity(java.util.Collection<?> jsonA,
java.util.Collection<?> jsonB) |
|
protected static java.lang.Object |
compareValue(java.lang.String key,
java.lang.Object valueA,
java.lang.Object valueB,
TextDiff diffList,
BaseItem sameElement) |
|
static boolean |
containsAny(java.lang.CharSequence cs,
char[] searchChars) |
Checks if the CharSequence contains any character in the given set of characters.
|
static boolean |
containsAny(java.lang.CharSequence cs,
java.lang.CharSequence searchChars) |
Checks if the CharSequence contains any character in the given set of characters.
|
static java.lang.String |
convertPrimitiveToObjectType(java.lang.String type) |
|
static int |
countMatches(java.lang.CharSequence str,
java.lang.CharSequence sub) |
Counts how many times the substring appears in the larger string.
|
java.lang.String |
decode(java.lang.String str) |
Convert HTML entities to special and extended unicode characters
equivalents.
|
java.lang.String |
doubleToString(double d) |
Produce a string from a double.
|
java.lang.String |
encode(java.lang.String str) |
Convert special and extended characters into HTML entitities.
|
static boolean |
equalsAny(java.lang.CharSequence cs,
java.lang.CharSequence[] strs) |
Checks if the CharSequence equals any character in the given set of characters.
|
static ByteBuffer |
getBuffer(int len) |
|
static byte[] |
getBytes(java.lang.CharSequence string) |
Convert String to ByteArray
|
static java.lang.String |
getDefaultValue(java.lang.String datatype) |
|
static SimpleList<Pos> |
getExcelRange(java.lang.String tag) |
|
static byte |
getGroup(byte type) |
|
static java.lang.String |
getId(java.lang.String name) |
|
static java.lang.String |
getStringType(byte type) |
|
static byte |
getSubGroup(byte type) |
|
static byte |
getType(byte group,
byte subGroup) |
|
static byte |
getType(byte type,
int len,
boolean isLast) |
|
static int |
getTypeLen(byte type,
int len,
boolean isLast) |
|
static java.lang.String |
getValidChars(java.lang.String source,
int maxLen) |
|
static boolean |
isEMFType(java.lang.String tag) |
|
static boolean |
isEmpty(java.lang.CharSequence cs) |
Checks if a CharSequence is empty ("") or null.
|
static boolean |
isGroup(byte type) |
Check if the Type is type of Group
|
static boolean |
isModifier(java.lang.String type) |
|
static boolean |
isNumeric(java.lang.String strNum) |
|
static boolean |
isNumericType(java.lang.String type) |
|
static boolean |
isNumericTypeContainer(java.lang.String typeA,
java.lang.String typeB) |
|
static boolean |
isPrimitive(byte type) |
|
static boolean |
isPrimitiveType(java.lang.String type) |
|
static java.lang.String |
quote(java.lang.String string) |
Produce a string in double quotes with backslash sequences in all the
right places.
|
static java.lang.String |
randomString(int length) |
Returns a random String of numbers and letters (lower and upper case)
of the specified length.
|
static java.lang.String |
repeat(char ch,
int repeat) |
Repeat a Char and return a simple String
|
static java.lang.String |
shortClassName(java.lang.String name) |
|
static boolean |
stringEquals(java.lang.String s1,
java.lang.String s2) |
Safe String comparison.
|
static java.lang.String |
strZero(int value,
int length) |
format a String with 0
|
static java.lang.String |
strZero(int value,
int length,
int max) |
Format a date with 0
|
static java.lang.String |
strZero(long value,
int length) |
format a String with 0
|
static java.lang.String |
strZero(long value,
int length,
int max) |
format a String with 0
|
static java.lang.String |
strZero(java.lang.String value,
int length,
int max) |
|
static java.lang.String |
toValidJavaId(java.lang.String tag) |
|
static java.lang.String |
unQuote(java.lang.CharSequence value) |
|
static java.lang.String |
unQuoteControlCharacter(java.lang.CharSequence value) |
|
static java.lang.String |
upFirstChar(java.lang.String name) |
|
static java.lang.String |
valueToString(java.lang.Number number) |
Produce a string from a Number.
|
static java.lang.String |
valueToString(java.lang.Object value,
boolean simpleText,
BaseItem reference,
Converter converter) |
Make a prettyprinted JSON text of an object value.
|
static java.lang.Object |
wrap(java.lang.Object object,
BaseItem reference) |
Wrap an object, if necessary.
|
static void |
writeByteHeader(ByteBuffer buffer,
byte type,
int valueLength) |
public static final java.lang.String CLASS
public static final java.lang.String NON_FILE_CHARSSIMPLE
public static final java.lang.String emfTypes
public static java.lang.String CONTROLCHARACTER
public static final java.lang.String javaKeyWords
public static final java.lang.String HTMLTOKEN
public final java.lang.String doubleToString(double d)
d - a double.public static final boolean isNumeric(java.lang.String strNum)
public static final SimpleList<Pos> getExcelRange(java.lang.String tag)
public static final java.lang.String valueToString(java.lang.Number number)
throws java.lang.IllegalArgumentException
number - A Numberjava.lang.IllegalArgumentException - If n is a non-finite number.public static final java.lang.String unQuoteControlCharacter(java.lang.CharSequence value)
public static final java.lang.String unQuote(java.lang.CharSequence value)
public static final java.lang.String basicUnQuote(java.lang.String value)
public static final java.lang.String quote(java.lang.String string)
string - A Stringpublic static final java.lang.String valueToString(java.lang.Object value,
boolean simpleText,
BaseItem reference,
Converter converter)
Warning: This method assumes that the data structure is acyclical.
value - The value to be serialized.simpleText - Boolean for switch between text and Escaped-Textreference - A Reference Object to generate new Objects like Factory Patternconverter - The Converter to transform Item{ (left
brace) and ending with } (right
brace).public static final java.lang.Object wrap(java.lang.Object object,
BaseItem reference)
object - The object to wrapreference - The referencepublic static final java.lang.String repeat(char ch,
int repeat)
ch - Charrepeat - Number of Repeatpublic static final boolean stringEquals(java.lang.String s1,
java.lang.String s2)
s1 - first strings2 - second stringpublic static final java.lang.String strZero(int value,
int length)
value - the numericvaluelength - the length of Valuepublic static final java.lang.String strZero(long value,
int length)
value - the numericvaluelength - the length of Valuepublic static final java.lang.String strZero(long value,
int length,
int max)
value - the numericvaluelength - the length of Valuemax - the maxValuepublic static final java.lang.String strZero(int value,
int length,
int max)
value - the numericvaluelength - the length of Valuemax - the maxValuepublic static final java.lang.String strZero(java.lang.String value,
int length,
int max)
public static final java.lang.String getValidChars(java.lang.String source,
int maxLen)
public static final java.lang.String getDefaultValue(java.lang.String datatype)
public static final boolean compareEntity(java.util.Collection<?> jsonA,
java.util.Collection<?> jsonB)
public static final boolean compareEntity(java.lang.Object entityA,
java.lang.Object entityB,
TextDiff diffList,
BaseItem sameObject)
protected static final java.lang.Object compareValue(java.lang.String key,
java.lang.Object valueA,
java.lang.Object valueB,
TextDiff diffList,
BaseItem sameElement)
public static final boolean isEMFType(java.lang.String tag)
public static final boolean isModifier(java.lang.String type)
public static final boolean isPrimitiveType(java.lang.String type)
public static final boolean isNumericType(java.lang.String type)
public static final boolean isNumericTypeContainer(java.lang.String typeA,
java.lang.String typeB)
public static final java.lang.String convertPrimitiveToObjectType(java.lang.String type)
public static final java.lang.String toValidJavaId(java.lang.String tag)
public static final java.lang.String getId(java.lang.String name)
public static final java.lang.String shortClassName(java.lang.String name)
public static final java.lang.String upFirstChar(java.lang.String name)
public java.lang.String encode(java.lang.String str)
str - input stringpublic java.lang.String decode(java.lang.String str)
str - input stringpublic static final void writeByteHeader(ByteBuffer buffer, byte type, int valueLength)
public static final byte[] clone(byte[] entity)
public static final byte getType(byte group,
byte subGroup)
public static final byte getType(byte type,
int len,
boolean isLast)
public static final int getTypeLen(byte type,
int len,
boolean isLast)
public static final byte[] getBytes(java.lang.CharSequence string)
string - The Stringpublic static final ByteBuffer getBuffer(int len)
public static final boolean isPrimitive(byte type)
public static final boolean isGroup(byte type)
type - the the type of datapublic static final java.lang.String getStringType(byte type)
public static final byte getGroup(byte type)
public static final byte getSubGroup(byte type)
public static final int countMatches(java.lang.CharSequence str,
java.lang.CharSequence sub)
str - the CharSequence to check, may be nullsub - the substring to count, may be nullnullpublic static final boolean isEmpty(java.lang.CharSequence cs)
cs - the CharSequence to check, may be nullpublic static final boolean equalsAny(java.lang.CharSequence cs,
java.lang.CharSequence[] strs)
cs - the CharSequence to checkstrs - the set of characters to check againstpublic static final boolean containsAny(java.lang.CharSequence cs,
java.lang.CharSequence searchChars)
cs - the CharSequence to check, may be nullsearchChars - the chars to search for, may be nulltrue if any of the chars are found, false if no match or null inputpublic static final boolean containsAny(java.lang.CharSequence cs,
char[] searchChars)
cs - the CharSequence to check, may be nullsearchChars - the chars to search for, may be nulltrue if any of the chars are found, false if no match or null inputpublic static java.lang.String randomString(int length)
The specified length must be at least one. If not, the method will return null.
length - the desired length of the random String to return.