Java Utililty Methods Class Field Convert To

List of utility methods to do Class Field Convert To

Description

The list of methods to do Class Field Convert To are organized into topic(s).

Method

StringfieldToColumnName(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++, '_');
...
StringfieldToGetMethod(String fieldName)
field To Get Method
return "get" + toFirstUpper(fieldName);
StringfieldToProperty(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 == '_') {
...
StringfieldToPropertyName(String name)
Best effort basis to convert the given method name to a property name
return lowerFirst(name);
StringfieldToString(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);
longfieldToValue(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;
...