diff --git a/.gitignore b/.gitignore
index 1d8aeb1d1..7152ec996 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,7 +28,4 @@
/EssentialsPermissionsCommands/dist/
/Essentials/nbproject/private/
/Essentials/dist/
-/Essentials/build/
-/YamlAnnotations/nbproject/private/
-/YamlAnnotations/build/
-/YamlAnnotations/dist/
\ No newline at end of file
+/Essentials/build/
\ No newline at end of file
diff --git a/Essentials/nbproject/build-impl.xml b/Essentials/nbproject/build-impl.xml
index c01a2f393..21661c925 100644
--- a/Essentials/nbproject/build-impl.xml
+++ b/Essentials/nbproject/build-impl.xml
@@ -601,13 +601,6 @@ is divided into following sections:
-
-
-
-
-
-
-
@@ -1045,13 +1038,6 @@ is divided into following sections:
-
-
-
-
-
-
-
diff --git a/Essentials/nbproject/genfiles.properties b/Essentials/nbproject/genfiles.properties
index 62b47eb30..9242cfd2b 100644
--- a/Essentials/nbproject/genfiles.properties
+++ b/Essentials/nbproject/genfiles.properties
@@ -3,8 +3,8 @@ build.xml.script.CRC32=3233ee78
build.xml.stylesheet.CRC32=28e38971@1.38.2.45
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
-nbproject/build-impl.xml.data.CRC32=1d87756b
-nbproject/build-impl.xml.script.CRC32=c2ee0b8b
+nbproject/build-impl.xml.data.CRC32=4b596d89
+nbproject/build-impl.xml.script.CRC32=dbc81ee1
nbproject/build-impl.xml.stylesheet.CRC32=0ae3a408@1.44.1.45
nbproject/profiler-build-impl.xml.data.CRC32=ab78ce15
nbproject/profiler-build-impl.xml.script.CRC32=abda56ed
diff --git a/Essentials/nbproject/project.properties b/Essentials/nbproject/project.properties
index 407a3dd9c..8df8ef4d2 100644
--- a/Essentials/nbproject/project.properties
+++ b/Essentials/nbproject/project.properties
@@ -1,7 +1,6 @@
annotation.processing.enabled=true
-annotation.processing.enabled.in.editor=true
-annotation.processing.processors.list=me.snowleo.yaml.YamlPropertyProcessor
-annotation.processing.run.all.processors=false
+annotation.processing.enabled.in.editor=false
+annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
application.title=Essentials
application.vendor=
@@ -83,8 +82,7 @@ javac.classpath=\
${file.reference.iCo6.jar}:\
${file.reference.MultiCurrency.jar}:\
${file.reference.BOSEconomy7.jar}:\
- ${file.reference.PermissionsEx.jar}:\
- ${reference.YamlAnnotations.jar}
+ ${file.reference.PermissionsEx.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
@@ -121,8 +119,6 @@ jnlp.signing.keystore=
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=true
platform.active=default_platform
-project.YamlAnnotations=../YamlAnnotations
-reference.YamlAnnotations.jar=${project.YamlAnnotations}/dist/YamlAnnotations.jar
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
diff --git a/Essentials/nbproject/project.xml b/Essentials/nbproject/project.xml
index 2efbc1ef0..354722f09 100644
--- a/Essentials/nbproject/project.xml
+++ b/Essentials/nbproject/project.xml
@@ -14,15 +14,6 @@
../lib/nblibraries.properties
-
-
- YamlAnnotations
- jar
-
- jar
- clean
- jar
-
-
+
diff --git a/Essentials/src/com/earth2me/essentials/yaml/BaseYaml.java b/Essentials/src/com/earth2me/essentials/yaml/BaseYaml.java
deleted file mode 100644
index ab689ca5d..000000000
--- a/Essentials/src/com/earth2me/essentials/yaml/BaseYaml.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.earth2me.essentials.yaml;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-
-public abstract class BaseYaml
-{
-
- protected BaseYaml()
- {
- }
-
- protected abstract Class extends T> getClazz();
-
- public T load() {
- try
- {
- return getClazz().newInstance();
- }
- catch (InstantiationException ex)
- {
- Logger.getLogger(BaseYaml.class.getName()).log(Level.SEVERE, null, ex);
- }
- catch (IllegalAccessException ex)
- {
- Logger.getLogger(BaseYaml.class.getName()).log(Level.SEVERE, null, ex);
- }
- return null;
- }
-}
diff --git a/Essentials/src/com/earth2me/essentials/yaml/ConfigLoader.java b/Essentials/src/com/earth2me/essentials/yaml/ConfigLoader.java
deleted file mode 100644
index 7058a501f..000000000
--- a/Essentials/src/com/earth2me/essentials/yaml/ConfigLoader.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.earth2me.essentials.yaml;
-
-
-public class ConfigLoader
-{
-
- public ConfigLoader()
- {
- new Settings();
- }
-
-}
diff --git a/Essentials/src/com/earth2me/essentials/yaml/General.java b/Essentials/src/com/earth2me/essentials/yaml/General.java
deleted file mode 100644
index 1d376ada6..000000000
--- a/Essentials/src/com/earth2me/essentials/yaml/General.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package com.earth2me.essentials.yaml;
-
-import java.io.Serializable;
-
-
-public class General implements Serializable
-{
- private boolean debug = false;
- private boolean updateCheck = true;
- private String location = "null";
-
- public General()
- {
- }
-
- public boolean isDebug()
- {
- return debug;
- }
-
- public void setDebug(final boolean debug)
- {
- this.debug = debug;
- }
-
- public boolean isUpdateCheck()
- {
- return updateCheck;
- }
-
- public void setUpdateCheck(final boolean updateCheck)
- {
- this.updateCheck = updateCheck;
- }
-
- public boolean isStupid()
- {
- return true;
- }
-
- public void setStupid(final boolean bla)
- {
- return;
- }
-
- public String getLocation()
- {
- return location;
- }
-
- public void setLocation(final String location)
- {
- this.location = location;
- }
-}
diff --git a/Essentials/src/com/earth2me/essentials/yaml/Settings.java b/Essentials/src/com/earth2me/essentials/yaml/Settings.java
deleted file mode 100644
index ad236b964..000000000
--- a/Essentials/src/com/earth2me/essentials/yaml/Settings.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.earth2me.essentials.yaml;
-
-import me.snowleo.yaml.YamlClass;
-import me.snowleo.yaml.YamlComment;
-
-//@YamlClass
-public class Settings //extends SettingsYaml
-{
- //@YamlComment(comment = "Hello")
- protected General test = new General();
- protected boolean test3;
- boolean test2 = true;
-
- public Settings() {
- }
-
-}
diff --git a/Essentials/test/com/earth2me/essentials/YamlTest.java b/Essentials/test/com/earth2me/essentials/YamlTest.java
deleted file mode 100644
index 297ff894c..000000000
--- a/Essentials/test/com/earth2me/essentials/YamlTest.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.earth2me.essentials;
-
-import junit.framework.TestCase;
-import org.yaml.snakeyaml.DumperOptions;
-import org.yaml.snakeyaml.Yaml;
-import org.yaml.snakeyaml.nodes.Tag;
-import com.earth2me.essentials.yaml.Settings;
-import org.bukkit.Location;
-import org.bukkit.World.Environment;
-import org.yaml.snakeyaml.constructor.Constructor;
-
-
-public class YamlTest extends TestCase
-{
- public YamlTest()
- {
- }
-
- public void testYaml()
- {
- final DumperOptions options = new DumperOptions();
- options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
- options.setExplicitRoot(Tag.MAP);
- final Yaml yaml = new Yaml(options);
- //Settings settings = (Settings)yaml.load("");
- /*Settings set1 = new Settings();
- //final String dump = yaml.dump(set1);
- //final Yaml yaml2 = new Yaml(new Constructor(Settings.class));
- //final Settings set = (Settings)yaml2.load(dump);
- if (set != null)
- {
- //assert set.getGeneral().getLocation() == null;
- //assert set.equals(new Settings());
- System.out.println(dump);
- }*/
- }
-}
diff --git a/YamlAnnotations/build.xml b/YamlAnnotations/build.xml
deleted file mode 100644
index 6c2177662..000000000
--- a/YamlAnnotations/build.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-
-
-
-
-
-
-
-
-
-
- Builds, tests, and runs the project YamlAnnotations.
-
-
-
diff --git a/YamlAnnotations/manifest.mf b/YamlAnnotations/manifest.mf
deleted file mode 100644
index 328e8e5bc..000000000
--- a/YamlAnnotations/manifest.mf
+++ /dev/null
@@ -1,3 +0,0 @@
-Manifest-Version: 1.0
-X-COMMENT: Main-Class will be added automatically by build
-
diff --git a/YamlAnnotations/nbproject/build-impl.xml b/YamlAnnotations/nbproject/build-impl.xml
deleted file mode 100644
index de52ad5c0..000000000
--- a/YamlAnnotations/nbproject/build-impl.xml
+++ /dev/null
@@ -1,1067 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Must set src.dir
- Must set test.src.dir
- Must set build.dir
- Must set dist.dir
- Must set build.classes.dir
- Must set dist.javadoc.dir
- Must set build.test.classes.dir
- Must set build.test.results.dir
- Must set build.classes.excludes
- Must set dist.jar
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Must set javac.includes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Must set JVM to use for profiling in profiler.info.jvm
- Must set profiler agent JVM arguments in profiler.info.jvmargs.agent
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Must select some files in the IDE or set javac.includes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- To run this application from the command line without Ant, try:
-
-
-
-
-
-
- java -cp "${run.classpath.with.dist.jar}" ${main.class}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- To run this application from the command line without Ant, try:
-
- java -jar "${dist.jar.resolved}"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Must select one file in the IDE or set run.class
-
-
-
- Must select one file in the IDE or set run.class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Must select one file in the IDE or set debug.class
-
-
-
-
- Must select one file in the IDE or set debug.class
-
-
-
-
- Must set fix.includes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Must select one file in the IDE or set profile.class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Must select some files in the IDE or set javac.includes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Some tests failed; see details above.
-
-
-
-
-
-
-
-
- Must select some files in the IDE or set test.includes
-
-
-
- Some tests failed; see details above.
-
-
-
-
- Must select one file in the IDE or set test.class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Must select one file in the IDE or set applet.url
-
-
-
-
-
-
-
-
- Must select one file in the IDE or set applet.url
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/YamlAnnotations/nbproject/genfiles.properties b/YamlAnnotations/nbproject/genfiles.properties
deleted file mode 100644
index 55d30716f..000000000
--- a/YamlAnnotations/nbproject/genfiles.properties
+++ /dev/null
@@ -1,8 +0,0 @@
-build.xml.data.CRC32=6b9374e7
-build.xml.script.CRC32=b35f5bf5
-build.xml.stylesheet.CRC32=28e38971@1.44.1.45
-# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
-# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
-nbproject/build-impl.xml.data.CRC32=6b9374e7
-nbproject/build-impl.xml.script.CRC32=822a2f91
-nbproject/build-impl.xml.stylesheet.CRC32=0ae3a408@1.44.1.45
diff --git a/YamlAnnotations/nbproject/project.properties b/YamlAnnotations/nbproject/project.properties
deleted file mode 100644
index 6f85622cc..000000000
--- a/YamlAnnotations/nbproject/project.properties
+++ /dev/null
@@ -1,71 +0,0 @@
-annotation.processing.enabled=true
-annotation.processing.enabled.in.editor=false
-annotation.processing.processor.options=
-annotation.processing.processors.list=
-annotation.processing.run.all.processors=true
-annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
-build.classes.dir=${build.dir}/classes
-build.classes.excludes=**/*.java,**/*.form
-# This directory is removed when the project is cleaned:
-build.dir=build
-build.generated.dir=${build.dir}/generated
-build.generated.sources.dir=${build.dir}/generated-sources
-# Only compile against the classpath explicitly listed here:
-build.sysclasspath=ignore
-build.test.classes.dir=${build.dir}/test/classes
-build.test.results.dir=${build.dir}/test/results
-# Uncomment to specify the preferred debugger connection transport:
-#debug.transport=dt_socket
-debug.classpath=\
- ${run.classpath}
-debug.test.classpath=\
- ${run.test.classpath}
-# This directory is removed when the project is cleaned:
-dist.dir=dist
-dist.jar=${dist.dir}/YamlAnnotations.jar
-dist.javadoc.dir=${dist.dir}/javadoc
-excludes=
-includes=**
-jar.compress=false
-javac.classpath=
-# Space-separated list of extra javac options
-javac.compilerargs=
-javac.deprecation=false
-javac.processorpath=\
- ${javac.classpath}
-javac.source=1.6
-javac.target=1.6
-javac.test.classpath=\
- ${javac.classpath}:\
- ${build.classes.dir}
-javac.test.processorpath=\
- ${javac.test.classpath}
-javadoc.additionalparam=
-javadoc.author=false
-javadoc.encoding=${source.encoding}
-javadoc.noindex=false
-javadoc.nonavbar=false
-javadoc.notree=false
-javadoc.private=false
-javadoc.splitindex=true
-javadoc.use=true
-javadoc.version=false
-javadoc.windowtitle=
-main.class=
-manifest.file=manifest.mf
-meta.inf.dir=${src.dir}/META-INF
-mkdist.disabled=false
-platform.active=default_platform
-run.classpath=\
- ${javac.classpath}:\
- ${build.classes.dir}
-# Space-separated list of JVM arguments used when running the project
-# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
-# or test-sys-prop.name=value to set system properties for unit tests):
-run.jvmargs=
-run.test.classpath=\
- ${javac.test.classpath}:\
- ${build.test.classes.dir}
-source.encoding=UTF-8
-src.dir=src
-test.src.dir=test
diff --git a/YamlAnnotations/nbproject/project.xml b/YamlAnnotations/nbproject/project.xml
deleted file mode 100644
index 4ef3e3ff7..000000000
--- a/YamlAnnotations/nbproject/project.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
- org.netbeans.modules.java.j2seproject
-
-
- YamlAnnotations
-
-
-
-
-
-
-
-
- ../lib/nblibraries.properties
-
-
-
diff --git a/YamlAnnotations/src/me/snowleo/yaml/YamlClass.java b/YamlAnnotations/src/me/snowleo/yaml/YamlClass.java
deleted file mode 100644
index e98a0fc38..000000000
--- a/YamlAnnotations/src/me/snowleo/yaml/YamlClass.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package me.snowleo.yaml;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-
-@Target(ElementType.TYPE)
-public @interface YamlClass
-{
-}
-
diff --git a/YamlAnnotations/src/me/snowleo/yaml/YamlComment.java b/YamlAnnotations/src/me/snowleo/yaml/YamlComment.java
deleted file mode 100644
index 5e8ba04e4..000000000
--- a/YamlAnnotations/src/me/snowleo/yaml/YamlComment.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package me.snowleo.yaml;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-
-@Target(ElementType.FIELD)
-public @interface YamlComment
-{
- String[] comment() default "";
-}
-
diff --git a/YamlAnnotations/src/me/snowleo/yaml/YamlPropertyProcessor.java b/YamlAnnotations/src/me/snowleo/yaml/YamlPropertyProcessor.java
deleted file mode 100644
index c56b51b61..000000000
--- a/YamlAnnotations/src/me/snowleo/yaml/YamlPropertyProcessor.java
+++ /dev/null
@@ -1,238 +0,0 @@
-package me.snowleo.yaml;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import javax.annotation.processing.AbstractProcessor;
-import javax.annotation.processing.Filer;
-import javax.annotation.processing.Messager;
-import javax.annotation.processing.ProcessingEnvironment;
-import javax.annotation.processing.RoundEnvironment;
-import javax.annotation.processing.SupportedAnnotationTypes;
-import javax.annotation.processing.SupportedSourceVersion;
-import javax.lang.model.SourceVersion;
-import javax.lang.model.element.Element;
-import javax.lang.model.element.ElementKind;
-import javax.lang.model.element.Modifier;
-import javax.lang.model.element.TypeElement;
-import javax.lang.model.element.VariableElement;
-import javax.lang.model.type.TypeMirror;
-import javax.lang.model.util.ElementFilter;
-import javax.lang.model.util.Elements;
-import javax.tools.Diagnostic;
-import javax.tools.JavaFileObject;
-
-
-@SupportedAnnotationTypes("me.snowleo.yaml.YamlClass")
-@SupportedSourceVersion(SourceVersion.RELEASE_6)
-public class YamlPropertyProcessor extends AbstractProcessor
-{
- private transient Filer filer;
- private transient Messager messager;
- private Elements eltUtils;
-
- public YamlPropertyProcessor()
- {
- super();
- }
-
- @Override
- public void init(final ProcessingEnvironment processingEnv)
- {
- super.init(processingEnv);
- filer = processingEnv.getFiler();
- messager = processingEnv.getMessager();
- eltUtils = processingEnv.getElementUtils();
- }
-
- @Override
- public boolean process(final Set extends TypeElement> set, final RoundEnvironment roundEnv)
- {
- for (Element elem : roundEnv.getElementsAnnotatedWith(YamlClass.class))
- {
- if (elem.getKind() != ElementKind.CLASS)
- {
- messager.printMessage(Diagnostic.Kind.ERROR, "YamlClass has to be a class", elem);
- continue;
- }
- final TypeElement clazz = (TypeElement)elem;
- String superClassName = clazz.getSuperclass().toString();
- if (!superClassName.startsWith(clazz.getEnclosingElement().toString()))
- {
- superClassName = clazz.getEnclosingElement().toString() + "." + superClassName;
- }
- if (!superClassName.equalsIgnoreCase(clazz.getQualifiedName().toString() + "Yaml"))
- {
- messager.printMessage(Diagnostic.Kind.ERROR, "YamlClass must be extended by " + clazz.getQualifiedName().toString() + "Yaml", elem);
- continue;
- }
- final List fields = new ArrayList();
- for (VariableElement field : ElementFilter.fieldsIn(clazz.getEnclosedElements()))
- {
- if (!(field.getModifiers().contains(Modifier.STATIC))
- && field.getModifiers().contains(Modifier.PROTECTED))
- {
- fields.add(field);
- }
- else if (field.getAnnotation(YamlComment.class) != null)
- {
- messager.printMessage(Diagnostic.Kind.ERROR, "YamlComment fields have to be nonstatic and protected.", field);
- continue;
- }
- }
- if (fields.isEmpty())
- {
- messager.printMessage(Diagnostic.Kind.ERROR, "YamlClass needs at least one protected field.", clazz);
- continue;
- }
- createImplclass(clazz, fields);
- createSuperclass(clazz, fields);
- }
- return true;
- }
-
- private void createSuperclass(final TypeElement clazz, final List fields)
- {
- try
- {
- final JavaFileObject file = filer.createSourceFile(clazz.getQualifiedName() + "Yaml");
- messager.printMessage(Diagnostic.Kind.NOTE, "Creating " + file.toUri());
-
- final Writer writer = file.openWriter();
- //Add the content to the newly generated file.
-
- final PrintWriter pwriter = new PrintWriter(writer);
- try
- {
- pwriter.print("package ");
- pwriter.print(clazz.getEnclosingElement());
- pwriter.println(';');
- pwriter.println();
- pwriter.print("public class ");
- pwriter.print(clazz.getSimpleName());
- pwriter.print("Yaml extends BaseYaml<");
- pwriter.print(clazz.getSimpleName());
- pwriter.println("> {");
-
- pwriter.println(" @Override");
- pwriter.print(" protected Class<");
- pwriter.print(clazz.getSimpleName());
- pwriter.print("YamlImpl> getClazz() { return ");
- pwriter.print(clazz.getSimpleName());
- pwriter.println("YamlImpl.class; };");
-
- for (VariableElement var : fields)
- {
- final TypeMirror type = var.asType();
- final String name = capitalize(var.getSimpleName().toString());
- pwriter.print(" public ");
- pwriter.print(type.toString());
- if (type.toString().equalsIgnoreCase("boolean"))
- {
- pwriter.print(" is");
- }
- else
- {
- pwriter.print(" get");
- }
- pwriter.print(name);
- pwriter.println("() { throw new AssertionError(\"Cannot be called.\"); }");
- pwriter.print(" public void set");
- pwriter.print(name);
- pwriter.print("(final ");
- pwriter.print(type.toString());
- pwriter.print(' ');
- pwriter.print(name);
- pwriter.println(") { throw new AssertionError(\"Cannot be called.\"); }");
- }
- pwriter.println("}");
- pwriter.flush();
- }
- finally
- {
- pwriter.close();
- }
- }
- catch (IOException ex)
- {
- messager.printMessage(Diagnostic.Kind.ERROR, ex.toString());
- }
- }
-
- private void createImplclass(final TypeElement clazz, final List fields)
- {
- try
- {
- final JavaFileObject file = filer.createSourceFile(clazz.getQualifiedName() + "YamlImpl");
- messager.printMessage(Diagnostic.Kind.NOTE, "Creating " + file.toUri());
-
- final Writer writer = file.openWriter();
- //Add the content to the newly generated file.
-
- final PrintWriter pwriter = new PrintWriter(writer);
- try
- {
- pwriter.print("package ");
- pwriter.print(clazz.getEnclosingElement());
- pwriter.println(';');
- pwriter.println();
- pwriter.print("public class ");
- pwriter.print(clazz.getSimpleName());
- pwriter.print("YamlImpl extends ");
- pwriter.print(clazz.getSimpleName());
- pwriter.println(" {");
-
- for (VariableElement var : fields)
- {
- final TypeMirror type = var.asType();
- final String name = capitalize(var.getSimpleName().toString());
- pwriter.print(" public ");
- pwriter.print(type.toString());
- if (type.toString().equalsIgnoreCase("boolean"))
- {
- pwriter.print(" is");
- }
- else
- {
- pwriter.print(" get");
- }
- pwriter.print(name);
- pwriter.print("() { return this.");
- pwriter.print(var.getSimpleName().toString());
- pwriter.println("; }");
- pwriter.print(" public void set");
- pwriter.print(name);
- pwriter.print("(final ");
- pwriter.print(type.toString());
- pwriter.print(' ');
- pwriter.print(name);
- pwriter.print(") { this.");
- pwriter.print(var.getSimpleName().toString());
- pwriter.print(" = ");
- pwriter.print(name);
- pwriter.println("; }");
- }
- pwriter.println("}");
- pwriter.flush();
- }
- finally
- {
- pwriter.close();
- }
- }
- catch (IOException ex)
- {
- messager.printMessage(Diagnostic.Kind.ERROR, ex.toString());
- }
- }
-
- private static String capitalize(String name)
- {
- char[] c = name.toCharArray();
- c[0] = Character.toUpperCase(c[0]);
- return new String(c);
- }
-}