/** * 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; } }
/** * 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; } }
/** * Test if a value is a basic type. */ protected boolean isBasicType(Object property, Object value) { OAVObjectType atype = ((OAVAttributeType)property).getType(); return atype instanceof OAVJavaType && BasicTypeConverter.isBuiltInType(((OAVJavaType)atype).getClazz()); }
/** * Test if a value is a basic type. */ protected boolean isBasicType(Object property, Object value) { OAVObjectType atype = ((OAVAttributeType)property).getType(); return atype instanceof OAVJavaType && BasicTypeConverter.isBuiltInType(((OAVJavaType)atype).getClazz()); }
/** * Check if it is allowed to set or add an attribute value. * For this purpose it is checked if the value is either * a) a ObjectId -> type check via OAVObjectType * b) a normal Java object -> type check via OAVJavaType * Additionally multiplicity is checked. * @throws RuntimeException if value is not allowed. */ protected boolean checkValueCompatibility(Object object, OAVAttributeType attribute, Object value) { if(value!=null) { OAVObjectType atype = attribute.getType(); if(atype instanceof OAVJavaType) { if(!tmodel.getJavaType(value.getClass()).isSubtype(atype)) throw new RuntimeException("Value not of suitable type: "+object+" "+attribute+" "+value); } else if(!getType(value).isSubtype(atype)) { throw new RuntimeException("Value not of suitable type: "+object+" "+attribute+" "+value); } } return true; }
/** * Check if it is allowed to set or add an attribute value. * For this purpose it is checked if the value is either * a) a ObjectId -> type check via OAVObjectType * b) a normal Java object -> type check via OAVJavaType * Additionally multiplicity is checked. * @throws RuntimeException if value is not allowed. */ protected boolean checkValueCompatibility(Object object, OAVAttributeType attribute, Object value) { if(value!=null) { OAVObjectType atype = attribute.getType(); if(atype instanceof OAVJavaType) { if(!tmodel.getJavaType(value.getClass()).isSubtype(atype)) throw new RuntimeException("Value not of suitable type: "+object+" "+attribute+" "+value); } else if(!getType(value).isSubtype(atype)) { throw new RuntimeException("Value not of suitable type: "+object+" "+attribute+" "+value); } } return true; }
type = attrs[a].getType(); mtype = (OAVObjectType)OAVBDIRuntimeModel.modelmap.get(type); check = types.contains(type)
/** * Check if it is allowed to set or add an attribute value. * For this purpose it is checked if the value is either * a) a ObjectId -> type check via OAVObjectType * b) a normal Java object -> type check via OAVJavaType * Additionally multiplicity is checked. * @throws RuntimeException if value is not allowed. */ protected boolean checkValueCompatibility(Object id, OAVAttributeType attribute, Object value) { // #ifndef MIDP assert nocheck || generator.isId(id); // #endif if(value!=null) { OAVObjectType atype = attribute.getType(); if(atype instanceof OAVJavaType) { if(!tmodel.getJavaType(value.getClass()).isSubtype(atype)) throw new RuntimeException("Value not of suitable type: "+id+" "+attribute+" "+value); } else if(!getType(value).isSubtype(atype)) { throw new RuntimeException("Value not of suitable type: "+id+" "+attribute+" "+value); } } return true; }
/** * Check if it is allowed to set or add an attribute value. * For this purpose it is checked if the value is either * a) a ObjectId -> type check via OAVObjectType * b) a normal Java object -> type check via OAVJavaType * Additionally multiplicity is checked. * @throws RuntimeException if value is not allowed. */ protected boolean checkValueCompatibility(Object id, OAVAttributeType attribute, Object value) { // #ifndef MIDP assert nocheck || generator.isId(id); // #endif if(value!=null) { OAVObjectType atype = attribute.getType(); if(atype instanceof OAVJavaType) { if(!tmodel.getJavaType(value.getClass()).isSubtype(atype)) throw new RuntimeException("Value not of suitable type: "+id+" "+attribute+" "+value); } else if(!getType(value).isSubtype(atype)) { throw new RuntimeException("Value not of suitable type: "+id+" "+attribute+" "+value); } } return true; }
ret = ((OAVAttributeType)valuesource).getType();
ret = ((OAVAttributeType)valuesource).getType();
/** * * @param tmodel * @param valuesource * @return */ protected static OAVObjectType getValueSourceType(OAVTypeModel tmodel, Object valuesource) { OAVObjectType ret = null; if(valuesource instanceof OAVAttributeType) { ret = ((OAVAttributeType)valuesource).getType(); } else if(valuesource instanceof MethodCall) { Class rettype = ((MethodCall)valuesource).getMethod().getReturnType(); if(rettype!=null) ret = tmodel.getJavaType(rettype); } else if(valuesource instanceof FunctionCall) { Class rettype = ((FunctionCall)valuesource).getFunction().getReturnType(); if(rettype!=null) ret = tmodel.getJavaType(rettype); } return ret; }
/** * * @param tmodel * @param valuesource * @return */ protected static OAVObjectType getValueSourceType(OAVTypeModel tmodel, Object valuesource) { OAVObjectType ret = null; if(valuesource instanceof OAVAttributeType) { ret = ((OAVAttributeType)valuesource).getType(); } else if(valuesource instanceof MethodCall) { Class rettype = ((MethodCall)valuesource).getMethod().getReturnType(); if(rettype!=null) ret = tmodel.getJavaType(rettype); } else if(valuesource instanceof FunctionCall) { Class rettype = ((FunctionCall)valuesource).getFunction().getReturnType(); if(rettype!=null) ret = tmodel.getJavaType(rettype); } return ret; }
OAVObjectType type = bc.getValueSource()!=null ? ((OAVAttributeType)bc.getValueSource()).getType() : cond.getObjectType(); if(!(type instanceof OAVJavaType) || OAVJavaType.KIND_VALUE.equals(((OAVJavaType)type).getKind()))
OAVObjectType type = bc.getValueSource()!=null ? ((OAVAttributeType)bc.getValueSource()).getType() : cond.getObjectType(); if(!(type instanceof OAVJavaType) || OAVJavaType.KIND_VALUE.equals(((OAVJavaType)type).getKind()))