package de.stefanocke.japkit.roo.japkit;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import de.stefanocke.japkit.metaannotations.Matcher;
import de.stefanocke.japkit.metaannotations.TypeCategory;
import de.stefanocke.japkit.metaannotations.Var;
import de.stefanocke.japkit.metaannotations.Method;
import de.stefanocke.japkit.metaannotations.Properties;
import de.stefanocke.japkit.metaannotations.Template;
import de.stefanocke.japkit.metaannotations.classselectors.GeneratedClass;

@Template(vars = @Var(name = "toStringProperties", propertyFilter = @Properties(sourceClass = GeneratedClass.class)))
public abstract class ToString {
	@Method(imports = { ToStringBuilder.class, ToStringStyle.class },
			
			bodyIterator="#{toStringProperties}",
			//bodyIteratorVar="p"
			bodyBeforeExpr = "return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).\n",
			bodyCase1 = @Matcher(srcTypeCategory=TypeCategory.COLLECTION),
			//Only summary for collections
			bodyExpr1 = "append(\"#{element.simpleName}\", #{element.getter.simpleName}(), false).\n",
			bodyExpr = "append(\"#{element.simpleName}\", #{element.getter.simpleName}()).\n",
			//Idee: Switch-Support.
			//bodyCase1 =
			//bodyExpr1 =
			//bodyCase2 =
			//bodyExpr2 =
			bodyAfterExpr = "toString();\n",
			bodyEmptyExpr = "return super.toString();" 
			)
	public abstract String toString();
}

@@ -1211,103 +1211,8 @@
 n%22,%0A
-%09%09%09//Idee: Switch-Support.%0A%09%09%09//bodyCase1 =%0A%09%09%09//bodyExpr1 =%0A%09%09%09//bodyCase2 =%0A%09%09%09//bodyExpr2 =%0A
 %09%09%09b

Update ToString.java