internal static CollectionType GetCollectionType(FieldInfo thatField) { if (CollectionType.CanBeCreatedFrom(thatField.FieldType)) { var created = new CollectionType(thatField.FieldType, javaName: thatField.Name, objCName: thatField.Name); compositeTypeCollection.TryAdd(created); return(created); } else { throw new ArgumentException(String.Format("Field type is not a legitimate collection we can create. Type: {0}", thatField.FieldType)); } }
public new bool Equals(object x, object y) { if (x.GetType().Equals(y.GetType())) { if (TypeRegistry.ScalarTypes.Contains(x.GetType())) { return(TypeRegistry.ScalarTypes[x.GetType()].SimplEquals(x, y)); } else if (CollectionType.CanBeCreatedFrom(x.GetType())) { var collectionType = TypeRegistry.CollectionTypes.GetOrAdd(x.GetType()); return(collectionType.SimplEquals(x, y)); } else { var compositeType = TypeRegistry.CompositeTypes.GetOrAdd(x.GetType()); return(compositeType.SimplEquals(x, y)); } } else { return(false); } }
/// <summary> /// Determines if a simpl Collection Type can be created for the given C# TYpe /// </summary> /// <param name="aType">The type to consider</param> /// <returns>True if a collection type can be made</returns> public static bool CanBeCreatedFrom(Type aType) { return(!CollectionType.CanBeCreatedFrom(aType)); }