com.fasterxml.jackson.databind.PropertyNamingStrategy.java Source code

Java tutorial

Introduction

Here is the source code for com.fasterxml.jackson.databind.PropertyNamingStrategy.java

Source

package com.fasterxml.jackson.databind;

import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.introspect.AnnotatedField;
import com.fasterxml.jackson.databind.introspect.AnnotatedMethod;
import com.fasterxml.jackson.databind.introspect.AnnotatedParameter;
import java.io.Serializable;

public abstract class PropertyNamingStrategy implements Serializable {
    public static final PropertyNamingStrategy CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES = new LowerCaseWithUnderscoresStrategy();
    public static final PropertyNamingStrategy PASCAL_CASE_TO_CAMEL_CASE = new PascalCaseStrategy();

    public String nameForConstructorParameter(MapperConfig<?> paramMapperConfig,
            AnnotatedParameter paramAnnotatedParameter, String paramString) {
        return paramString;
    }

    public String nameForField(MapperConfig<?> paramMapperConfig, AnnotatedField paramAnnotatedField,
            String paramString) {
        return paramString;
    }

    public String nameForGetterMethod(MapperConfig<?> paramMapperConfig, AnnotatedMethod paramAnnotatedMethod,
            String paramString) {
        return paramString;
    }

    public String nameForSetterMethod(MapperConfig<?> paramMapperConfig, AnnotatedMethod paramAnnotatedMethod,
            String paramString) {
        return paramString;
    }

    public static class LowerCaseWithUnderscoresStrategy extends PropertyNamingStrategy.PropertyNamingStrategyBase {
public String translate(String paramString)
{
  if (paramString == null)
    return paramString;
  int i = paramString.length();
  StringBuilder localStringBuilder = new StringBuilder(i * 2);
  int j = 0;
  int k = 0;
  int m = 0;
  label31: char c1;
  int i1;
  int n;
  char c2;
  if (j < i)
  {
    c1 = paramString.charAt(j);
    if ((j <= 0) && (c1 == '_'))
      break label163;
    if (Character.isUpperCase(c1))
    {
      if ((k == 0) && (m > 0) && (localStringBuilder.charAt(m - 1) != '_'))
      {
        localStringBuilder.append('_');
        m++;
      }
      char c3 = Character.toLowerCase(c1);
      i1 = 1;
      n = m;
      c2 = c3;
      label116: localStringBuilder.append(c2);
      m = n + 1;
    }
  }
  while (true)
  {
    j++;
    k = i1;
    break label31;
    n = m;
    c2 = c1;
    i1 = 0;
    break label116;
    if (m <= 0)
      break;
    return localStringBuilder.toString();
    label163: i1 = k;
  }
}
    }

    public static class PascalCaseStrategy extends PropertyNamingStrategy.PropertyNamingStrategyBase {
        public String translate(String paramString) {
            if ((paramString == null) || (paramString.length() == 0))
                ;
            char c;
            do {
                return paramString;
                c = paramString.charAt(0);
            } while (Character.isUpperCase(c));
            StringBuilder localStringBuilder = new StringBuilder(paramString);
            localStringBuilder.setCharAt(0, Character.toUpperCase(c));
            return localStringBuilder.toString();
        }
    }

    public static abstract class PropertyNamingStrategyBase extends PropertyNamingStrategy {
        public String nameForConstructorParameter(MapperConfig<?> paramMapperConfig,
                AnnotatedParameter paramAnnotatedParameter, String paramString) {
            return translate(paramString);
        }

        public String nameForField(MapperConfig<?> paramMapperConfig, AnnotatedField paramAnnotatedField,
                String paramString) {
            return translate(paramString);
        }

        public String nameForGetterMethod(MapperConfig<?> paramMapperConfig, AnnotatedMethod paramAnnotatedMethod,
                String paramString) {
            return translate(paramString);
        }

        public String nameForSetterMethod(MapperConfig<?> paramMapperConfig, AnnotatedMethod paramAnnotatedMethod,
                String paramString) {
            return translate(paramString);
        }

        public abstract String translate(String paramString);
    }
}

/* Location:           /Users/dantheman/src/fffffffffattttt/basis/classes_dex2jar.jar
 * Qualified Name:     com.fasterxml.jackson.databind.PropertyNamingStrategy
 * JD-Core Version:    0.6.2
 */