示例#1
0
        /// <summary>
        /// Resolves the type of the attribute.
        /// </summary>
        /// <param name="desc">The desc.</param>
        /// <param name="engineImportService">The engine import service.</param>
        /// <returns></returns>
        public static Type ResolveAttributeType(AnnotationDesc desc, EngineImportService engineImportService)
        {
            // CLR attributes use a different notation that Java annotations.  Format
            // the attribute according to CLR conventions.
            var attributeTypeName       = desc.Name;
            var attributeTypeNameForCLR =
                (attributeTypeName.EndsWith("Attribute"))
                    ? attributeTypeName
                    : String.Format("{0}Attribute", attributeTypeName);

            // resolve attribute type
            try
            {
                engineImportService.GetClassLoader(); // Currently unused
                return(engineImportService.ResolveAnnotation(attributeTypeNameForCLR));
            }
            catch (EngineImportException e)
            {
                throw new AttributeException("Failed to resolve @-annotation class: " + e.Message);
            }
        }