public int CompareTo(object obj)
        {
            IConstructorDef o = (IConstructorDef)obj;

            return(ToString().CompareTo(o.ToString()));
        }
示例#2
0
        private ConstructorInfo GetConstructor(IConstructorDef constructor)
        {
            Type clazz = (Type)this.classHierarchy.ClassForName(constructor.GetClassName());

            IConstructorArg[] args           = constructor.GetArgs().ToArray();
            Type[]            parameterTypes = new Type[args.Length];
            for (int i = 0; i < args.Length; i++)
            {
                if (args[i].IsInjectionFuture())
                {
                    parameterTypes[i] = typeof(IInjectionFuture <>).MakeGenericType(new Type[] { this.classHierarchy.ClassForName(args[i].Gettype()) });
                }
                else
                {
                    parameterTypes[i] = this.classHierarchy.ClassForName(args[i].Gettype());
                }
            }

            ConstructorInfo cons = clazz.GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, parameterTypes, null);

            //// TODO
            //// cons.setAccessible(true);

            if (cons == null)
            {
                Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(new ApplicationException("Failed to look up constructor: " + constructor.ToString()), LOGGER);
            }
            return(cons);
        }