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); }
private static Org.Apache.REEF.Tang.Protobuf.ConstructorDef SerializeConstructorDef(IConstructorDef def) { IList <Org.Apache.REEF.Tang.Protobuf.ConstructorArg> args = new List <Org.Apache.REEF.Tang.Protobuf.ConstructorArg>(); foreach (IConstructorArg arg in def.GetArgs()) { args.Add(NewConstructorArg(arg.Gettype(), arg.GetNamedParameterName(), arg.IsInjectionFuture())); } return(newConstructorDef(def.GetClassName(), args)); }
private static ClassHierarchyProto.ConstructorDef SerializeConstructorDef(IConstructorDef def) { IList <ClassHierarchyProto.ConstructorArg> args = new List <ClassHierarchyProto.ConstructorArg>(); foreach (IConstructorArg arg in def.GetArgs()) { args.Add(NewConstructorArg(arg.Gettype(), arg.GetNamedParameterName(), arg.IsInjectionFuture())); } return(newConstructorDef(def.GetClassName(), args)); }
private AvroConstructorDef NewConstructorDef(IConstructorDef def) { IList <AvroConstructorArg> args = new List <AvroConstructorArg>(); foreach (IConstructorArg arg in def.GetArgs()) { args.Add(NewConstructorArg(arg.Gettype(), arg.GetNamedParameterName(), arg.IsInjectionFuture())); } AvroConstructorDef constDef = new AvroConstructorDef(); constDef.fullClassName = def.GetClassName(); constDef.constructorArgs = new List <AvroConstructorArg>(); foreach (AvroConstructorArg arg in args) { constDef.constructorArgs.Add(arg); } return(constDef); }
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(InjectionFuture); } else { parameterTypes[i] = this.classHierarchy.ClassForName(args[i].Gettype()); } } ConstructorInfo cons = clazz.GetConstructor(parameterTypes); //cons.setAccessible(true); return(cons); }
private AvroConstructorDef NewConstructorDef(IConstructorDef def) { IList<AvroConstructorArg> args = new List<AvroConstructorArg>(); foreach (IConstructorArg arg in def.GetArgs()) { args.Add(NewConstructorArg(arg.Gettype(), arg.GetNamedParameterName(), arg.IsInjectionFuture())); } AvroConstructorDef constDef = new AvroConstructorDef(); constDef.fullClassName = def.GetClassName(); constDef.constructorArgs = new List<AvroConstructorArg>(); foreach (AvroConstructorArg arg in args) { constDef.constructorArgs.Add(arg); } return constDef; }
private static ConstructorDef SerializeConstructorDef(IConstructorDef def) { IList<ConstructorArg> args = new List<ConstructorArg>(); foreach (IConstructorArg arg in def.GetArgs()) { args.Add(NewConstructorArg(arg.Gettype(), arg.GetNamedParameterName(), arg.IsInjectionFuture())); } return newConstructorDef(def.GetClassName(), args); }
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(InjectionFuture); } else { parameterTypes[i] = this.classHierarchy.ClassForName(args[i].Gettype()); } } ConstructorInfo cons = clazz.GetConstructor(parameterTypes); //cons.setAccessible(true); return cons; }