package com.kurento.kms.idl.codegen.function;

import java.util.List;

import com.kurento.kms.idl.model.Method;
import com.kurento.kms.idl.model.Param;
import com.kurento.kms.idl.model.RemoteClass;

import freemarker.ext.beans.StringModel;
import freemarker.template.TemplateMethodModelEx;
import freemarker.template.TemplateModelException;

public class IsFirstConstructorParam implements TemplateMethodModelEx {

	@Override
	public Object exec(@SuppressWarnings("rawtypes") List arguments)
			throws TemplateModelException {

		RemoteClass thisRemoteClass = (RemoteClass) ((StringModel) arguments
				.get(0)).getWrappedObject();
		RemoteClass otherRemoteClass = (RemoteClass) ((StringModel) arguments
				.get(1)).getWrappedObject();

		if (!otherRemoteClass.getConstructors().isEmpty()) {

			Method method = otherRemoteClass.getConstructors().get(0);

			List<Param> params = method.getParams();

			if (params.isEmpty()) {
				return false;
			} else {
				boolean firstConstructor = params.get(0).getType().getType() == thisRemoteClass;
				if (firstConstructor) {
					System.out.println("ThisRemoteClass: "
							+ thisRemoteClass.getName() + " OtherRemoteClass:"
							+ otherRemoteClass.getName());
				}
				return firstConstructor;
			}

		} else {
			return false;
		}
	}

}

@@ -960,34 +960,14 @@
 %09%09%09%09
-boolean firstConstructor =
+return
  par
@@ -1021,211 +1021,8 @@
 ss;%0A
-%09%09%09%09if (firstConstructor) %7B%0A%09%09%09%09%09System.out.println(%22ThisRemoteClass: %22%0A%09%09%09%09%09%09%09+ thisRemoteClass.getName() + %22 OtherRemoteClass:%22%0A%09%09%09%09%09%09%09+ otherRemoteClass.getName());%0A%09%09%09%09%7D%0A%09%09%09%09return firstConstructor;%0A
 %09%09%09%7D

Remove ugly trace in "IsFirstConstructorParam" funciton