use of org.apache.cayenne.EmbeddableObject in project cayenne by apache.
the class QualifierTranslator method getEmbeddableValueSnapshot.
private Map<String, Object> getEmbeddableValueSnapshot(Embeddable embeddable, Expression node, Expression parentNode) {
int siblings = parentNode.getOperandCount();
for (int i = 0; i < siblings; i++) {
Object operand = parentNode.getOperand(i);
if (node == operand) {
continue;
}
if (operand instanceof EmbeddableObject) {
EmbeddableObject embeddableObject = (EmbeddableObject) operand;
Map<String, Object> snapshot = new HashMap<>(embeddable.getAttributes().size());
embeddable.getAttributeMap().forEach((name, attr) -> snapshot.put(attr.getDbAttributeName(), embeddableObject.readPropertyDirectly(name)));
return snapshot;
}
}
throw new CayenneRuntimeException("Embeddable attribute ObjPath isn't matched with a valid value.");
}
Aggregations