private void buildDeployTree() { for (DeployInheritInfo info : deployMap.values()) { if (!info.isRoot()) { DeployInheritInfo parent = getInfo(info.getParent()); parent.addChild(info); } } }
private void buildFinalTree() { for (DeployInheritInfo deploy : deployMap.values()) { if (deploy.isRoot()) { // build tree top down... createFinalInfo(null, null, deploy); } } }
private DeployInheritInfo createInfo(Class<?> cls) { DeployInheritInfo info = new DeployInheritInfo(cls); Class<?> parent = findParent(cls); if (parent != null) { info.setParent(parent); } else { // its the root of inheritance tree... } Inheritance ia = (Inheritance) cls.getAnnotation(Inheritance.class); if (ia != null) { ia.strategy(); } DiscriminatorColumn da = (DiscriminatorColumn) cls.getAnnotation(DiscriminatorColumn.class); if (da != null) { // lowercase the discriminator column for RawSql and JSON info.setDiscriminatorColumn(da.name().toLowerCase()); DiscriminatorType discriminatorType = da.discriminatorType(); if (discriminatorType.equals(DiscriminatorType.INTEGER)) { info.setDiscriminatorType(Types.INTEGER); } else { info.setDiscriminatorType(Types.VARCHAR); } info.setDiscriminatorLength(da.length()); } DiscriminatorValue dv = (DiscriminatorValue) cls.getAnnotation(DiscriminatorValue.class); if (dv != null) { info.setDiscriminatorValue(dv.value()); } return info; }
private InheritInfo createFinalInfo( InheritInfo root, InheritInfo parent, DeployInheritInfo deploy) { InheritInfo node = new InheritInfo(root, parent, deploy); if (parent != null) { parent.addChild(node); } finalMap.put(node.getType(), node); if (root == null) { root = node; } // buildFinalChildren(root, child, deploy); for (DeployInheritInfo childDeploy : deploy.children()) { createFinalInfo(root, node, childDeploy); } return node; }