public static System.Type FindType(string typeName, System.Type baseType, bool useFullName = false, bool ignoreCase = false)
        {
            if (string.IsNullOrEmpty(typeName)) return null;
            if (baseType == null) throw new System.ArgumentNullException("baseType");

            StringComparison e = (ignoreCase) ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal;
            if(useFullName)
            {
                foreach (var assemb in System.AppDomain.CurrentDomain.GetAssemblies())
                {
                    foreach (var t in assemb.GetTypes())
                    {
                        if (baseType.IsAssignableFrom(t) && string.Equals(t.FullName, typeName, e)) return t;
                    }
                }
            }
            else
            {
                foreach (var assemb in System.AppDomain.CurrentDomain.GetAssemblies())
                {
                    foreach (var t in assemb.GetTypes())
                    {
                        if (baseType.IsAssignableFrom(t) && (string.Equals(t.Name, typeName, e) || string.Equals(t.FullName, typeName, e))) return t;
                    }
                }
            }

            return null;
        }
Exemplo n.º 2
0
 public static IEnumerable<Type> GetTypesAssignableFrom(System.Reflection.Assembly assemb, System.Type rootType)
 {
     foreach (var tp in assemb.GetTypes())
     {
         if (rootType.IsAssignableFrom(tp) && rootType != tp) yield return tp;
     }
 }
        public static Component ComponentField(Rect position, GUIContent label, Component value, System.Type inheritsFromType, bool allowSceneObjects, System.Type targetComponentType)
        {
            if (inheritsFromType == null) inheritsFromType = typeof(Component);
            else if (!typeof(Component).IsAssignableFrom(inheritsFromType) && !typeof(IComponent).IsAssignableFrom(inheritsFromType)) throw new TypeArgumentMismatchException(inheritsFromType, typeof(IComponent), "Type must inherit from IComponent or Component.", "inheritsFromType");
            if (targetComponentType == null) throw new System.ArgumentNullException("targetComponentType");
            if (!typeof(Component).IsAssignableFrom(targetComponentType)) throw new TypeArgumentMismatchException(targetComponentType, typeof(Component), "targetComponentType");
            if (value != null && !targetComponentType.IsAssignableFrom(value.GetType())) throw new TypeArgumentMismatchException(value.GetType(), inheritsFromType, "value must inherit from " + inheritsFromType.Name, "value");

            if (TypeUtil.IsType(inheritsFromType, typeof(Component)))
            {
                return EditorGUI.ObjectField(position, label, value, inheritsFromType, true) as Component;
            }
            else
            {
                value = EditorGUI.ObjectField(position, label, value, typeof(Component), true) as Component;
                var go = GameObjectUtil.GetGameObjectFromSource(value);
                if (go != null)
                {
                    foreach (var c in go.GetComponents(inheritsFromType))
                    {
                        if (TypeUtil.IsType(c.GetType(), targetComponentType))
                        {
                            return c as Component;
                        }
                    }
                }
            }

            return null;
        }
Exemplo n.º 4
0
 public static IEnumerable<Type> GetTypesAssignableFrom(System.Type rootType)
 {
     foreach (var assemb in System.AppDomain.CurrentDomain.GetAssemblies())
     {
         foreach (var tp in assemb.GetTypes())
         {
             if (rootType.IsAssignableFrom(tp)) yield return tp;
         }
     }
 }
 public override object PickRegistration(System.Type type, string identifier)
 {
     if (type.IsInterface) {
         Type[] implementingTypes = AppDomain.CurrentDomain.GetAssemblies().ToList().SelectMany(s => s.GetTypes()).Where(prop => !prop.Equals(type) && type.IsAssignableFrom(prop)).ToArray();
         if (implementingTypes.Count() == 1) {
             return implementingTypes.First();
         }
     }
     if ((this.NextStep != null)) {
         return this.NextStep.PickRegistration(type, identifier);
     }
     return null;
 }
		override public void Map(System.Type type, System.Type mapper, object instance)
		{
			if ((instance is MonoBehaviour) == false)
				base.Map(type, mapper, instance);
			else
			{
				DesignByContract.Check.Require(instance != null);
				DesignByContract.Check.Require(type.IsAssignableFrom(instance.GetType()), "Trying to register an invalid instance");
				
				KeyValuePair<WeakReference, bool> valuePair = new KeyValuePair<WeakReference, bool>(new WeakReference(instance), false);
			
				_mbcache[type] = valuePair;
			}
		}
Exemplo n.º 7
0
		private static IEnumerable<System.Type> ClassList(Assembly assembly, System.Type type)
		{
			IList<System.Type> result = new List<System.Type>();
			if (assembly != null)
			{
				System.Type[] types = assembly.GetTypes();
				foreach (System.Type tp in types)
				{
					if (tp != type && type.IsAssignableFrom(tp) && !tp.IsInterface)
						result.Add(tp);
				}
			}
			return result;
		}
 public static IEnumerable<System.Type> FindSubclassesOf(System.Type t) 
 {
     var subclasses = new List<System.Type>();
     foreach(var asm in System.AppDomain.CurrentDomain.GetAssemblies()) 
     {
         foreach (var type in asm.GetTypes()) 
         {
             if (type.IsAbstract == false && t.IsAssignableFrom(type)) 
             {
                 subclasses.Add(type);
             }
         }
     }
     return subclasses;
 }
Exemplo n.º 9
0
 public ResourceAssociationSetEnd(System.Data.Services.Providers.ResourceSet resourceSet, System.Data.Services.Providers.ResourceType resourceType, System.Data.Services.Providers.ResourceProperty resourceProperty)
 {
     WebUtil.CheckArgumentNull<System.Data.Services.Providers.ResourceSet>(resourceSet, "resourceSet");
     WebUtil.CheckArgumentNull<System.Data.Services.Providers.ResourceType>(resourceType, "resourceType");
     if ((resourceProperty != null) && ((resourceType.TryResolvePropertyName(resourceProperty.Name) == null) || (resourceProperty.TypeKind != ResourceTypeKind.EntityType)))
     {
         throw new ArgumentException(Strings.ResourceAssociationSetEnd_ResourcePropertyMustBeNavigationPropertyOnResourceType);
     }
     if (!resourceSet.ResourceType.IsAssignableFrom(resourceType) && !resourceType.IsAssignableFrom(resourceSet.ResourceType))
     {
         throw new ArgumentException(Strings.ResourceAssociationSetEnd_ResourceTypeMustBeAssignableToResourceSet);
     }
     if ((resourceProperty != null) && (DataServiceProviderWrapper.GetDeclaringTypeForProperty(resourceType, resourceProperty, null) != resourceType))
     {
         throw new ArgumentException(Strings.ResourceAssociationSetEnd_ResourceTypeMustBeTheDeclaringType(resourceType.FullName, resourceProperty.Name));
     }
     this.resourceSet = resourceSet;
     this.resourceType = resourceType;
     this.resourceProperty = resourceProperty;
 }
 private static object FormatObjectInternal(object value, System.Type targetType, TypeConverter sourceConverter, TypeConverter targetConverter, string formatString, IFormatProvider formatInfo, object formattedNullValue)
 {
     if ((value == DBNull.Value) || (value == null))
     {
         if (formattedNullValue != null)
         {
             return formattedNullValue;
         }
         if (targetType == stringType)
         {
             return string.Empty;
         }
         if (targetType == checkStateType)
         {
             return CheckState.Indeterminate;
         }
         return null;
     }
     if (((targetType == stringType) && (value is IFormattable)) && !string.IsNullOrEmpty(formatString))
     {
         return (value as IFormattable).ToString(formatString, formatInfo);
     }
     System.Type type = value.GetType();
     TypeConverter converter = TypeDescriptor.GetConverter(type);
     if (((sourceConverter != null) && (sourceConverter != converter)) && sourceConverter.CanConvertTo(targetType))
     {
         return sourceConverter.ConvertTo(null, GetFormatterCulture(formatInfo), value, targetType);
     }
     TypeConverter converter2 = TypeDescriptor.GetConverter(targetType);
     if (((targetConverter != null) && (targetConverter != converter2)) && targetConverter.CanConvertFrom(type))
     {
         return targetConverter.ConvertFrom(null, GetFormatterCulture(formatInfo), value);
     }
     if (targetType == checkStateType)
     {
         if (type == booleanType)
         {
             return (((bool) value) ? CheckState.Checked : CheckState.Unchecked);
         }
         if (sourceConverter == null)
         {
             sourceConverter = converter;
         }
         if ((sourceConverter != null) && sourceConverter.CanConvertTo(booleanType))
         {
             return (((bool) sourceConverter.ConvertTo(null, GetFormatterCulture(formatInfo), value, booleanType)) ? CheckState.Checked : CheckState.Unchecked);
         }
     }
     if (targetType.IsAssignableFrom(type))
     {
         return value;
     }
     if (sourceConverter == null)
     {
         sourceConverter = converter;
     }
     if (targetConverter == null)
     {
         targetConverter = converter2;
     }
     if ((sourceConverter != null) && sourceConverter.CanConvertTo(targetType))
     {
         return sourceConverter.ConvertTo(null, GetFormatterCulture(formatInfo), value, targetType);
     }
     if ((targetConverter != null) && targetConverter.CanConvertFrom(type))
     {
         return targetConverter.ConvertFrom(null, GetFormatterCulture(formatInfo), value);
     }
     if (!(value is IConvertible))
     {
         throw new FormatException(GetCantConvertMessage(value, targetType));
     }
     return ChangeType(value, targetType, formatInfo);
 }
Exemplo n.º 11
0
        /// <summary>
        /// Checks whether the proxy representing the specified object type can be cast to the type represented by the IRemotingTypeInfo interface
        /// </summary>
        /// <param name="toType">The Type we wish to cast to</param>
        /// <param name="obj">The object we wish to cast</param>
        /// <returns>True if the strict property is false, otherwise the list of supportedTypes is checked.<br>
        /// The proxy targets type(s) are automatically supported</br></returns>
        public bool CanCastTo(System.Type toType, object obj)
        {
            // Assume we can (which is the default unless strict is true)
            bool canCast = true;

            if (strict) {
                // First check if the proxyTarget supports the cast
                if (toType.IsAssignableFrom(proxyTarget.GetType())) {
                    canCast = true;
                } else if (supportedTypes != null) {
                    canCast = false;
                    // Check if the list of supported interfaces supports the cast
                    foreach(Type type in supportedTypes) {
                        if (toType == type) {
                            canCast = true;
                            break;
                        }
                    }
                } else {
                    canCast = false;
                }
            }

            return canCast;
        }
		/// <summary>
		/// Added to solve a problem with SessionImpl.Find( CriteriaImpl ),
		/// see the comment there for an explanation.
		/// </summary>
		/// <param name="clazz"></param>
		/// <returns></returns>
		public System.Type[] GetImplementorClasses(System.Type clazz)
		{
			ArrayList results = new ArrayList();
			foreach (IEntityPersister p in classPersisters.Values)
			{
				if (p is IQueryable)
				{
					IQueryable q = (IQueryable) p;
					bool isMappedClass = clazz.Equals(q.MappedClass);
					if (q.IsExplicitPolymorphism)
					{
						if (isMappedClass)
						{
							return new System.Type[] {q.MappedClass};
						}
					}
					else
					{
						if (isMappedClass)
						{
							results.Add(q.MappedClass);
						}
						else if (
							clazz.IsAssignableFrom(q.MappedClass) &&
							(!q.IsInherited || !clazz.IsAssignableFrom(q.MappedSuperclass)))
						{
							results.Add(q.MappedClass);
						}
					}
				}
			}
			return (System.Type[]) results.ToArray(typeof(System.Type));
		}
 private static object ParseObjectInternal(object value, System.Type targetType, System.Type sourceType, TypeConverter targetConverter, TypeConverter sourceConverter, IFormatProvider formatInfo, object formattedNullValue)
 {
     if (EqualsFormattedNullValue(value, formattedNullValue, formatInfo) || (value == DBNull.Value))
     {
         return DBNull.Value;
     }
     TypeConverter converter = TypeDescriptor.GetConverter(targetType);
     if (((targetConverter != null) && (converter != targetConverter)) && targetConverter.CanConvertFrom(sourceType))
     {
         return targetConverter.ConvertFrom(null, GetFormatterCulture(formatInfo), value);
     }
     TypeConverter converter2 = TypeDescriptor.GetConverter(sourceType);
     if (((sourceConverter != null) && (converter2 != sourceConverter)) && sourceConverter.CanConvertTo(targetType))
     {
         return sourceConverter.ConvertTo(null, GetFormatterCulture(formatInfo), value, targetType);
     }
     if (value is string)
     {
         object obj2 = InvokeStringParseMethod(value, targetType, formatInfo);
         if (obj2 != parseMethodNotFound)
         {
             return obj2;
         }
     }
     else if (value is CheckState)
     {
         CheckState state = (CheckState) value;
         if (state == CheckState.Indeterminate)
         {
             return DBNull.Value;
         }
         if (targetType == booleanType)
         {
             return (state == CheckState.Checked);
         }
         if (targetConverter == null)
         {
             targetConverter = converter;
         }
         if ((targetConverter != null) && targetConverter.CanConvertFrom(booleanType))
         {
             return targetConverter.ConvertFrom(null, GetFormatterCulture(formatInfo), state == CheckState.Checked);
         }
     }
     else if ((value != null) && targetType.IsAssignableFrom(value.GetType()))
     {
         return value;
     }
     if (targetConverter == null)
     {
         targetConverter = converter;
     }
     if (sourceConverter == null)
     {
         sourceConverter = converter2;
     }
     if ((targetConverter != null) && targetConverter.CanConvertFrom(sourceType))
     {
         return targetConverter.ConvertFrom(null, GetFormatterCulture(formatInfo), value);
     }
     if ((sourceConverter != null) && sourceConverter.CanConvertTo(targetType))
     {
         return sourceConverter.ConvertTo(null, GetFormatterCulture(formatInfo), value, targetType);
     }
     if (!(value is IConvertible))
     {
         throw new FormatException(GetCantConvertMessage(value, targetType));
     }
     return ChangeType(value, targetType, formatInfo);
 }
Exemplo n.º 14
0
 private void ValidateCurrentBehaviourClass(System.Type myType)
 {
     if (myTarget.Behaviour == null)
     {
         object o = CreateInstance(myType);
         myTarget.Behaviour = (A_InteractBehaviour)o;
     }
     else
     {
         // If Different Behaviour Type
         if ( !(myType.IsAssignableFrom( myTarget.Behaviour.GetType() ) ) )
         {
             // Creates New Instance Of Type And Assigns It
             object o = CreateInstance(myType);
             myTarget.Behaviour = (A_InteractBehaviour)o;
         }
     }
 }
		/// <summary>Sets the value of the <code>name</code> property to the name of a class.
		/// First checks that the class implements the named interface. 
		/// </summary>
		public virtual void SetClass(System.String propertyName, System.Type theClass, System.Type xface)
		{
			if (!xface.IsAssignableFrom(theClass))
			{
				throw new System.SystemException(theClass + " not " + xface.FullName);
			}
			SetProperty(propertyName, theClass.FullName);
		}
Exemplo n.º 16
0
        private static object ConvertType(object value, System.Type type)
        {
            if (value == null)
                return null;

            if (type.IsAssignableFrom(value.GetType()))
                return value;

            if (IsNullableOfT(type))
                type = Nullable.GetUnderlyingType(type);

            if (type.IsEnum)
                return Enum.ToObject(type, value);

            if (type.IsPrimitive)
                return Convert.ChangeType(value, type);

            throw new Exception("Cannot convert '" + value.ToString() + "' to " + type.ToString());
        }
 public static bool IsType(System.Type tp, System.Type assignableType)
 {
     return assignableType.IsAssignableFrom(tp);
 }
Exemplo n.º 18
0
 public bool ContainsSymbol(string name, System.Type symbol_type)
 {
     return this.symbols.ContainsKey(name) && symbol_type.IsAssignableFrom(this.symbols[name].GetType());
 }
Exemplo n.º 19
0
 private static bool ApplyPropertyToExistingNode(ProjectionNode existingNode, ResourceProperty property, System.Data.Services.Providers.ResourceType targetResourceType)
 {
     if (((property == null) || (existingNode.Property == null)) || (property == existingNode.Property))
     {
         ExpandedProjectionNode node = existingNode as ExpandedProjectionNode;
         if (targetResourceType.IsAssignableFrom(existingNode.TargetResourceType))
         {
             VerifyPropertyMismatchAndExpandSelectMismatchScenario(existingNode, property, targetResourceType, node != null);
             existingNode.TargetResourceType = targetResourceType;
             return true;
         }
         if (existingNode.TargetResourceType.IsAssignableFrom(targetResourceType))
         {
             VerifyPropertyMismatchAndExpandSelectMismatchScenario(existingNode, property, targetResourceType, node != null);
             return true;
         }
     }
     return false;
 }
 private ArrayList FindControls(System.Type baseType, bool searchAllChildren, Control.ControlCollection controlsToLookIn, ArrayList foundControls)
 {
     if ((controlsToLookIn == null) || (foundControls == null))
     {
         return null;
     }
     try
     {
         for (int i = 0; i < controlsToLookIn.Count; i++)
         {
             if ((controlsToLookIn[i] != null) && baseType.IsAssignableFrom(controlsToLookIn[i].GetType()))
             {
                 foundControls.Add(controlsToLookIn[i]);
             }
         }
         if (!searchAllChildren)
         {
             return foundControls;
         }
         for (int j = 0; j < controlsToLookIn.Count; j++)
         {
             if (((controlsToLookIn[j] != null) && !(controlsToLookIn[j] is Form)) && ((controlsToLookIn[j].Controls != null) && (controlsToLookIn[j].Controls.Count > 0)))
             {
                 foundControls = this.FindControls(baseType, searchAllChildren, controlsToLookIn[j].Controls, foundControls);
             }
         }
     }
     catch (Exception exception)
     {
         if (System.Windows.Forms.ClientUtils.IsCriticalException(exception))
         {
             throw;
         }
     }
     return foundControls;
 }
Exemplo n.º 21
0
 internal static UnityEngine.Object ValidateObjectFieldAssignment(UnityEngine.Object[] references, System.Type objType, SerializedProperty property)
 {
   if (references.Length > 0)
   {
     bool flag1 = DragAndDrop.objectReferences.Length > 0;
     bool flag2 = references[0] != (UnityEngine.Object) null && references[0].GetType() == typeof (Texture2D);
     if (objType == typeof (Sprite) && flag2 && flag1)
       return (UnityEngine.Object) SpriteUtility.TextureToSprite(references[0] as Texture2D);
     if (property != null)
     {
       if (references[0] != (UnityEngine.Object) null && property.ValidateObjectReferenceValue(references[0]))
         return references[0];
       if ((property.type == "PPtr<Sprite>" || property.type == "PPtr<$Sprite>" || property.type == "vector") && (flag2 && flag1))
         return (UnityEngine.Object) SpriteUtility.TextureToSprite(references[0] as Texture2D);
     }
     else
     {
       if (references[0] != (UnityEngine.Object) null && references[0].GetType() == typeof (GameObject) && typeof (Component).IsAssignableFrom(objType))
         references = (UnityEngine.Object[]) ((GameObject) references[0]).GetComponents(typeof (Component));
       foreach (UnityEngine.Object reference in references)
       {
         if (reference != (UnityEngine.Object) null && objType.IsAssignableFrom(reference.GetType()))
           return reference;
       }
     }
   }
   return (UnityEngine.Object) null;
 }
Exemplo n.º 22
0
		public static System.Type[] GetCreatableObjects(System.Type parentType, string path)
		{
			var retval = new ArrayList();
			var al = LoadAllAssembliesForPath(path);

			try
			{
				foreach (System.Reflection.Assembly assembly in al)
				{
					System.Diagnostics.Debug.WriteLine(assembly.Location);
					foreach (var t in assembly.GetTypes())
					{
						if (parentType.IsAssignableFrom(t) && !t.IsAbstract && !t.IsInterface)
							retval.Add(t);
						else if (t.IsAssignableFrom(parentType) && !t.IsAbstract && !t.IsInterface)
							retval.Add(t);
					}
				}
			}
			catch (Exception ex)
			{
				throw;
			}

			return (System.Type[])retval.ToArray(typeof(System.Type));
		}
Exemplo n.º 23
0
		private static bool IsMatchingImplementor(string entityOrClassName, System.Type entityClass, IQueryable implementor)
		{
			var implementorClass = implementor.GetMappedClass(EntityMode.Poco);
			if (implementorClass == null) 
			{
				return false;
			}
			if (entityClass.Equals(implementorClass))
			{
				// It is possible to have multiple mappings for the same entity class, but with different entity names.
				// When querying for a specific entity name, we should only return entities for the requested entity name
				// and not return entities for any other entity names that may map to the same entity class.
				bool isEntityName = !entityOrClassName.Equals(entityClass.FullName);
				return !isEntityName || entityOrClassName.Equals(implementor.EntityName);
			}
			return entityClass.IsAssignableFrom(implementorClass);
		}
 bool IRemotingTypeInfo.CanCastTo(System.Type toType, object o)
 {
     if (!toType.IsAssignableFrom(this.proxiedType))
     {
         return this.serviceChannel.CanCastTo(toType);
     }
     return true;
 }
		public static void AssertClassAssignability(System.Type source, System.Type target)
		{
			Assert.IsTrue(target.IsAssignableFrom(source),
			              "Classes were not assignment-compatible : source<" +
			              source.FullName +
			              "> target<" +
			              target.FullName + ">"
				);
		}
 public static MdaMvc4Net.Reflect.MdaFieldCategory defaultTypeToFieldType(System.Type type)
 {
     MdaMvc4Net.Reflect.MdaFieldCategory res;
     if (type.IsPrimitive || type==typeof(string)
         || type.IsValueType
         // TODO ... also use all immutable ref type
         )
     {
         res = MdaMvc4Net.Reflect.MdaFieldCategory.FIELD_VALUE;
     }
     else
     {
         if (type.IsArray)
         {
             res = MdaMvc4Net.Reflect.MdaFieldCategory.FIELD_ARRAY;
         }
         else
         {
             if (type.IsAssignableFrom(typeof(System.Collections.IList)))
             {
                 res = MdaMvc4Net.Reflect.MdaFieldCategory.FIELD_LIST;
             }
             else
             {
                 // TODO how to detect Collection<> as Set<> : containing unique objects, no doublons
     //						if (type.IsAssignableFrom((typeof(java.util.Set))))
     //						{
     //							res = MdaMvc4Net.Reflect.MdaFieldCategory.FIELD_SET;
     //						}
     //						else
                 {
                     if (type.IsAssignableFrom(typeof(System.Collections.ICollection)))
                     {
                         res = MdaMvc4Net.Reflect.MdaFieldCategory.FIELD_COLLECTION;
                     }
                     else
                     {
                         if (type.IsAssignableFrom(typeof(System.Collections.IDictionary)))
                         {
                             res = MdaMvc4Net.Reflect.MdaFieldCategory.FIELD_MAP;
                         }
                         else
                         {
                             res = MdaMvc4Net.Reflect.MdaFieldCategory.FIELD_REF;
                         }
                     }
                 }
             }
         }
     }
     // unknown ref! TODO use IOC / see post validate to decide more precisely??
     return res;
 }
 public StyleCollectionEditor(System.Type type)
     : base(type)
 {
     this.isRowCollection = type.IsAssignableFrom(typeof(TableLayoutRowStyleCollection));
 }
Exemplo n.º 28
0
	public static UnityEngine.Object ReadUnityReference (AstarSerializer serializer, string name, int instanceID, System.Type type) {

		Object ob1 = EditorUtility.InstanceIDToObject (instanceID);
		
		//Discard if not the correct type
		if (ob1 != null && !type.IsAssignableFrom (ob1.GetType ())) {
			ob1 = null;
		}
		
		Object ob2 = null;
		
		if (ob1 != null && ob1.name == name) {
			//Debug.Log ("Loading from InstanceID + name");
			return ob1;
		}
		
		string guid = serializer.readerStream.ReadString ();
		
		if (guid != "") {
			string path = AssetDatabase.GUIDToAssetPath (guid);
			ob2 = AssetDatabase.LoadMainAssetAtPath (path);
			
			//Discard if not the correct type
			if (ob2 != null && !type.IsAssignableFrom (ob2.GetType ())) {
				ob2 = null;
			}
			
			//Debug.Log ("Got path "+path+" Got Object "+(ob2 != null));
			if (ob2 != null) {
				if (ob2 == ob1) {
					return ob2;
				}
				if (ob2.name == name) {
					return ob2;
				}
			}
		}
		
		//If any were found, return them in priority order
		if (ob2 != null) {
			return ob2;
		}
		if (ob1 != null) {
			return ob1;
		}
		return null;
	}
Exemplo n.º 29
0
			public override AttributeImpl CreateAttributeInstance(System.Type attClass)
			{
				return attClass.IsAssignableFrom(typeof(TokenWrapper))?new TokenWrapper():delegate_Renamed.CreateAttributeInstance(attClass);
			}
		/// <summary>Returns the value of the <code>name</code> property as a Class.  If no
		/// such property is specified, then <code>defaultValue</code> is returned.
		/// An error is thrown if the returned class does not implement the named
		/// interface. 
		/// </summary>
		public virtual System.Type GetClass(System.String propertyName, System.Type defaultValue, System.Type xface)
		{
			try
			{
				System.Type theClass = GetClass(propertyName, defaultValue);
				if (theClass != null && !xface.IsAssignableFrom(theClass))
				{
					throw new System.SystemException(theClass + " not " + xface.FullName);
				}
				return theClass;
			}
			catch (System.Exception e)
			{
				throw new ParserException("Failed to get class type", e);
			}
		}