// Path: processor/src/main/java/net/yslibrary/simplepreferences/processor/KeyAnnotatedField.java
// public class KeyAnnotatedField {
// 
//   public final VariableElement annotatedElement;
//   public final TypeName type;
//   public final String name;
//   public final String preferenceKey;
//   public final boolean omitGetterPrefix;
//   public final boolean needCommitMethod;
// 
//   public KeyAnnotatedField(VariableElement element) throws ProcessingException {
//     if (element.getModifiers().contains(Modifier.PRIVATE)) {
//       throw new ProcessingException(element,
//           "Field %s is private, must be accessible from inherited class", element.getSimpleName());
//     }
//     annotatedElement = element;
// 
//     type = TypeName.get(element.asType());
// 
//     Key annotation = element.getAnnotation(Key.class);
//     name = element.getSimpleName().toString();
//     preferenceKey = Strings.isNullOrEmpty(annotation.name()) ? Utils.lowerCamelToLowerSnake(name)
//         : annotation.name();
//     omitGetterPrefix = annotation.omitGetterPrefix();
//     needCommitMethod = annotation.needCommitMethod();
//   }
// }
// 
// Path: processor/src/main/java/net/yslibrary/simplepreferences/processor/Utils.java
// public class Utils {
// 
//   public static String lowerToUpperCamel(String name) {
//     return CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, name);
//   }
// 
//   public static String lowerCamelToLowerSnake(String name) {
//     return CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, name);
//   }
// }


import com.squareup.javapoet.FieldSpec;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.TypeName;
import net.yslibrary.simplepreferences.processor.KeyAnnotatedField;
import net.yslibrary.simplepreferences.processor.Utils;
import java.util.ArrayList;
import java.util.List;
import javax.lang.model.element.Modifier;
package net.yslibrary.simplepreferences.processor.writer;





/**
 * Created by yshrsmz on 2016/02/23.
 */
public abstract class BaseTypeWriter implements TypeWriter {
  final static String BOOLEAN_GETTER_PREFIX = "is";
  final static String SETTER_PREFIX = "set";
  final static String WITH_COMMIT_SUFFIX = "WithCommit";
  final static String PARAM_VALUE = "value";
  final static String PARAM_DEFAULT_VALUE = "defaultValue";
  final static String GETTER_PREFIX = "get";
  private final static String EXIST_PREFIX = "has";
  private final static String REMOVE_PREFIX = "remove";
  final TypeName enclosingClassName;
// Path: processor/src/main/java/net/yslibrary/simplepreferences/processor/KeyAnnotatedField.java
// public class KeyAnnotatedField {
// 
//   public final VariableElement annotatedElement;
//   public final TypeName type;
//   public final String name;
//   public final String preferenceKey;
//   public final boolean omitGetterPrefix;
//   public final boolean needCommitMethod;
// 
//   public KeyAnnotatedField(VariableElement element) throws ProcessingException {
//     if (element.getModifiers().contains(Modifier.PRIVATE)) {
//       throw new ProcessingException(element,
//           "Field %s is private, must be accessible from inherited class", element.getSimpleName());
//     }
//     annotatedElement = element;
// 
//     type = TypeName.get(element.asType());
// 
//     Key annotation = element.getAnnotation(Key.class);
//     name = element.getSimpleName().toString();
//     preferenceKey = Strings.isNullOrEmpty(annotation.name()) ? Utils.lowerCamelToLowerSnake(name)
//         : annotation.name();
//     omitGetterPrefix = annotation.omitGetterPrefix();
//     needCommitMethod = annotation.needCommitMethod();
//   }
// }
// 
// Path: processor/src/main/java/net/yslibrary/simplepreferences/processor/Utils.java
// public class Utils {
// 
//   public static String lowerToUpperCamel(String name) {
//     return CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, name);
//   }
// 
//   public static String lowerCamelToLowerSnake(String name) {
//     return CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, name);
//   }
// }


// Path: processor/src/main/java/net/yslibrary/simplepreferences/processor/writer/BaseTypeWriter.java
import com.squareup.javapoet.FieldSpec;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.TypeName;
import net.yslibrary.simplepreferences.processor.KeyAnnotatedField;
import net.yslibrary.simplepreferences.processor.Utils;
import java.util.ArrayList;
import java.util.List;
import javax.lang.model.element.Modifier;

package net.yslibrary.simplepreferences.processor.writer;





/**
 * Created by yshrsmz on 2016/02/23.
 */
public abstract class BaseTypeWriter implements TypeWriter {
  final static String BOOLEAN_GETTER_PREFIX = "is";
  final static String SETTER_PREFIX = "set";
  final static String WITH_COMMIT_SUFFIX = "WithCommit";
  final static String PARAM_VALUE = "value";
  final static String PARAM_DEFAULT_VALUE = "defaultValue";
  final static String GETTER_PREFIX = "get";
  private final static String EXIST_PREFIX = "has";
  private final static String REMOVE_PREFIX = "remove";
  final TypeName enclosingClassName;
  final KeyAnnotatedField annotatedField;