Exemple #1
0
 /// <summary>
 /// Determines if the class is a supported attribute type.
 /// </summary>
 /// <remarks>
 /// If not it throws
 /// an <see cref="ArgumentException" />.
 /// <list type="bullet">
 /// <item>
 /// <description>string
 /// </description>
 /// </item>
 /// <item>
 /// <description>long
 /// </description>
 /// </item>
 /// <item>
 /// <description>long?
 /// </description>
 /// </item>
 /// <item>
 /// <description>char
 /// </description>
 /// </item>
 /// <item>
 /// <description>char?
 /// </description>
 /// </item>
 /// <item>
 /// <description>double
 /// </description>
 /// </item>
 /// <item>
 /// <description>double?
 /// </description>
 /// </item>
 /// <item>
 /// <description>float
 /// </description>
 /// </item>
 /// <item>
 /// <description>float?
 /// </description>
 /// </item>
 /// <item>
 /// <description>int
 /// </description>
 /// </item>
 /// <item>
 /// <description>int?
 /// </description>
 /// </item>
 /// <item>
 /// <description>bool
 /// </description>
 /// </item>
 /// <item>
 /// <description>bool?
 /// </description>
 /// </item>
 /// <item>
 /// <description>byte
 /// </description>
 /// </item>
 /// <item>
 /// <description>byte?
 /// </description>
 /// </item>
 /// <item>
 /// <description>byte[]
 /// </description>
 /// </item>
 /// <item>
 /// <description>BigDecimal
 /// </description>
 /// </item>
 /// <item>
 /// <description>BigInteger
 /// </description>
 /// </item>
 /// <item>
 /// <description>IDictionary
 /// </description>
 /// </item>
 /// </list>
 /// </remarks>
 /// <param name="type">type to check against the support list of types.</param>
 /// <exception cref="ArgumentException">iff the type is not on the supported list.</exception>
 public static void CheckAttributeType(Type type)
 {
     if (!FrameworkUtil.IsSupportedAttributeType(type))
     {
         String MSG = "Attribute type ''" + type + "'' is not supported.";
         throw new ArgumentException(MSG);
     }
 }
Exemple #2
0
        /// <summary>
        /// Determines if the class is a supported type for an OperationOption.
        /// </summary>
        /// <remarks>
        /// If not it throws
        /// an <see cref="ArgumentException" />.
        /// </remarks>
        /// <param name="clazz">type to check against the support list of types.</param>
        /// <exception cref="ArgumentException">iff the type is not on the supported list.</exception>
        public static void CheckOperationOptionType(Type clazz)
        {
            //the set of supported operation option types
            //is the same as that for configuration beans plus Name,
            //ObjectClass, Uid, and QualifiedUid

            if (clazz.IsArray)
            {
                CheckOperationOptionType(clazz.GetElementType());
                return;
            }

            if (FrameworkUtil.IsSupportedConfigurationType(clazz))
            {
                return; //ok
            }

            if (typeof(ObjectClass).IsAssignableFrom(clazz))
            {
                return; //ok
            }

            if (typeof(Uid).IsAssignableFrom(clazz))
            {
                return; //ok
            }

            if (typeof(QualifiedUid).IsAssignableFrom(clazz))
            {
                return; //ok
            }

            if (typeof(SortKey).IsAssignableFrom(clazz))
            {
                return; //ok
            }

            String MSG = "ConfigurationOption type '+" + clazz.Name + "+' is not supported.";

            throw new ArgumentException(MSG);
        }