/** * Test if an attribute is contained in the attribute set. * @param attr The attribute. * @return True, if contained. */ public boolean contains(OAVAttributeType attr) { boolean ret = attributes==null? false: attributes.contains(attr); if(!ret && alltypes!=null && attr.getObjectType() instanceof OAVJavaType) { ret = alltypes.contains(attr.getObjectType()); if(!ret) { OAVJavaType attrtype = (OAVJavaType)attr.getObjectType(); for(Iterator it=alltypes.iterator(); it.hasNext() && !ret; ) { OAVJavaType type = (OAVJavaType)it.next(); ret = attrtype.isSubtype(type); } } } // todo: build up negative list for already tested java types to improve performance. return ret; }
/** * Test if an attribute is contained in the attribute set. * @param attr The attribute. * @return True, if contained. */ public boolean contains(OAVAttributeType attr) { boolean ret = attributes==null? false: attributes.contains(attr); if(!ret && alltypes!=null && attr.getObjectType() instanceof OAVJavaType) { ret = alltypes.contains(attr.getObjectType()); if(!ret) { OAVJavaType attrtype = (OAVJavaType)attr.getObjectType(); for(Iterator it=alltypes.iterator(); it.hasNext() && !ret; ) { OAVJavaType type = (OAVJavaType)it.next(); ret = attrtype.isSubtype(type); } } } // todo: build up negative list for already tested java types to improve performance. return ret; }
/** * Test for equality. * @return True, if equal. */ public boolean equals(Object obj) { boolean ret = this==obj; if(!ret && obj!=null && obj.getClass().equals(this.getClass())) { OAVAttributeType attr = (OAVAttributeType)obj; if(SUtil.equals(name, attr.getName()) && SUtil.equals(otype, attr.getObjectType())) { ret = true; } } return ret; } }
/** * Test for equality. * @return True, if equal. */ public boolean equals(Object obj) { boolean ret = this==obj; if(!ret && obj!=null && obj.getClass().equals(this.getClass())) { OAVAttributeType attr = (OAVAttributeType)obj; if(SUtil.equals(name, attr.getName()) && SUtil.equals(otype, attr.getObjectType())) { ret = true; } } return ret; } }
/** * Ensure that a type has an attribute. * @param object The object. * @param attribute The attribute. * @throws RuntimeException if value is not allowed. */ protected boolean checkTypeHasAttribute(Object object, OAVAttributeType attribute) { if(attribute==null) throw new IllegalArgumentException("Attribute must not null."); OAVObjectType type = attribute.getObjectType() instanceof OAVJavaType ? tmodel.getJavaType(object.getClass()) : (OAVObjectType)types.get(object); if(type==null) throw new RuntimeException("Unknown object type of: "+object); OAVAttributeType attr = type.getAttributeType(attribute.getName()); if(!attribute.equals(attr)) throw new RuntimeException("Attribute must belong to object type: "+attribute+", "+type); return true; }
/** * Ensure that a type has an attribute. * @param object The object. * @param attribute The attribute. * @throws RuntimeException if value is not allowed. */ protected boolean checkTypeHasAttribute(Object object, OAVAttributeType attribute) { if(attribute==null) throw new IllegalArgumentException("Attribute must not null."); OAVObjectType type = attribute.getObjectType() instanceof OAVJavaType ? tmodel.getJavaType(object.getClass()) : (OAVObjectType)types.get(object); if(type==null) throw new RuntimeException("Unknown object type of: "+object); OAVAttributeType attr = type.getAttributeType(attribute.getName()); if(!attribute.equals(attr)) throw new RuntimeException("Attribute must belong to object type: "+attribute+", "+type); return true; }
Set tmp2 = (Set)indirectnodesets.get(attrtype.getObjectType()); if(attrtype.getObjectType() instanceof OAVJavaType) classes.add(((OAVJavaType)attrtype.getObjectType()).getClazz()); for(int i=0; i<classes.size(); i++)
Set tmp2 = (Set)indirectnodesets.get(attrtype.getObjectType()); if(attrtype.getObjectType() instanceof OAVJavaType) classes.add(((OAVJavaType)attrtype.getObjectType()).getClazz()); for(int i=0; i<classes.size(); i++)
/** * Ensure that a type has an attribute. * @param id The object (oid). * @param attribute The attribute. * @throws RuntimeException if value is not allowed. */ protected boolean checkTypeHasAttribute(Object id, OAVAttributeType attribute) { // #ifndef MIDP assert nocheck || generator.isId(id); // #endif if(attribute==null) throw new IllegalArgumentException("Attribute must not null."); OAVObjectType type = attribute.getObjectType() instanceof OAVJavaType ? tmodel.getJavaType(id.getClass()) : getType(id); OAVAttributeType attr = type.getAttributeType(attribute.getName()); if(!attribute.equals(attr)) throw new RuntimeException("Attribute must belong to object type: "+attribute+", "+type); return true; }
/** * Ensure that a type has an attribute. * @param id The object (oid). * @param attribute The attribute. * @throws RuntimeException if value is not allowed. */ protected boolean checkTypeHasAttribute(Object id, OAVAttributeType attribute) { // #ifndef MIDP assert nocheck || generator.isId(id); // #endif if(attribute==null) throw new IllegalArgumentException("Attribute must not null."); OAVObjectType type = attribute.getObjectType() instanceof OAVJavaType ? tmodel.getJavaType(id.getClass()) : getType(id); OAVAttributeType attr = type.getAttributeType(attribute.getName()); if(!attribute.equals(attr)) throw new RuntimeException("Attribute must belong to object type: "+attribute+", "+type); return true; }