Package org.antlr.stringtemplate

Examples of org.antlr.stringtemplate.AttributeRenderer


    return n;
    }

    protected int writePOJO(StringTemplate self, Object o, StringTemplateWriter out) throws IOException {
        int n = 0;
        AttributeRenderer renderer =
            self.getAttributeRenderer(o.getClass());
        String v = null;
        if ( renderer!=null ) {
            if ( formatString != null ) v = renderer.toString(o, formatString);
            else v = renderer.toString(o);
        }
        else v = o.toString();
        if ( wrapString!=null ) n = out.write(v, wrapString);
        else n = out.write( v );
        return n;
View Full Code Here


            if ( wrapString!=null ) {
                n = out.writeWrapSeparator(wrapString);
            }
            // check if formatting needs to be applied to the stToWrite
            if ( formatString != null ) {
                AttributeRenderer renderer =
                    self.getAttributeRenderer(String.class);
                if ( renderer != null ) {
                    // you pay a penalty for applying format option to a template
                    // because the template must be written to a temp StringWriter so it can
                    // be formatted before being written to the real output.
                    StringWriter buf = new StringWriter();
                    StringTemplateWriter sw =
                        self.getGroup().getStringTemplateWriter(buf);
                    stToWrite.write(sw);
                    n = out.write(renderer.toString(buf.toString(), formatString));
                    return n;
                }
            }
            n = stToWrite.write(out);
        }
View Full Code Here

            }

            InputStream inputStream = this.source.openStream();
            try {
                StringTemplate stringTemplate = new StringTemplate(IOUtils.toString(inputStream, "UTF-8"));
                stringTemplate.registerRenderer(String.class, new AttributeRenderer() {
                    public String toString(Object object) {
                        return StringEscapeUtils.escapeXml(object.toString());
                    }

                    public String toString(Object o, String string) {
View Full Code Here

        try {
            InputStream inputStream = this.source.openStream();

            try {
                StringTemplate stringTemplate = new StringTemplate(IOUtils.toString(inputStream, "UTF-8"));
                stringTemplate.registerRenderer(String.class, new AttributeRenderer() {

                    public String toString(Object object) {
                        return StringEscapeUtils.escapeXml(object.toString());
                    }
View Full Code Here

            }

            InputStream inputStream = this.source.openStream();
            try {
                StringTemplate stringTemplate = new StringTemplate(IOUtils.toString(inputStream, "UTF-8"));
                stringTemplate.registerRenderer(String.class, new AttributeRenderer() {
                    public String toString(Object object) {
                        return StringEscapeUtils.escapeXml(object.toString());
                    }
                });
View Full Code Here

        try {
            InputStream inputStream = this.source.openStream();

            try {
                StringTemplate stringTemplate = new StringTemplate(IOUtils.toString(inputStream, "UTF-8"));
                stringTemplate.registerRenderer(String.class, new AttributeRenderer() {

                    public String toString(Object object) {
                        return StringEscapeUtils.escapeXml(object.toString());
                    }
                });
View Full Code Here

            xmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", this.getXMLConsumer());

            InputStream inputStream = this.source.openStream();
            try {
                StringTemplate stringTemplate = new StringTemplate(IOUtils.toString(inputStream, "UTF-8"));
                stringTemplate.registerRenderer(String.class, new AttributeRenderer() {
                    public String toString(Object object) {
                        return StringEscapeUtils.escapeXml(object.toString());
                    }
                });
View Full Code Here

TOP

Related Classes of org.antlr.stringtemplate.AttributeRenderer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.