Exemplo n.º 1
0
        //private bool isConstructorParameter;
        public ParameterModel(string parameterName, Type typeOfParameter, int positionOfParameter, MethodModel methodThisParameterBelongsTo)
        {
            this.parameterName = parameterName;
            this.typeOfParameter = typeOfParameter;
            this.actualType = typeOfParameter;
            this.positionOfParameter = positionOfParameter;
            this.methodThisParameterBelongsTo = methodThisParameterBelongsTo;
            this.isComplexType = TypeUtil.isComplexType(actualType);

            //Console.WriteLine("Complex Type encountered " + this.parameterName + " "
            //        + this.typeOfParameter + " " + this.parameterCompTypeName + " " + this.isParameterComplex() + " " + typeOfParameter);
            //if (this.isComplexType)
            {
                this.parameterName += "TO";
                //Set type to string
                this.typeOfParameter = this.parameterName.GetType();
                this.parameterCompTypeName = this.parameterName + "AsObj";
                //Console.WriteLine("Complex Type encountered " + this.parameterName + " "
                //    + this.typeOfParameter + " " + this.parameterCompTypeName + " " + this.isParameterComplex());
            }
        }
Exemplo n.º 2
0
 private MethodModel extractParametersFromMethod(MethodModel methodAtHand, MethodInfo methodInfo)
 {
     ParameterInfo[] paramInfo = methodInfo.GetParameters();
     for (int i = 0; i < paramInfo.Length; i++)
     {
         string paramName = paramInfo[i].Name;
         Type paramType = paramInfo[i].ParameterType;
         string paramShortName = paramType + " " + paramName;
         ParameterModel paramAtHand = new ParameterModel(paramName, paramType, i + 1, methodAtHand);
         methodAtHand.getAllParametersInThisMethod().Add(i + 1, paramAtHand);
         if (i != paramInfo.Length - 1)
         {
             paramShortName = paramShortName + ",";
         }
         methodAtHand.setShortenedMethodName(methodAtHand.getShortenedName() + paramShortName);
     }
     methodAtHand.setNumberOfMethodParameters(paramInfo.Length);
     return methodAtHand;
 }
Exemplo n.º 3
0
 private ClassModel extractMethodsFromClass(ClassModel classAtHand, Type classType)
 {
     int i = 0;
     foreach (MethodInfo methodInfo in classType.GetMethods())
     {
         i++;
         string nameOfMethodAtHand = methodInfo.Name;
         string classThisMethodBelongsTo = classAtHand.getClassName();
         Type returnTypeOfMethodAtHand = methodInfo.ReturnType;
         MethodModel methodAtHand = new MethodModel(nameOfMethodAtHand,
                   classAtHand, returnTypeOfMethodAtHand);
         methodAtHand.setShortenedMethodName(classAtHand.getClassName()
             + "." +methodAtHand.getMethodName() + "(");
         this.extractParametersFromMethod(methodAtHand, methodInfo);
         methodAtHand.setShortenedMethodName(methodAtHand.getShortenedName() + ")");
         classAtHand.getAllMethodsInThisClass().Add(methodAtHand.getShortenedName(), methodAtHand);
     }
     return classAtHand;
 }