mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#115 - Supporting changes for Element collection support
This commit is contained in:
@@ -16,6 +16,14 @@ import java.util.List;
|
||||
*/
|
||||
public class VisitAllUsing {
|
||||
|
||||
/**
|
||||
* Visit a single Descriptor using the given visitor.
|
||||
*/
|
||||
public static void visitOne(BeanDescriptor<?> descriptor, BeanPropertyVisitor visitor) {
|
||||
|
||||
new VisitAllUsing().visitProperties(descriptor, visitor);
|
||||
}
|
||||
|
||||
protected final BeanVisitor visitor;
|
||||
|
||||
protected final List<BeanDescriptor<?>> descriptors;
|
||||
@@ -36,6 +44,11 @@ public class VisitAllUsing {
|
||||
this.descriptors = descriptors;
|
||||
}
|
||||
|
||||
private VisitAllUsing() {
|
||||
this.visitor = null;
|
||||
this.descriptors = null;
|
||||
}
|
||||
|
||||
public void visitAllBeans() {
|
||||
for (BeanDescriptor<?> desc : descriptors) {
|
||||
if (desc.isBaseTable()) {
|
||||
@@ -51,29 +64,32 @@ public class VisitAllUsing {
|
||||
|
||||
BeanPropertyVisitor propertyVisitor = visitor.visitBean(desc);
|
||||
if (propertyVisitor != null) {
|
||||
|
||||
BeanProperty idProp = desc.getIdProperty();
|
||||
if (idProp != null) {
|
||||
visit(propertyVisitor, idProp);
|
||||
}
|
||||
|
||||
BeanPropertyAssocOne<?> unidirectional = desc.getUnidirectional();
|
||||
if (unidirectional != null) {
|
||||
visit(propertyVisitor, unidirectional);
|
||||
}
|
||||
|
||||
BeanProperty[] propertiesNonTransient = desc.propertiesNonTransient();
|
||||
for (BeanProperty p : propertiesNonTransient) {
|
||||
if (p.isDDLColumn()) {
|
||||
visit(propertyVisitor, p);
|
||||
}
|
||||
}
|
||||
|
||||
visitInheritanceProperties(desc, propertyVisitor);
|
||||
propertyVisitor.visitEnd();
|
||||
visitProperties(desc, propertyVisitor);
|
||||
}
|
||||
}
|
||||
|
||||
private void visitProperties(BeanDescriptor<?> desc, BeanPropertyVisitor propertyVisitor) {
|
||||
BeanProperty idProp = desc.getIdProperty();
|
||||
if (idProp != null) {
|
||||
visit(propertyVisitor, idProp);
|
||||
}
|
||||
|
||||
BeanPropertyAssocOne<?> unidirectional = desc.getUnidirectional();
|
||||
if (unidirectional != null) {
|
||||
visit(propertyVisitor, unidirectional);
|
||||
}
|
||||
|
||||
BeanProperty[] propertiesNonTransient = desc.propertiesNonTransient();
|
||||
for (BeanProperty p : propertiesNonTransient) {
|
||||
if (p.isDDLColumn()) {
|
||||
visit(propertyVisitor, p);
|
||||
}
|
||||
}
|
||||
|
||||
visitInheritanceProperties(desc, propertyVisitor);
|
||||
propertyVisitor.visitEnd();
|
||||
}
|
||||
|
||||
/**
|
||||
* Visit the property.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user