Package com.arconsis.android.datarobot.builder.schema.data

Examples of com.arconsis.android.datarobot.builder.schema.data.Table


  @Override
  public Table read() {
    int primaryKeyCount = 0;
    boolean noArgsConstructor = false;

    Table table = new Table(entity.getSimpleName().toString(), entity.toString());

    Map<String, AtomicInteger> countedToManyAssociations = new HashMap<String, AtomicInteger>();

    for (Element child : entity.getEnclosedElements()) {
      if (child.accept(new EmptyContructorVisitor(), null) != null) {
        noArgsConstructor = true;
      }

      VariableElement column = child.accept(new ColumnElementResolvingTypeVisitor(), null);
      if (column != null) {
        if (hasAmbiguosAssociationDeclaration(column)) {
          return null;
        }
        if (column.getAnnotation(PrimaryKey.class) != null && ++primaryKeyCount > 1) {
          messager.printMessage(Kind.ERROR, "Only one @PrimaryKey is allowed within an @Entity", entity);
          return null;
        }
        ColumnReader columnReader = new ColumnReader(column, messager);
        Column read = columnReader.read();
        if (read != null) {
          table.addColumn(read);
        }
      }

      VariableElement association = child.accept(new AssociationElementResolvingTypeVisitor(), null);
      if (association != null) {
        AssociationReader associationReader = new AssociationReader(association, entityNames, messager);
        Association read = associationReader.read();
        if (read != null) {
          table.addAssociation(read);

          if (AssociationType.TO_MANY == read.getCardinality()) {
            if (countedToManyAssociations.containsKey(read.getCanonicalTypeInEntity())) {
              countedToManyAssociations.get(read.getCanonicalTypeInEntity()).incrementAndGet();
            } else {
View Full Code Here


  public Schema read() {
    Schema schema = new Schema(persistence.dbName(), persistence.dbVersion(), updateHookClassName, createHookClassName);
    for (Element element : entities) {
      TypeElement entity = element.accept(new TypeResolvingVisitor(), null);
      TableReader tableReader = new TableReader(entity, entityNames, messager);
      Table read = tableReader.read();
      if (read != null) {
        schema.addTable(read);
      }
    }
    return schema;
View Full Code Here

  public Schema read() {
    Schema schema = new Schema(persistence.dbName(), persistence.dbVersion(), updateHookClassName);
    for (Element element : entities) {
      TypeElement entity = element.accept(new TypeResolvingVisitor(), null);
      TableReader tableReader = new TableReader(entity, entityNames, messager);
      Table read = tableReader.read();
      if (read != null) {
        schema.addTable(read);
      }
    }
    return schema;
View Full Code Here

TOP

Related Classes of com.arconsis.android.datarobot.builder.schema.data.Table

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.