Current type

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: (TreeSet.class); // simpleTypeMap.Add(Vector.class); // simpleTypeMap.Add(Hashtable.class); _simpleTypeMap.Add(typeof(SByte)); _simpleTypeMap.Add(typeof(UInt16)); _simpleTypeMap.Add(typeof(UInt32)); _simpleTypeMap.Add(typeof(UInt64)); _simpleTypeMap.Add(typeof(IEnumerator)); } /// <summary> /// Returns an array of the readable properties names exposed by an object /// </summary> /// <param name="obj">The object</param> /// <returns>The properties name</returns> public static string GetReadablePropertyNames(object obj) { return ReflectionInfo.GetInstance(obj.GetType()).GetReadablePropertyNames(); } /// <summary> /// Returns an array of the writeable properties name exposed by a object /// </summary> /// <param name="obj">The object</param> /// <returns>The properties name</returns> public static string GetWriteablePropertyNames(object obj) { return ReflectionInfo.GetInstance(obj.GetType()).GetWriteablePropertyNames(); } /// <summary> /// Returns the type that the set expects to receive as a parameter when /// setting a property value. /// </summary> /// <param name="obj">The object to check</param> /// <param name="propertyName">The name of the property</param> /// <returns>The type of the property</returns> private static Type GetPropertyTypeForSetter(object obj, string propertyName) { Type type = obj.GetType(); if (obj is IDictionary) { IDictionary map = (IDictionary) obj; object value = map[propertyName]; if (value == null) { type = typeof(object); } else { type = value.GetType(); } } else { if (propertyName.IndexOf('.') > -1) { StringTokenizer parser = new StringTokenizer(propertyName, "."); IEnumerator enumerator = parser.GetEnumerator(); while (enumerator.MoveNext()) { propertyName = (string)enumerator.Current; type = ReflectionInfo.GetInstance(type).GetSetterType(propertyName); } } else { type = R...
View Full Document

This document was uploaded on 10/12/2012.

Ask a homework question - tutors are online