package com.arun.parallel;

import java.util.List;

public class Signature {

	private String name;
	private Class<? extends Object> returnType;
	private List<? extends Object> args;
	private List<Class<? extends Object>> argTypes;

	private Signature() {}

	public String getName() {
		return name;
	}

	public Class<? extends Object> getReturnType() {
		return returnType;
	}

	public List<Class<? extends Object>> getArgTypes() {
		return argTypes;
	}

	public List<? extends Object> getArgs() {
		return args;
	}

	public static ReturnType method(String methodName) {
		return new Signature.SignatureBuilder(methodName);
	}

	public interface ReturnType {
		Build returnType(Class<? extends Object> returnType);
	}

	public interface Build {
		Build argsList(List<? extends Object> args);

		Build argTypes(List<Class<? extends Object>> argTypes);

		Signature build();
	}

	public static class SignatureBuilder implements ReturnType, Build {
		private Signature signature = new Signature();

		public SignatureBuilder(String method) {
			signature.name = method;
		}

		public SignatureBuilder returnType(Class<? extends Object> returnType) {
			signature.returnType = returnType;
			return this;
		}

		public SignatureBuilder argsList(List<? extends Object> args) {
			signature.args = args;
			return this;
		}

		public SignatureBuilder argTypes(List<Class<? extends Object>> argTypes) {
			signature.argTypes = argTypes;
			return this;
		}

		public Signature build() {
			return signature;
		}

	}
}

@@ -21,16 +21,46 @@
 allel;%0A%0A
+import com.arun.MethodModel;%0A%0A
 import j
@@ -74,16 +74,16 @@
 l.List;%0A
-
 %0Apublic 
@@ -560,624 +560,135 @@
 tic 
-ReturnType method(String methodName) %7B%0A%09%09return new Signature.SignatureBuilder(methodName);%0A%09%7D%0A%0A%09public interface ReturnType %7B%0A%09%09Build returnType(Class%3C? extends Object%3E returnType);%0A%09%7D%0A%0A%09public interface Build %7B%0A%09%09Build argsList(List%3C? extends Object%3E args);%0A%0A%09%09Build argTypes(List%3CClass%3C? extends Object%3E%3E argTypes);%0A%0A%09%09Signature build();%0A%09%7D%0A%0A%09public static class SignatureBuilder implements ReturnType, Build %7B%0A%09%09private Signature signature = new Signature();%0A%0A%09%09public SignatureBuilder(String method) %7B%0A%09%09%09signature.name = method;%0A%09%09%7D%0A%0A%09%09public SignatureBuilder returnType(Class%3C? extends Object%3E returnType) %7B%0A%09
+Signature method(MethodModel methodModel) %7B%0A%09%09Signature signature = new Signature();%0A%09%09signature.name = methodModel.getName();%0A
 %09%09si
@@ -712,232 +712,87 @@
 e = 
-returnType;%0A%09%09%09return this;%0A%09%09%7D%0A%0A%09%09public SignatureBuilder argsList(List%3C? extends Object%3E args) %7B%0A%09%09%09signature.args = args;%0A%09%09%09return this;%0A%09%09%7D%0A%0A%09%09public SignatureBuilder argTypes(List%3CClass%3C? extends Object%3E%3E a
+methodModel.getReturnType();%0A%09%09signature.argTypes = methodModel.getA
 rgTypes
-) %7B%0A%09
+();%0A
 %09%09si
@@ -806,77 +806,35 @@
 .arg
-Types = argTypes;%0A%09%09%09return this;%0A%09%09%7D%0A%0A%09%09public Signature build() %7B%0A%09
+s = methodModel.getArgs();%0A
 %09%09re
@@ -853,13 +853,8 @@
 re;%0A
-%09%09%7D%0A%0A
 %09%7D%0A%7D

Build Signature from MethodModel