Headline

Unparsing company structure using Technology:StringTemplate in Language:Java

Illustration

This contribution uses the StringTemplate API to unparse a company to a string build using templates from a StringTemplate file. Templates can be compared to functions, which takes arguments and returns a string:

Invalid Language supplied

For further information on StringTemplates see here.

The class Unparsing.java loads the template file companyUnparsing.stg and puts the values from the company to the template methods:

public static String unparse(Company c) {
    //load template
    STGroup group = new STGroupFile("templates" + File.separatorChar 
			+ "companyUnparsing.stg");
    //get right template method
	ST st = group.getInstanceOf("company");	
	st.add("c", c);
	return st.render();
}

Usage

This contribution uses Technology:Gradle for building. Technology:Eclipse is supported.

See https://github.com/101companies/101simplejava/blob/master/README.md


There are no revisions for this page.

User contributions

    This user never has never made submissions.

    User edits

    Syntax for editing wiki

    For you are available next options:

    will make text bold.

    will make text italic.

    will make text underlined.

    will make text striked.

    will allow you to paste code headline into the page.

    will allow you to link into the page.

    will allow you to paste code with syntax highlight into the page. You will need to define used programming language.

    will allow you to paste image into the page.

    is list with bullets.

    is list with numbers.

    will allow your to insert slideshare presentation into the page. You need to copy link to presentation and insert it as parameter in this tag.

    will allow your to insert youtube video into the page. You need to copy link to youtube page with video and insert it as parameter in this tag.

    will allow your to insert code snippets from @worker.

    Syntax for editing wiki

    For you are available next options:

    will make text bold.

    will make text italic.

    will make text underlined.

    will make text striked.

    will allow you to paste code headline into the page.

    will allow you to link into the page.

    will allow you to paste code with syntax highlight into the page. You will need to define used programming language.

    will allow you to paste image into the page.

    is list with bullets.

    is list with numbers.

    will allow your to insert slideshare presentation into the page. You need to copy link to presentation and insert it as parameter in this tag.

    will allow your to insert youtube video into the page. You need to copy link to youtube page with video and insert it as parameter in this tag.

    will allow your to insert code snippets from @worker.