refactor of type detection in the query engine to avoid some record load overhead
@@ -213,63 +213,15 @@ public class OResultInternal implements OResult {
}
private boolean isEmbeddedSet(Object input) {
- if (input instanceof Set) {
- for (Object o : (Set) input) {
- if (o instanceof OElement && !((OElement) o).getIdentity().isPersistent()) {
- return true;
- }
- if (isEmbeddedList(o)) {
- return true;
- }
- if (isEmbeddedSet(o)) {
- return true;
- }
- if (isEmbeddedMap(o)) {
- return true;
- }
- }
- }
- return false;
+ return OType.getTypeByValue(input) == OType.EMBEDDEDSET && input instanceof Set;
}
private boolean isEmbeddedMap(Object input) {
- if (input instanceof Map) {
- for (Object o : ((Map) input).values()) {
- if (o instanceof OElement && !((OElement) o).getIdentity().isPersistent()) {
- return true;
- }
- if (isEmbeddedList(o)) {
- return true;
- }
- if (isEmbeddedSet(o)) {
- return true;
- }
- if (isEmbeddedMap(o)) {
- return true;
- }
- }
- }
- return false;
+ return OType.getTypeByValue(input) == OType.EMBEDDEDMAP && input instanceof Map;
}
private boolean isEmbeddedList(Object input) {
- if (input instanceof List) {
- for (Object o : (List) input) {
- if (o instanceof OElement && !((OElement) o).getIdentity().isPersistent()) {
- return true;
- }
- if (isEmbeddedList(o)) {
- return true;
- }
- if (isEmbeddedSet(o)) {
- return true;
- }
- if (isEmbeddedMap(o)) {
- return true;
- }
- }
- }
- return false;
+ return OType.getTypeByValue(input) == OType.EMBEDDEDLIST && input instanceof List;
}
public Set<String> getPropertyNames() {
