public Object put(Object key, Object value) { OAVObjectType type = key!=null && !(key instanceof Tuple) ? state.getType(key) : null; return type instanceof OAVJavaType && !OAVJavaType.KIND_VALUE.equals(((OAVJavaType)type).getKind()) ? identity.put(key, value) : equality.put(key, value); }
/** * Check if an object is a java object but not a value. */ protected boolean isJavaNonValue(Object obj) { return obj!=null && types.get(obj)==null && !tmodel.getJavaType(obj.getClass()).getKind().equals(OAVJavaType.KIND_VALUE); }
/** * Check if an object is a java object but not a value. */ protected boolean isJavaNonValue(Object obj) { return obj!=null && types.get(obj)==null && !tmodel.getJavaType(obj.getClass()).getKind().equals(OAVJavaType.KIND_VALUE); }
public Object put(Object key, Object value) { OAVObjectType type = key!=null && !(key instanceof Tuple) ? state.getType(key) : null; return type instanceof OAVJavaType && !OAVJavaType.KIND_VALUE.equals(((OAVJavaType)type).getKind()) ? identity.put(key, value) : equality.put(key, value); }
/** * Test if two values are equal * according to current identity/equality * settings. */ public boolean equals(Object a, Object b) { // When a!=b && javaidentity use equals() only for ids or java values. return a==b || a!=null && (javaidentity ? ((generator.isId(a) || tmodel.getJavaType(a.getClass()).getKind().equals(OAVJavaType.KIND_VALUE)) && a.equals(b)) : a.equals(b)); }
/** * Test if two values are equal * according to current identity/equality * settings. */ public boolean equals(Object a, Object b) { // When a!=b && javaidentity use equals() only for ids or java values. return a==b || a!=null && (javaidentity ? ((generator.isId(a) || tmodel.getJavaType(a.getClass()).getKind().equals(OAVJavaType.KIND_VALUE)) && a.equals(b)) : a.equals(b)); }
/** * Drop a Java object from root objects. * @param object The Java object. */ public void removeJavaRootObject(Object object) { assert nocheck || rootobjects.contains(object); this.rootobjects.remove(object); OAVJavaType java_type = tmodel.getJavaType(object.getClass()); if(OAVJavaType.KIND_BEAN.equals(java_type.getKind())) deregisterValue(object); eventhandler.objectRemoved(object, java_type); }
/** * Add a Java object as root object. * @param object The Java object. */ public void addJavaRootObject(Object object) { assert nocheck || !rootobjects.contains(object); this.rootobjects.add(object); OAVJavaType java_type = tmodel.getJavaType(object.getClass()); if(OAVJavaType.KIND_BEAN.equals(java_type.getKind())) registerValue(java_type, object); eventhandler.objectAdded(object, java_type, true); }
/** * Add a Java object as root object. * @param object The Java object. */ public void addJavaRootObject(Object object) { assert nocheck || !rootobjects.contains(object); this.rootobjects.add(object); OAVJavaType java_type = tmodel.getJavaType(object.getClass()); if(OAVJavaType.KIND_BEAN.equals(java_type.getKind())) registerValue(java_type, object); eventhandler.objectAdded(object, java_type, true); }
/** * Drop a Java object from root objects. * @param object The Java object. */ public void removeJavaRootObject(Object object) { assert nocheck || rootobjects.contains(object); this.rootobjects.remove(object); OAVJavaType java_type = tmodel.getJavaType(object.getClass()); if(OAVJavaType.KIND_BEAN.equals(java_type.getKind())) deregisterValue(object); eventhandler.objectRemoved(object, java_type); }
public boolean add(Object value) { OAVObjectType type = value!=null && !(value instanceof Tuple) ? state.getType(value) : null; boolean ret; if(type instanceof OAVJavaType && !OAVJavaType.KIND_VALUE.equals(((OAVJavaType)type).getKind())) { if(identity==null) identity = new IdentityHashSet(); ret = identity.add(value); } else { if(equality==null) equality = new LinkedHashSet(); ret = equality.add(value); } return ret; }
public boolean add(Object value) { OAVObjectType type = value!=null && !(value instanceof Tuple) ? state.getType(value) : null; boolean ret; if(type instanceof OAVJavaType && !OAVJavaType.KIND_VALUE.equals(((OAVJavaType)type).getKind())) { if(identity==null) identity = new IdentityHashSet(); ret = identity.add(value); } else { if(equality==null) equality = new LinkedHashSet(); ret = equality.add(value); } return ret; }
/** * Add a Java object as root object. * @param object The Java object. */ public void addJavaRootObject(Object object) { // #ifndef MIDP assert nocheck || !generator.isId(object); assert nocheck || !rootobjects.contains(object); // #endif OAVJavaType java_type = tmodel.getJavaType(object.getClass()); if(OAVJavaType.KIND_VALUE.equals(java_type.getKind())) throw new RuntimeException("Value types not supported for Java root objects: "+java_type+", "+object); this.rootobjects.add(object); if(this.javaobjects.add(object)) // Todo: java objects in nested states. { if(OAVJavaType.KIND_BEAN.equals(java_type.getKind())) registerValue(java_type, object); eventhandler.objectAdded(object, java_type, true); } }
/** * Drop a Java object from root objects. * @param object The Java object. */ public void removeJavaRootObject(Object object) { // #ifndef MIDP assert nocheck || !generator.isId(object); assert nocheck || rootobjects.contains(object) && javaobjects.contains(object); // #endif OAVJavaType java_type = tmodel.getJavaType(object.getClass()); if(OAVJavaType.KIND_VALUE.equals(java_type.getKind())) throw new RuntimeException("Value types not supported for Java root objects: "+java_type+", "+object); this.rootobjects.remove(object); if(!objectusages.containsKey(object)) // Todo: java objects in nested states. { javaobjects.remove(object); if(OAVJavaType.KIND_BEAN.equals(java_type.getKind())) deregisterValue(java_type, object); eventhandler.objectRemoved(object, java_type); } }
/** * Drop a Java object from root objects. * @param object The Java object. */ public void removeJavaRootObject(Object object) { // #ifndef MIDP assert nocheck || !generator.isId(object); assert nocheck || rootobjects.contains(object) && javaobjects.contains(object); // #endif OAVJavaType java_type = tmodel.getJavaType(object.getClass()); if(OAVJavaType.KIND_VALUE.equals(java_type.getKind())) throw new RuntimeException("Value types not supported for Java root objects: "+java_type+", "+object); this.rootobjects.remove(object); if(!objectusages.containsKey(object)) // Todo: java objects in nested states. { javaobjects.remove(object); if(OAVJavaType.KIND_BEAN.equals(java_type.getKind())) deregisterValue(java_type, object); eventhandler.objectRemoved(object, java_type); } }
/** * Add a Java object as root object. * @param object The Java object. */ public void addJavaRootObject(Object object) { // #ifndef MIDP assert nocheck || !generator.isId(object); assert nocheck || !rootobjects.contains(object); // #endif OAVJavaType java_type = tmodel.getJavaType(object.getClass()); if(OAVJavaType.KIND_VALUE.equals(java_type.getKind())) throw new RuntimeException("Value types not supported for Java root objects: "+java_type+", "+object); this.rootobjects.add(object); if(this.javaobjects.add(object)) // Todo: java objects in nested states. { if(OAVJavaType.KIND_BEAN.equals(java_type.getKind())) registerValue(java_type, object); eventhandler.objectAdded(object, java_type, true); } }
/** * Check if a value (oid or java object) is managed by the state. * Returns true for attribute values which are directly contained oav objects * or mutable java objects, e.g. not simple values such as strings or intergers. */ protected boolean isManaged(Object value) { // Value is a directly contained object or java bean/object (i.e. not basic value) return value!=null && !tmodel.getJavaType(value.getClass()).getKind().equals(OAVJavaType.KIND_VALUE) && (!generator.isId(value) || internalContainsObject(value)); // return value!=null && // (!generator.isId(value) && !tmodel.getJavaType(value.getClass()).getKind().equals(OAVJavaType.KIND_VALUE) // || internalContainsObject(value)); }
/** * Check if a value (oid or java object) is managed by the state. * Returns true for attribute values which are directly contained oav objects * or mutable java objects, e.g. not simple values such as strings or intergers. */ protected boolean isManaged(Object value) { // Value is a directly contained object or java bean/object (i.e. not basic value) return value!=null && !tmodel.getJavaType(value.getClass()).getKind().equals(OAVJavaType.KIND_VALUE) && (!generator.isId(value) || internalContainsObject(value)); // return value!=null && // (!generator.isId(value) && !tmodel.getJavaType(value.getClass()).getKind().equals(OAVJavaType.KIND_VALUE) // || internalContainsObject(value)); }
if(OAVJavaType.KIND_BEAN.equals(java_type.getKind())) deregisterValue(value);
if(OAVJavaType.KIND_BEAN.equals(java_type.getKind())) deregisterValue(value);