List of utility methods to do Java String Format
String | toJavaScriptSafeString(String content) Convert a string to a JavaScript safe string (escape quotes and remove cr and lf). content = content.replaceAll("'", "\\\\'"); content = content.replaceAll("\"", "\\\\\""); content = content.replaceAll("\\r\\n", ""); content = content.replaceAll("\\r", ""); content = content.replaceAll("\\n", ""); return content; |
long | toJavaSecs(long secs) Converts the given postgresql seconds to java seconds. secs += 946684800L; if (secs < -12219292800L) { secs += 86400 * 10; if (secs < -14825808000L) { int extraLeaps = (int) ((secs + 14825808000L) / 3155760000L); extraLeaps--; extraLeaps -= extraLeaps / 4; secs += extraLeaps * 86400L; ... |
String | toJavaSourceType(String type) Class.getName() return arrays in the form "[[[ if (type.charAt(0) != '[') { return type; int dims = 1; String t = null; for (int i = 1; i < type.length(); i++) { if (type.charAt(i) == '[') { dims++; ... |
String | toJavaStaticIdentifier(String string) Fashion a static identifier from the given string. String javaIdentifierName = toJavaInstanceIdentifier(string); StringBuilder sb = new StringBuilder(javaIdentifierName.length() + 5); for (int i = 0, l = javaIdentifierName.length(); i < l; i++) { char ch = javaIdentifierName.charAt(i); if (Character.isUpperCase(ch)) { boolean nextCharLowerCase = false; boolean prevCharLowerCase = false; int nextIndex = i + 1; ... |
String | toJavaString(final String s) to Java String if (s == null) { return null; String t = s.trim(); if (!isGamaString(t)) { return s; if (t.length() >= 2) { ... |
String | toJavaString(String buf) Escape characters unallowed in the Java source files. return escape(buf, "\\u"); |
String | toJavaString(String text) to Java String String string = text; if (string != null) { string = string.replaceAll("\n", "\\\\n"); string = string.replaceAll("\r", "\\\\r"); string = string.replaceAll("\"", "\\\\\""); StringBuilder sb = new StringBuilder(); sb.append("\""); ... |
long | toJavaTime(double time) Convert from Hydra time in seconds since the epoch as a double to Java standard time in milliseconds since the epoch as a long. return (long) (1000d * time); |
String | toJavaTypeIdentifier(String string) Fashion a type identifier from the given string. StringBuilder sb = new StringBuilder(toJavaInstanceIdentifier(string)); sb.setCharAt(0, Character.toUpperCase(sb.charAt(0))); return sb.toString(); |
String | toJavaTypeName(String edmTypeName) Returns the name of the corresponding Java class or scalar type. String result = "Object"; if (edmTypeName.endsWith("Binary")) { result = "byte[]"; } else if (edmTypeName.endsWith("Boolean")) { result = "boolean"; } else if (edmTypeName.endsWith("DateTime")) { result = "Date"; } else if (edmTypeName.endsWith("DateTimeOffset")) { ... |