List of utility methods to do Class Field Convert To
String | fieldToColumnName(String name) field To Column Name if (name == null || name.isEmpty()) { return name; StringBuffer buf = new StringBuffer(name.replace('.', '_')); for (int i = 1; i < buf.length() - 1; i++) { if ('_' != buf.charAt(i - 1) && Character.isUpperCase(buf.charAt(i)) && !Character.isUpperCase(buf.charAt(i + 1))) { buf.insert(i++, '_'); ... |
String | fieldToGetMethod(String fieldName) field To Get Method return "get" + toFirstUpper(fieldName); |
String | fieldToProperty(String field) field To Property if (null == field) { return ""; char[] chars = field.toCharArray(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < chars.length; i++) { char c = chars[i]; if (c == '_') { ... |
String | fieldToPropertyName(String name) Best effort basis to convert the given method name to a property name return lowerFirst(name);
|
String | fieldToString(String name, Object value) Returns a string that allows a field value pair to be added to a debug string. return fieldToString(name, value, false);
|
long | fieldToValue(byte[] buffer, int offset, int length) Converts a field in a byte array into a value. long total = 0; long val = 0; for (int i = 0; i < length; i++) { val = buffer[offset + i]; if (val < 0) { val = val + 256; total += (long) Math.pow(256.0, (double) (length - 1 - i)) * val; ... |