Android Open Source - kvs-schema Schema Processor






From Project

Back to project page kvs-schema.

License

The source code is released under:

MIT License

If you think the Android project kvs-schema listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.rejasupotaro.android.kvs.internal;
//www.  ja  v  a 2  s.c om
import com.google.auto.service.AutoService;
import com.rejaupotaro.android.kvs.annotations.Table;

import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;

import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.Filer;
import javax.annotation.processing.ProcessingEnvironment;
import javax.annotation.processing.Processor;
import javax.annotation.processing.RoundEnvironment;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.TypeElement;
import javax.lang.model.util.Elements;
import javax.lang.model.util.Types;

@AutoService(Processor.class)
public class SchemaProcessor extends AbstractProcessor {
    private Elements elementUtils;
    private Types typeUtils;
    private Filer filer;

    @Override
    public Set<String> getSupportedAnnotationTypes() {
        return new LinkedHashSet<String>() {{
            add(Table.class.getName());
        }};
    }

    @Override
    public SourceVersion getSupportedSourceVersion() {
        return SourceVersion.latestSupported();
    }

    @Override
    public synchronized void init(ProcessingEnvironment env) {
        super.init(env);
        elementUtils = env.getElementUtils();
        typeUtils = env.getTypeUtils();
        filer = env.getFiler();
    }

    @Override
    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment env) {
        List<SchemaModel> models = EnvParser.parse(env, elementUtils);
        for (SchemaModel model : models) {
            SchemaWriter writer = new SchemaWriter(model);
            writer.write(filer);
        }
        return true;
    }
}




Java Source Code List

com.example.android.kvs.ApplicationTest.java
com.example.android.kvs.ExamplePrefsSchema.java
com.example.android.kvs.MainActivity.java
com.rejasupotaro.android.kvs.ApplicationTest.java
com.rejasupotaro.android.kvs.PrefSchema.java
com.rejasupotaro.android.kvs.Schema.java
com.rejasupotaro.android.kvs.internal.Classes.java
com.rejasupotaro.android.kvs.internal.EnvParser.java
com.rejasupotaro.android.kvs.internal.SchemaModel.java
com.rejasupotaro.android.kvs.internal.SchemaProcessor.java
com.rejasupotaro.android.kvs.internal.SchemaWriter.java
com.rejasupotaro.android.kvs.internal.StringUtils.java
com.rejasupotaro.android.kvs.internal.exceptions.TableNameDuplicateException.java
com.rejasupotaro.android.kvs.internal.exceptions.TableNameIsInvalidException.java
com.rejasupotaro.android.kvs.internal.exceptions.TableNameIsNotDefinedException.java
com.rejaupotaro.android.kvs.annotations.Key.java
com.rejaupotaro.android.kvs.annotations.Table.java