An annotation processor that generates a provider for any class marked with walkingkooka.resource.TextResourceAware.
This is particularly useful for any runtime environment such as J2CL where java.lang.Class#getResourceAsStream is not
supported but using files as text is still required.
Note it is not currently possible to specify the charset encoding for any text file. Theres is a
ticket to add support to specify a Charset
and this will require changing using FileObject#openInputStream rather than FileObject#getCharContent.
package sample;
@walkingkooka.resource.TextResourceAware(normalizeSpace = true, fileExtension = ".txt2")
public class TextFile {
// members not copied to generated class
}generates...
package sample;
public final class TextFileProvider implements walkingkooka.resource.TextResource {
@Override
public String text() {
return "content of sample/TextFile.txt2";
}
}usage
new TextFileProvider().text(); // returns "content of sample/TextFile.txt2"