r395 - trunk/nuiton-processor/src/main/java/org/nuiton/processor/filters
Author: mfortun Date: 2011-07-27 16:54:13 +0200 (Wed, 27 Jul 2011) New Revision: 395 Url: http://nuiton.org/repositories/revision/processor/395 Log: * change static value to customizable value * add missing getter and setter for some attributes Modified: trunk/nuiton-processor/src/main/java/org/nuiton/processor/filters/GeneratorTemplatesFilter.java trunk/nuiton-processor/src/main/java/org/nuiton/processor/filters/GeneratorTemplatesFilterIn.java Modified: trunk/nuiton-processor/src/main/java/org/nuiton/processor/filters/GeneratorTemplatesFilter.java =================================================================== --- trunk/nuiton-processor/src/main/java/org/nuiton/processor/filters/GeneratorTemplatesFilter.java 2011-06-07 20:09:19 UTC (rev 394) +++ trunk/nuiton-processor/src/main/java/org/nuiton/processor/filters/GeneratorTemplatesFilter.java 2011-07-27 14:54:13 UTC (rev 395) @@ -94,6 +94,34 @@ return writeString; } + public void setWriteString(String writeString) { + this.writeString = writeString; + } + + public boolean isPassEmptyLine() { + return passEmptyLine; + } + + public void setPassEmptyLine(boolean passEmptyLine) { + this.passEmptyLine = passEmptyLine; + } + + public boolean isWriteParentheses() { + return writeParentheses; + } + + public void setWriteParentheses(boolean writeParentheses) { + this.writeParentheses = writeParentheses; + } + + public GeneratorTemplatesFilterIn getInFilter() { + return inFilter; + } + + public void setInFilter(GeneratorTemplatesFilterIn inFilter) { + this.inFilter = inFilter; + } + /** * methode appele lorsqu'on a la chaine entiere entre le header * et le footer. Modified: trunk/nuiton-processor/src/main/java/org/nuiton/processor/filters/GeneratorTemplatesFilterIn.java =================================================================== --- trunk/nuiton-processor/src/main/java/org/nuiton/processor/filters/GeneratorTemplatesFilterIn.java 2011-06-07 20:09:19 UTC (rev 394) +++ trunk/nuiton-processor/src/main/java/org/nuiton/processor/filters/GeneratorTemplatesFilterIn.java 2011-07-27 14:54:13 UTC (rev 395) @@ -56,9 +56,65 @@ protected String endParenthese = EMPTY_STRING; + protected String endCar; + protected String stringDelim; + + protected String concacChar; + + public String getConcacChar() { + return concacChar; + } + + public void setConcacChar(String concacChar) { + this.concacChar = concacChar; + } + + public String getStringDelim() { + return stringDelim; + } + + public void setStringDelim(String stringDelim) { + this.stringDelim = stringDelim; + } + + public String getEndCar() { + return endCar; + } + + public void setEndCar(String endCar) { + this.endCar = endCar; + } + + public String getEndParenthese() { + return endParenthese; + } + + public void setEndParenthese(String endParenthese) { + this.endParenthese = endParenthese; + } + + public String getBeginParenthese() { + return beginParenthese; + } + + public void setBeginParenthese(String beginParenthese) { + this.beginParenthese = beginParenthese; + } + + public GeneratorTemplatesFilter getParent() { + return parent; + } + + public void setParent(GeneratorTemplatesFilter parent) { + this.parent = parent; + } + public GeneratorTemplatesFilterIn(GeneratorTemplatesFilter parent) { this.parent = parent; + endCar=";"; + stringDelim="\""; + concacChar="+"; } /** @@ -72,16 +128,16 @@ protected String performInFilter(String ch) { if (parent.writeParentheses) { beginParenthese = "("; - endParenthese = ");"; + endParenthese = ")"+ endCar; } else { beginParenthese = EMPTY_STRING; endParenthese = EMPTY_STRING; } if (ch.startsWith("=")) { - return "\"+" + ch.substring(1) + "+\""; + return stringDelim + concacChar + ch.substring(1) + concacChar + stringDelim; } - return "\"" + endParenthese + ch + parent.getWriteString() + - beginParenthese + "\""; + return stringDelim + endParenthese + ch + parent.getWriteString() + + beginParenthese + stringDelim; } /** @@ -106,15 +162,15 @@ protected String performOutFilter(String ch) { if (parent.writeParentheses) { beginParenthese = "("; - endParenthese = ");"; + endParenthese = ")"+ endCar; } else { beginParenthese = EMPTY_STRING; endParenthese = EMPTY_STRING; } String result = convertEndComment(ch).replaceAll("\"", "\\\\\"") .replaceAll("(\r\n|\n|\r)", - "\\\\n\"" + endParenthese + "\n" + - parent.getWriteString() + beginParenthese + "\""); + "\\\\n"+ stringDelim + endParenthese + "\n" + + parent.getWriteString() + beginParenthese + stringDelim); // it's important that \r\n is first in regexp. return result;
participants (1)
-
mfortun@users.nuiton.org