Back to project page kvs-schema.
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.
package com.rejasupotaro.android.kvs.internal; /*www. j ava2s . co m*/ import com.rejasupotaro.android.kvs.internal.exceptions.TableNameDuplicateException; import com.rejasupotaro.android.kvs.internal.exceptions.TableNameIsNotDefinedException; import com.rejaupotaro.android.kvs.annotations.Table; import java.util.ArrayList; import java.util.List; import javax.annotation.processing.RoundEnvironment; import javax.lang.model.element.Element; import javax.lang.model.element.TypeElement; import javax.lang.model.util.Elements; public final class EnvParser { public static List<SchemaModel> parse(RoundEnvironment env, Elements elementUtils) { ArrayList<SchemaModel> models = new ArrayList<>(); ArrayList<Element> elements = new ArrayList<>(env.getElementsAnnotatedWith(Table.class)); for (Element element : elements) { SchemaModel model = new SchemaModel((TypeElement) element, elementUtils); models.add(model); } validateSchemaModel(models); return models; } public static void validateSchemaModel(List<SchemaModel> models) { List<String> tableNames = new ArrayList<>(); for (SchemaModel model : models) { String tableName = model.getTableName(); if (tableName == null || tableName.equals("")) { String originalClassName = model.getOriginalClassName(); throw new TableNameIsNotDefinedException(originalClassName + " should define table name"); } if (tableNames.contains(tableName)) { throw new TableNameDuplicateException("table name \"" + tableName + "\" is already defined"); } tableNames.add(tableName); } } }