public String process(String line) { return process(line, null); }
public String process(String line) { return process(line,domain); }
String process(String line, Link link) { StringBuffer sb = new StringBuffer(); process(line, 0, '\u0000', '\u0000', sb, link); return sb.toString(); }
String process(String line, Link link) { StringBuffer sb = new StringBuffer(); process(line, 0, '\u0000', '\u0000', sb, link); return sb.toString(); }
public String _error(String args[]) { for (int i = 1; i < args.length; i++) { domain.error(process(args[i])); } return ""; }
public String _warning(String args[]) { for (int i = 1; i < args.length; i++) { domain.warning(process(args[i])); } return ""; }
public String _error(String args[]) { for (int i = 1; i < args.length; i++) { domain.error(process(args[i])); } return ""; }
public String _warning(String args[]) { for (int i = 1; i < args.length; i++) { domain.warning(process(args[i])); } return ""; }
public String process(String line, Processor source) { return process(line, new Link(source,null,line)); }
/** * Fixup Attributes * * Execute any macros on an export and */ void fixupAttributes(Map<String, String> attributes) { // Convert any attribute values that have macros. for (String key : attributes.keySet()) { String value = attributes.get(key); if (value.indexOf('$') >= 0) { value = getReplacer().process(value); attributes.put(key, value); } } }
protected byte[] getBytes() throws IOException { ByteArrayOutputStream bout = new ByteArrayOutputStream(2000); OutputStreamWriter osw = new OutputStreamWriter(bout); PrintWriter pw = new PrintWriter(osw); InputStream in = resource.openInputStream(); try { BufferedReader rdr = new BufferedReader(new InputStreamReader(in)); String line = rdr.readLine(); while (line != null) { line = processor.getReplacer().process(line); pw.println(line); line = rdr.readLine(); } pw.flush(); byte [] data= bout.toByteArray(); return data; } finally { in.close(); } } }
protected byte[] getBytes() throws Exception { ByteArrayOutputStream bout = new ByteArrayOutputStream(2000); OutputStreamWriter osw = new OutputStreamWriter(bout, Constants.DEFAULT_CHARSET); PrintWriter pw = new PrintWriter(osw); InputStream in = resource.openInputStream(); try { BufferedReader rdr = new BufferedReader(new InputStreamReader(in,"UTF8")); String line = rdr.readLine(); while (line != null) { line = processor.getReplacer().process(line); pw.println(line); line = rdr.readLine(); } pw.flush(); byte [] data= bout.toByteArray(); return data; } finally { in.close(); } } }
private int doMacro(String[] args, int i) throws Exception { String result; for (; i < args.length; i++) { String cmd = args[i]; cmd = cmd.replaceAll("@\\{([^}])\\}", "\\${$1}"); cmd = cmd.replaceAll(":", ";"); cmd = cmd.replaceAll("[^$](.*)", "\\${$0}"); result = getReplacer().process(cmd); if (result != null && result.length() != 0) { Collection<String> parts = split(result); for (String s : parts) { out.println(s); } } else out.println("No result for " + cmd); } return i; }
private int doMacro(String[] args, int i) throws Exception { String result; for (; i < args.length; i++) { String cmd = args[i]; cmd = cmd.replaceAll("@\\{([^}])\\}", "\\${$1}"); cmd = cmd.replaceAll(":", ";"); cmd = cmd.replaceAll("[^$](.*)", "\\${$0}"); result = getProject().getReplacer().process(cmd); if (result != null || result.length() != 0) { Collection<String> parts = split(result); for (String s : parts) { out.println(s); } } else out.println("No result for " + cmd); } return i; }
/** * Parse the a=b strings and return a map of them. * * @param attrs * @param clazz * @return */ public static Map<String, String> doAttrbutes(Object[] attrs, Clazz clazz, Macro macro) { if (attrs == null || attrs.length == 0) return Collections.emptyMap(); Map<String, String> map = newMap(); for (Object a : attrs) { String attr = (String) a; int n = attr.indexOf("="); if (n > 0) { map.put(attr.substring(0, n), macro.process(attr.substring(n + 1))); } else throw new IllegalArgumentException(formatArrays( "Invalid attribute on package-info.java in %s , %s. Must be <key>=<name> ", clazz, attr)); } return map; }
private void readBuildProperties() throws Exception { try { File f = getFile("build.properties"); if (f.isFile()) { Properties p = loadProperties(f); for (Enumeration<?> e = p.propertyNames(); e.hasMoreElements();) { String key = (String) e.nextElement(); String newkey = key; if (key.indexOf('$') >= 0) { newkey = getReplacer().process(key); } setProperty(newkey, p.getProperty(key)); } } } catch (Exception e) { e.printStackTrace(); } }
private void readBuildProperties() throws Exception { try { File f = getFile("build.properties"); if (f.isFile()) { Properties p = loadProperties(f); for (Enumeration<?> e = p.propertyNames(); e.hasMoreElements();) { String key = (String) e.nextElement(); String newkey = key; if (key.indexOf('$') >= 0) { newkey = getReplacer().process(key); } setProperty(newkey, p.getProperty(key)); } } } catch (Exception e) { e.printStackTrace(); } }
public Map<String, Action> getActions() { Map<String, Action> all = newMap(); Map<String, Action> actions = newMap(); fillActions(all); getWorkspace().fillActions(all); for (Map.Entry<String, Action> action : all.entrySet()) { String key = getReplacer().process(action.getKey()); if (key != null && key.trim().length() != 0) actions.put(key, action.getValue()); } return actions; }
public Map<String, Action> getActions() { Map<String, Action> all = newMap(); Map<String, Action> actions = newMap(); fillActions(all); getWorkspace().fillActions(all); for (Map.Entry<String, Action> action : all.entrySet()) { String key = getReplacer().process(action.getKey()); if (key != null && key.trim().length() != 0) actions.put(key, action.getValue()); } return actions; }
/** * Get a property with a proper default * * @param headerName * @param deflt * @return */ public String getProperty(String key, String deflt) { String value; if (filter != null && filter.contains(key)) { value = (String) getProperties().get(key); } else value = getProperties().getProperty(key); if (value != null) return getReplacer().process(value); else if (deflt != null) return getReplacer().process(deflt); else return null; }