
========================================================
==												MethodTest 									             ==     
========================================================

	import java.util.StringTokenizer;
	import java.lang.reflect.Method;

	/*
			Use Mehod Class 
	*/
	public class  MethodTest
	{
		public static void main(String[] args) 
		{
			MethodTest mt = new MethodTest();
			mt.methodTestFunction();
		}

		public void methodTestFunction()
		{
			MethodTestRec methodTestRec = new MethodTestRec();
			String  defectCodeStr="001-002-003-004-005-006-007---010-011-012";
			defectCodeStr = StringUtil.replace(defectCodeStr, "-", "- ");
			StringTokenizer st = new StringTokenizer(defectCodeStr, "-");
			Method method;
			
			int i=1;
			try
			{
				while(st.hasMoreTokens())
				{
				  String defectItemCode = st.nextToken();

				  //   MethodTestRec  에서 settestField01 .  getClass().getMethod(
				  //             //          의 해당 함수에 값을 넣는다.                 method.invoke( , )
				  if(i<4)
					method =  methodTestRec.getClass().getMethod("setTestField0" + (i) , Class.forName("java.lang.String"));
				  else
					method =  methodTestRec.getClass().getMethod("setTestField" + (i) , Class.forName("java.lang.String"));
		  
				  method.invoke(methodTestRec, defectItemCode.trim());

				  i++;
				}
			}
			catch (Exception e)
			{
				e.printStackTrace();
			}
		}
	}


========================================================
==												MethodTestRec 									             ==     
========================================================
	/*
	  Record Class
	 */
	public class MethodTestRec 
	{
		public String testField01;
		public String testField02;
		public String testField03;
		/* 4 ~9 까지 */
		public String testField10;
		public String testField11;

		public String getTestField01() {        return this.testField01;    }
		public String getTestField02() {        return this.testField02;    }
		public String getTestField03() {        return this.testField03;    }
		/* 4 ~9 까지 */

		public String getTestField10() {        return this.testField10;    }
		public String getTestField11() {        return this.testField11;    }

		public void setTestField01(String testField01) {        this.testField01 = testField01;    }
		public void setTestField02(String testField02) {        this.testField02 = testField02;    }
		public void setTestField03(String testField03) {        this.testField03 = testField03;    }
		/* 4 ~9 까지 */
		public void setTestField10(String testField10) {        this.testField10 = testField10;    }
		public void setTestField11(String testField11) {        this.testField11 = testField11;    }

	}


========================================================
==												MethodTestRec 									             ==     
========================================================

	public class StringUtil
	{
		public static String replace(String str, String sourceStr, String targetStr)
		{
			if(str == null || sourceStr == null || targetStr == null || str.length() == 0 || sourceStr.length() == 0)
				return str;

			int position = 0;
			int sourceStrLength = sourceStr.length();
			int targetStrLength = targetStr.length();

			do
			{
				if((position = str.indexOf(sourceStr, position)) == -1)
					break;
				if(position + sourceStrLength < str.length())
					str = str.substring(0, position) + targetStr + str.substring(position + sourceStrLength);
				else
					str = str.substring(0, position) + targetStr;
				position += targetStrLength;
				if(position > str.length())
					position = str.length();
			} 
			while(true);

			return str;
		}
	}