for(int i=0; i<superoavtypes.size(); i++) String superkind = ((OAVJavaType)superoavtypes.get(i)).getKind(); if(kind==null || kind.equals(OAVJavaType.KIND_OBJECT)) kind = superkind; ret = new OAVJavaType(clazz, kind, this);
/** * Test if a value is decodable to the same type. * Works for basic (final) types only and checks if the * two types are of same class. */ protected boolean isDecodableToSameType(Object property, Object value, IContext context) { boolean ret = true; if(value!=null) { OAVAttributeType attr = (OAVAttributeType)property; ret = value.getClass().equals(((OAVJavaType)attr.getType()).getClazz()); } return ret; } }
/** * Get a string representation of this method access. */ public String toString() { StringBuffer ret = new StringBuffer(); ret.append(type.getName()); ret.append("."); ret.append(name); ret.append("("); for(int p=0; parametervalues!=null && p<parametervalues.length; p++) { if(p!=0) ret.append(", "); ret.append(parametervalues[p].toString()); } ret.append(")"); return ret.toString(); }
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); }
public void propertyChange(PropertyChangeEvent evt) { OAVAttributeType attr = type.getAttributeType(evt.getPropertyName()); eventhandler.beanModified(evt.getSource(), type, attr, evt.getOldValue(), evt.getNewValue()); } };
/** * Create a Java type. * @param clazz The java class. * @param kind The kind of type as defined in OAVJavaType. * @return The new type. */ public OAVJavaType createJavaType(Class clazz, String kind) { OAVJavaType type = new OAVJavaType(clazz, kind, this); if(contains(type)) throw new RuntimeException("Type already exists: "+clazz); types.put(SReflect.getClassName(clazz), type); return type; }
/** * 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; }
getTypeModel().getJavaType(int.class), OAVAttributeType.NONE, null, null); getTypeModel().getJavaType(Object.class), OAVAttributeType.NONE, null, null); getTypeModel().getJavaType(pds[i].getPropertyType()), OAVAttributeType.NONE, null, pds[i]); getTypeModel().getJavaType(((IndexedPropertyDescriptor)pds[i]) .getIndexedPropertyType()), OAVAttributeType.LIST, null, pds[i]);
/** * Get the hash code of this unary expression. */ public int hashCode() { int ret = 31 + getType().hashCode(); ret = 31*ret + getName().hashCode(); ret = 31*ret + (getParameterValues()!=null ? SUtil.arrayHashCode(getParameterValues()): 0); return ret; } }
/** * Test if this method access is equal to some object. */ public boolean equals(Object o) { return o instanceof StaticMethodAccess && ((StaticMethodAccess)o).getType().equals(getType()) && ((StaticMethodAccess)o).getName().equals(getName()) && SUtil.arrayEquals(((StaticMethodAccess)o).getParameterValues(), getParameterValues()); }
/** * 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 void propertyChange(PropertyChangeEvent evt) { OAVAttributeType attr = type.getAttributeType(evt.getPropertyName()); eventhandler.beanModified(evt.getSource(), type, attr, evt.getOldValue(), evt.getNewValue()); } };
/** * Create a Java type. * @param clazz The java class. * @param kind The kind of type as defined in OAVJavaType. * @return The new type. */ public OAVJavaType createJavaType(Class clazz, String kind) { OAVJavaType type = new OAVJavaType(clazz, kind, this); if(contains(type)) throw new RuntimeException("Type already exists: "+clazz); types.put(SReflect.getClassName(clazz), type); return type; }
/** * 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; }
getTypeModel().getJavaType(int.class), OAVAttributeType.NONE, null, null); getTypeModel().getJavaType(Object.class), OAVAttributeType.NONE, null, null); getTypeModel().getJavaType(pds[i].getPropertyType()), OAVAttributeType.NONE, null, pds[i]); getTypeModel().getJavaType(((IndexedPropertyDescriptor)pds[i]) .getIndexedPropertyType()), OAVAttributeType.LIST, null, pds[i]);
/** * Get the hash code of this unary expression. */ public int hashCode() { int ret = 31 + getType().hashCode(); ret = 31*ret + getName().hashCode(); ret = 31*ret + (getParameterValues()!=null ? SUtil.arrayHashCode(getParameterValues()): 0); return ret; } }
/** * Test if this method access is equal to some object. */ public boolean equals(Object o) { return o instanceof StaticMethodAccess && ((StaticMethodAccess)o).getType().equals(getType()) && ((StaticMethodAccess)o).getName().equals(getName()) && SUtil.arrayEquals(((StaticMethodAccess)o).getParameterValues(), getParameterValues()); }
/** * Test if a value is decodable to the same type. * Works for basic (final) types only and checks if the * two types are of same class. */ protected boolean isDecodableToSameType(Object property, Object value, IContext context) { boolean ret = true; if(value!=null) { OAVAttributeType attr = (OAVAttributeType)property; ret = value.getClass().equals(((OAVJavaType)attr.getType()).getClazz()); } return ret; } }
/** * 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); }
for(int i=0; i<superoavtypes.size(); i++) String superkind = ((OAVJavaType)superoavtypes.get(i)).getKind(); if(kind==null || kind.equals(OAVJavaType.KIND_OBJECT)) kind = superkind; ret = new OAVJavaType(clazz, kind, this);