Does there exist a Java library with an API for generating a java source file?

Posted on 2011-10-26
Last Modified: 2013-11-13
I know there are many different source code generators out there. Most use XML or some structured text as a template. I am looking for a library that has an API for constructing simple java class sources...
JavaSourceBuilder builder = new JavaSourceBuilder(Type.CLASS);
builder.addField(new FieldBuilder(Modifier.PRIVATE, String.class, "name"));

Question by:Uncle_J
    LVL 86

    Expert Comment

    Generating java source from what - a class file, xml...?

    Author Comment

    From code. The example I gave in my description is what a possible implementation may look like. There are tools like this for building XML documents, HTML, etc... Any for Java source?
    LVL 86

    Expert Comment

    I must say i've never seen one
    LVL 4

    Accepted Solution

    According to this SO question, there are at least two such libraries, one of which is Eclipse-specific, the other seems to be even supported by Sun.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    sumHeights  challenge 17 52
    allStar challenge 1 27
    strDist challenge 35 72
    What is the latest versions eclipse neon 2 68
    Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
    Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
    This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now