public static bool TypesAreCompatible(ODBType type1, ODBType type2) { if (type1.IsArray() && type2.IsArray()) { return(TypesAreCompatible(type1.GetSubType(), type2.GetSubType())); } if (type1.GetName().Equals(type2.GetName())) { return(true); } if (type1.IsNative() && type2.IsNative()) { if (type1.IsEquivalent(type2)) { return(true); } return(false); } if (type1.IsNonNative() && type2.IsNonNative()) { return((type1.GetNativeClass() == type2.GetNativeClass()) || (type1.GetNativeClass ().IsAssignableFrom(type2.GetNativeClass()))); } return(false); }
static ODBType() { // Not used in Java, for .Net compatibility // Not used in Java, for .Net compatibility //public final static ODBType MAP = new ODBType(false,MAP_ID, "java.util.AbstractMap", 0, AbstractMap.class); NeoDatis.Tool.Wrappers.List.IOdbList <ODBType > allTypes = new NeoDatis.Tool.Wrappers.List.OdbArrayList <ODBType >(100); //// DO NOT FORGET DO ADD THE TYPE IN THIS LIST WHEN CREATING A NEW ONE!!! allTypes.Add(Null); allTypes.Add(NativeBoolean); allTypes.Add(NativeByte); allTypes.Add(NativeChar); allTypes.Add(NativeShort); allTypes.Add(NativeInt); allTypes.Add(NativeLong); allTypes.Add(NativeFloat); allTypes.Add(NativeDouble); allTypes.Add(Byte); allTypes.Add(Short); allTypes.Add(Integer); allTypes.Add(Long); allTypes.Add(Float); allTypes.Add(Double); allTypes.Add(BigDecimal); allTypes.Add(BigInteger); allTypes.Add(Character); allTypes.Add(Boolean); allTypes.Add(Date); allTypes.Add(DateSql); allTypes.Add(DateTimestamp); allTypes.Add(String); allTypes.Add(Enum); allTypes.Add(Collection); allTypes.Add(CollectionGeneric); allTypes.Add(Array); allTypes.Add(Map); allTypes.Add(Oid); allTypes.Add(ObjectOid); allTypes.Add(ClassOid); allTypes.Add(NonNative); ODBType type = null; for (int i = 0; i < allTypes.Count; i++) { type = allTypes[i]; typesByName[type.GetName()] = type; typesById[type.GetId()] = type; } }
public static bool TypesAreCompatible(ODBType type1, ODBType type2) { if (type1.IsArray() && type2.IsArray()) { return TypesAreCompatible(type1.GetSubType(), type2.GetSubType()); } if (type1.GetName().Equals(type2.GetName())) { return true; } if (type1.IsNative() && type2.IsNative()) { if (type1.IsEquivalent(type2)) { return true; } return false; } if (type1.IsNonNative() && type2.IsNonNative()) { return (type1.GetNativeClass() == type2.GetNativeClass()) || (type1.GetNativeClass ().IsAssignableFrom(type2.GetNativeClass())); } return false; }