Author: echatellier Date: 2011-07-05 11:05:14 +0200 (Tue, 05 Jul 2011) New Revision: 1084 Url: http://nuiton.org/repositories/revision/eugene/1084 Log: Fix output java format Modified: trunk/eugene/src/main/java/org/nuiton/eugene/java/JavaGenerator.java Modified: trunk/eugene/src/main/java/org/nuiton/eugene/java/JavaGenerator.java =================================================================== --- trunk/eugene/src/main/java/org/nuiton/eugene/java/JavaGenerator.java 2011-06-28 09:34:52 UTC (rev 1083) +++ trunk/eugene/src/main/java/org/nuiton/eugene/java/JavaGenerator.java 2011-07-05 09:05:14 UTC (rev 1084) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2004 - 2010 CodeLutin + * Copyright (C) 2004 - 2011 CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -140,8 +140,7 @@ } generateAnnotations(output, input, input); -/*{ -<%=prefix%>public<%=staticStr%><%=abstractStr%>class <%=className%>}*/ +/*{<%=prefix%>public<%=staticStr%><%=abstractStr%>class <%=className%>}*/ /* * Définition de la super classe : il ne doit y avoir qu'une @@ -151,15 +150,12 @@ } if (implement.length() > 0) { -/*{ implements <%=implement%> { +/*{ implements <%=implement%>}*/ + } -}*/ - } else { - /*{ { +/*{ { }*/ - } - generateInnerClassifiers(output, input.getInnerClassifiers()); generateAttributes(output, input, input.getAttributes()); generateOperations(output, input, input.getOperations()); @@ -193,19 +189,17 @@ } } generateAnnotations(output, input, input); -/*{ -<%=prefix%>public interface <%=interfaceName%>}*/ +/*{<%=prefix%>public interface <%=interfaceName%>}*/ /* * Définition de la super interface : il peut y en avoir autant qu'on veut */ if (extend.length() > 0) { -/*{ extends <%=extend%> {}*/ - } else { - /*{ { +/*{ extends <%=extend%>}*/ + } +/*{ { }*/ - } generateAttributes(output, input, input.getAttributes()); generateOperations(output, input, input.getOperations()); /*{ @@ -427,6 +421,11 @@ protected void generateOperations(Writer output,ObjectModelClassifier clazz, Collection<ObjectModelOperation> operations) throws IOException { + if (!operations.isEmpty()) { +/*{ +}*/ + } + // Ano #493 : FD-20100412 // Use a boolean to know if the classifier is an interface // Used to avoid generating visibility not needed for interface @@ -439,13 +438,13 @@ generateBlock(output, clazz, op); continue; } -/*{<%=prefix%> /** -<%=prefix%> * <%=opName%> : +/*{<%=prefix%> /** +<%=prefix%> * <%=opName%> : <%=prefix%>}*/ if (op.getDocumentation() != null && !op.getDocumentation().isEmpty()) { String opDocumentation = op.getDocumentation(); -/*{<%=prefix%> * <%=opDocumentation%> +/*{<%=prefix%> * <%=opDocumentation%> }*/ } Collection<ObjectModelParameter> params = op.getParameters(); @@ -455,7 +454,7 @@ if (paramDocumentation == null) { paramDocumentation = ""; } -/*{<%=prefix%> * @param <%=paramName%> <%=paramDocumentation%> +/*{<%=prefix%> * @param <%=paramName%> <%=paramDocumentation%> }*/ } String opVisibility = !interfacez ? op.getVisibility() : ""; @@ -472,22 +471,21 @@ if (paramDocumentation == null) { paramDocumentation = opReturn; } -/*{<%=prefix%> * @return <%=paramDocumentation%> +/*{<%=prefix%> * @return <%=paramDocumentation%> }*/ } } Set<String> exceptions = op.getExceptions(); for (String exception : exceptions) { String exceptionName = GeneratorUtil.getSimpleName(exception); -/*{<%=prefix%> * @throws <%=exceptionName%> +/*{<%=prefix%> * @throws <%=exceptionName%> }*/ } -/*{ *) +/*{<%=prefix%> *) }*/ generateAnnotations(output, clazz, op); -/*{ -<%=prefix%> <%=opVisibility%> <%=opStatic%><%=opAbstract%><%=opReturn%><%=opName%>(}*/ +/*{<%=prefix%> <%=opVisibility%> <%=opStatic%><%=opAbstract%><%=opReturn%><%=opName%>(}*/ String comma = ""; for (ObjectModelParameter param : params) { String paramName = param.getName();