001package io.ebeaninternal.dbmigration.model.build; 002 003import io.ebeaninternal.dbmigration.model.MTable; 004import io.ebeaninternal.server.deploy.visitor.VisitProperties; 005import io.ebeaninternal.server.deploy.BeanDescriptor; 006import io.ebeaninternal.server.deploy.BeanPropertyAssocMany; 007import io.ebeaninternal.server.deploy.BeanTable; 008 009/** 010 * Add the element collection table to the model. 011 */ 012public class ModelBuildElementTable { 013 014 /** 015 * Build and add the MTable model for the ElementCollection property. 016 */ 017 public static void build(ModelBuildContext ctx, BeanPropertyAssocMany<?> manyProp) { 018 019 BeanTable beanTable = manyProp.beanTable(); 020 BeanDescriptor<?> targetDescriptor = manyProp.targetDescriptor(); 021 MTable table = new MTable(beanTable.getBaseTable()); 022 023 VisitProperties.visit(targetDescriptor, new ModelBuildPropertyVisitor(ctx, table, targetDescriptor)); 024 ctx.addTableElementCollection(table); 025 } 026 027}