[prev in list] [next in list] [prev in thread] [next in thread] 

List:       stringtemplate-interest
Subject:    [stringtemplate-interest] Missing convenience ctor in
From:       oliver.zeigermann () gmail ! com (Oliver Zeigermann)
Date:       2005-08-15 10:26:40
Message-ID: 9da4f452050815102652f8c1ed () mail ! gmail ! com
[Download RAW message or body]

I thought it might be convenient to have something that resolves the
file a group is specified in in the same way as with string templates.
While now you can use the ctor

public StringTemplateGroup(Reader r)

to make clear that the group is specified in a file, something like
that might be more convenient:

public StringTemplateGroup(String name, boolean groupFormat);

Right now I saw myself forced to write something like 

	static Reader getGroup(String name) {
		ClassLoader cl = Thread.currentThread().getContextClassLoader();
		InputStream is = cl.getResourceAsStream(name + ".stg");
		if (is == null) {
			return null;
		}
		BufferedReader reader = new BufferedReader(new InputStreamReader(is));
		return reader;
	}

to map the name to a reader. 

Why isn't this part of StringTemplate?

Or did I get it all wrong?

Thanks for any hints/comments and cheers

Oliver

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic