1 17 package org.eclipse.emf.codegen.jet; 18 19 20 import java.io.CharArrayWriter ; 21 22 23 27 public class JETScriptletGenerator 28 implements JETGenerator 29 { 30 protected char[] chars; 31 32 public JETScriptletGenerator(char[] chars) 33 { 34 this.chars = chars; 35 } 36 37 public String generate() 38 { 39 return new String (removeQuotes(chars)); 40 } 41 42 public static char[] removeQuotes(char [] characters) 43 { 44 CharArrayWriter writer = new CharArrayWriter (); 45 for (int i = 0; i < characters.length; ++i) 46 { 47 if (characters[i] == '%' && characters[i + 1] == '\\' && characters[i + 2] == '\\' && characters[i + 3] == '>') 48 { 49 writer.write('%'); 50 writer.write('>'); 51 i += 3; 52 } 53 else 54 { 55 writer.write(characters[i]); 56 } 57 } 58 59 return writer.toCharArray(); 60 } 61 } 62 | Popular Tags |