{"id":1707,"date":"2012-08-09T01:00:00","date_gmt":"2012-08-09T01:00:00","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/2012\/10\/java-code-generation-with-jannocessor.html"},"modified":"2012-10-22T06:33:34","modified_gmt":"2012-10-22T06:33:34","slug":"java-code-generation-with-jannocessor","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2012\/08\/java-code-generation-with-jannocessor.html","title":{"rendered":"Java code generation with JAnnocessor"},"content":{"rendered":"<div dir=\"ltr\" style=\"text-align: left\">\n<div style=\"text-align: justify\">In this article I will show you how to generate code with <strong><a href=\"http:\/\/www.jannocessor.org\/\">JAnnocessor<\/a><\/strong> framework created by <a href=\"http:\/\/nikolche-mihajlovski.info\/\">Nikolche Mihajlovski<\/a>. First time I met JAnnocessor on <a href=\"http:\/\/maciejwalkowiak.pl\/blog\/2012\/05\/31\/geecon-2012-subjective-review\/\">GeeCON 2012<\/a> conference during Nikolche\u2019s speech: <strong>\u201cInnovative and Pragmatic Java Source Code Generation\u201d<\/strong> <a href=\"http:\/\/s3-eu-west-1.amazonaws.com\/presentations2012\/39_presentation.pdf\">(slides)<\/a>. Afterwards I used it successfully in one of my projects. There are almost no resources about this framework so I hope my article will be useful for those who are interested in using it or just are looking for brand new toy for their project.   <\/div>\n<p><strong>Background<\/strong>        <\/p>\n<p>Every Java developer uses some sort of <strong>code generation<\/strong> tool on a daily basis. Setters, getters, trivial constructors, toString \u2013 all of these is just a boilerplate code. Usually we generate it with our favorite IDE\u2019s help. I can\u2019t really imagine coding it manually and because Java is a static language we will never be able to skip this process.          <\/p>\n<p>Those trivial examples of code generation provided by all modern IDEs are not the only situations when code generation is useful. There are many modern frameworks generate some code to help us to write more reliable code and do it faster. I think the most well known examples are <a href=\"http:\/\/www.querydsl.com\/\">QueryDSL<\/a> and <a href=\"http:\/\/docs.jboss.org\/hibernate\/jpamodelgen\/1.0\/reference\/en-US\/html_single\/\">JPA2 Metamodel Generator<\/a> that creates objects used to perform type-safe database queries.         <\/p>\n<p>There are also other situations \u2013 not so well supported by IDE \u2013 where we could use code generation. Usually it might be helpful in generating:         <\/p>\n<ul>\n<li>builder<\/li>\n<li>facade<\/li>\n<li>DTOs and mappers from domain objects to DTOs<\/li>\n<\/ul>\n<p>These are only examples. For some projects there might be something project specific where we can\u2019t use any existing code generation tool and we have to write our own. How to do that? With <a href=\"http:\/\/docs.oracle.com\/javase\/1.5.0\/docs\/guide\/apt\/\">Java APT \u2013 Annotation Processing Tool<\/a>.         <\/p>\n<p><strong>Few words about Java APT<\/strong>        <\/p>\n<p>Annotation Processing Tool was introduced in Java 1.5 and provides low level API for processing annotated classes. It is a base for most (maybe all?) existing code generation frameworks and because of really low level API I don\u2019t recommend using plain Java APT if you just want to generate some classes. How creepy is code generation with APT look at <a href=\"http:\/\/apt-jelly.sourceforge.net\/index.html\">example<\/a> on apt-jelly (another code generation tool) page.         <\/p>\n<p>Instead of using plain Java APT \u2013 you can use one of existing frameworks. Recently I\u2019ve attended to conference talk about interesting <a href=\"http:\/\/www.jannocessor.org\/\">JAnnocessor<\/a> that seems to do its job pretty well.<\/p>\n<p><strong>Hello JAnnocessor<\/strong>        <\/p>\n<p>JAnnocessor is a quite new framework made by Nikolche Mihajlovski. How is it different from APT? Here is how author what author says:         <i>       <\/p>\n<p>JAnnocessor is built on top of Java APT, encapsulating the Java source code model in a rich and convenient high-level domain model that serves as a good target for expressive matching and transformation.        <\/i>        <\/p>\n<p>JAnnocessor comes with couple of built in processors: <strong>builder<\/strong>, <strong>dto<\/strong>, <strong>facade<\/strong> and <strong>mapper<\/strong>. If you need custom functionality you can easily write it by your own.         <\/p>\n<p>There is one big drawback \u2013 very very poor documentation. Actually there is almost no documentation at all. In <a href=\"http:\/\/code.google.com\/p\/jannocessor\/w\/list\">wiki<\/a> you won\u2019t find too much and what is even worse \u2013 you won\u2019t find Javadocs in framework classes neither. Although there is <a href=\"http:\/\/code.google.com\/p\/jannocessor\/wiki\/GettingStarted\">Getting Started Guide<\/a> written by author I miss there some points so I will guide you through basics step by step.         <strong>&nbsp;<\/strong><div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p><strong>Maven setup<\/strong>        <\/p>\n<p>We will use JAnnocessor only during compile phase so there is no need to add it into our application package \u2013 we set scope to <strong>provided<\/strong>        <\/p>\n<pre class=\"brush:xml\">&lt;dependency&gt;\r\n    &lt;groupId&gt;com.googlecode.jannocessor&lt;\/groupId&gt;\r\n    &lt;artifactId&gt;jannocessor&lt;\/artifactId&gt;\r\n    &lt;version&gt;0.7.2&lt;\/version&gt;\r\n    &lt;scope&gt;provided&lt;\/scope&gt;\r\n&lt;\/dependency&gt;\r\n<\/pre>\n<p>Next part is annotation processing plugin. Although <a href=\"http:\/\/code.google.com\/p\/jannocessor\/wiki\/GettingStarted\">Getting Started Guide<\/a> recommends to use jannocessor-maven-plugin I was forced to do it \u201cold fashioned way\u201d with maven-processor-plugin because I missed some configuration options.         <\/p>\n<p>Into build\/plugins section we add:         <\/p>\n<pre class=\"brush:xml\">&lt;plugin&gt;\r\n\t&lt;groupId&gt;org.bsc.maven&lt;\/groupId&gt;\r\n\t&lt;artifactId&gt;maven-processor-plugin&lt;\/artifactId&gt;\r\n\t&lt;version&gt;2.0.4&lt;\/version&gt;\r\n\t&lt;executions&gt;\r\n\t\t&lt;execution&gt;\r\n\t\t\t&lt;id&gt;generate-code&lt;\/id&gt;\r\n\t\t\t&lt;goals&gt;\r\n\t\t\t\t&lt;goal&gt;process&lt;\/goal&gt;\r\n\t\t\t&lt;\/goals&gt;\r\n\t\t\t&lt;phase&gt;compile&lt;\/phase&gt;\r\n\r\n\t\t\t&lt;configuration&gt;\r\n\t\t\t\t&lt;processors&gt;\r\n\t\t\t\t\t&lt;processor&gt;org.jannocessor.processor.JannocessorProcessor&lt;\/processor&gt;\r\n\t\t\t\t&lt;\/processors&gt;\r\n\r\n\t\t\t\t&lt;systemProperties&gt;\r\n\t\t\t\t\t&lt;logback.configurationFile&gt;${project.basedir}\/etc\/jannocessor-logback.xml&lt;\/logback.configurationFile&gt;\r\n\t\t\t\t&lt;\/systemProperties&gt;\r\n\t\t\t\t&lt;options&gt;\r\n\t\t\t\t\t&lt;templates.path&gt;${project.basedir}\/src\/main\/resources&lt;\/templates.path&gt;\r\n\t\t\t\t&lt;\/options&gt;\r\n\t\t\t\t&lt;defaultOutputDirectory&gt;${project.basedir}\/target\/generated-sources\/&lt;\/defaultOutputDirectory&gt;\r\n\t\t\t&lt;\/configuration&gt;\r\n\t\t&lt;\/execution&gt;\r\n\t&lt;\/executions&gt;\r\n&lt;\/plugin&gt;\r\n<\/pre>\n<ul>\n<li><strong>processors<\/strong> \u2013 tells maven-processor-plugin which class performs annotation processing \u2013 don\u2019t change it<\/li>\n<li><strong>configuration\/logback.configurationFile<\/strong> \u2013 that\u2019s optional. JAnnocessor uses inside logback for logging and if you do so as well in your project and you have logback.xml in classpath it is going to be used by JAnnocessor. I recommend to write separate logging configuration for JAnnocessor to avoid possible problems (for example if you use <a href=\"http:\/\/logback.qos.ch\/manual\/configuration.html#conditional\">janino conditionals<\/a>). jannocessor-logback.xml can be as simple as:\n<pre class=\"brush:xml\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\r\n&lt;configuration&gt;\r\n\r\n\t&lt;appender name=\"console\" class=\"ch.qos.logback.core.ConsoleAppender\"&gt;\r\n\t\t&lt;encoder&gt;\r\n\t\t\t&lt;pattern&gt;%-30(%date) %-5level %logger{0} %msg%n&lt;\/pattern&gt;\r\n\t\t&lt;\/encoder&gt;\r\n\t&lt;\/appender&gt;\r\n\r\n\t&lt;root level=\"error\"&gt;\r\n\t\t&lt;appender-ref ref=\"console\"\/&gt;\r\n\t&lt;\/root&gt;\r\n\r\n&lt;\/configuration&gt;\r\n<\/pre>\n<\/li>\n<li><strong>options\/templates.path<\/strong> \u2013 probably you will use custom JAnnocessor templates. That line can be removed if you won\u2019t<\/li>\n<li><strong>defaultOutputDirectory<\/strong> \u2013 that\u2019s important \u2013 by default generated classes are added to src\/main\/java \u2013 which is in my opinon very bad idea. Remember that <strong>all generated classes are recreated every Maven build and all modifications made by hand are lost<\/strong>. That\u2019s why generated classes should be places in <code>\/target\/generated-sources\/<\/code> or <code>\/target\/generated-test-sources\/<\/code><\/li>\n<\/ul>\n<p><strong>Builder generation<\/strong>        <\/p>\n<p>In this example I will use built-in generator to generate builder class for my simple POJO.         <\/p>\n<p>First of all we need new annotation to mark classes for whom we want to generate builder. It can be as simple as:         <\/p>\n<pre class=\"brush:java\">package pl.maciejwalkowiak.jannocessor.domain;\r\n\r\npublic @interface GenerateBuilder {\r\n}\r\n<\/pre>\n<p>Our sample POJO:         <\/p>\n<pre class=\"brush:java\">package pl.maciejwalkowiak.jannocessor.domain;\r\n\r\n@GenerateBuilder\r\npublic class Person {\r\n\tprivate String firstName;\r\n\tprivate String lastName;\r\n\tprivate Integer age;\r\n\r\n\tpublic String getFirstName() {\r\n\t\treturn firstName;\r\n\t}\r\n\r\n\tpublic void setFirstName(String firstName) {\r\n\t\tthis.firstName = firstName;\r\n\t}\r\n\r\n\tpublic String getLastName() {\r\n\t\treturn lastName;\r\n\t}\r\n\r\n\tpublic void setLastName(String lastName) {\r\n\t\tthis.lastName = lastName;\r\n\t}\r\n\r\n\tpublic Integer getAge() {\r\n\t\treturn age;\r\n\t}\r\n\r\n\tpublic void setAge(Integer age) {\r\n\t\tthis.age = age;\r\n\t}\r\n}\r\n<\/pre>\n<p>Next important part is to tell JAnnocessor what has to be generated. In order to do that we need to create specific class in specific package: <code>org.jannocessor.config.Processors<\/code>. I couldn\u2019t find a way to make it configurable so that configuration could be in our project\u2019s package.         <\/p>\n<p>In configuration we specify where created classes should be placed: <code>pl.maciejwalkowiak.jannocessor.domain.builder<\/code> and where are base bean classes: <code>pl.maciejwalkowiak.jannocessor.domain<\/code>. Last parameter means if we want to use debug mode \u2013 for now it isn\u2019t important.         <\/p>\n<pre class=\"brush:java\">package org.jannocessor.config;\r\n\r\nimport pl.maciejwalkowiak.jannocessor.domain.GenerateBuilder;\r\n\r\nimport org.jannocessor.extra.processor.BuilderGenerator;\r\nimport org.jannocessor.model.structure.JavaClass;\r\nimport org.jannocessor.processor.annotation.Annotated;\r\nimport org.jannocessor.processor.annotation.Types;\r\n\r\npublic class Processors {\r\n\r\n\t@Annotated(GenerateBuilder.class)\r\n\t@Types(JavaClass.class)\r\n\tpublic BuilderGenerator generateBuilder() {\r\n\t\treturn new BuilderGenerator(\"pl.maciejwalkowiak.jannocessor.domain.builder\", \"pl.maciejwalkowiak.jannocessor.domain\", false);\r\n\t}\r\n}\r\n<\/pre>\n<p><strong>Let\u2019s run it<\/strong>        <\/p>\n<p>In order to run it we just need to execute <code>mvn compile<\/code>. In <code>target\/generated-sources\/pl\/maciejwalkowiak\/jannocessor\/domain\/builder\/<\/code> we will find class <code>PersonBuilder<\/code>:         <\/p>\n<pre class=\"brush:java\">package pl.maciejwalkowiak.jannocessor.domain.builder;\r\n\r\nimport pl.maciejwalkowiak.jannocessor.domain.Person;\r\nimport javax.annotation.Generated;\r\n\r\n\/**\r\n * Generated by JAnnocessor\r\n *\/\r\n@Generated(\"Easily with JAnnocessor\")\r\npublic class PersonBuilder {\r\n\r\n    private String firstName;\r\n\r\n    private String lastName;\r\n\r\n    private Integer age;\r\n\r\n    public PersonBuilder firstName(String firstName) {\r\n        this.firstName = firstName;\r\n        return this;\r\n    }\r\n\r\n    public PersonBuilder lastName(String lastName) {\r\n        this.lastName = lastName;\r\n        return this;\r\n    }\r\n\r\n    public PersonBuilder age(Integer age) {\r\n        this.age = age;\r\n        return this;\r\n    }\r\n\r\n    public Person build() {\r\n        Person instance = new Person();\r\n\r\n        instance.setFirstName(firstName);\r\n        instance.setLastName(lastName);\r\n        instance.setAge(age);\r\n\r\n        return instance;\r\n    }\r\n\r\n}\r\n<\/pre>\n<p>Thanks to builder class we have fluent interface for creating <code>Person<\/code> objects:         <\/p>\n<pre class=\"brush:java\">Person person = new PersonBuilder().firstName(\"John\").lastName(\"Doe\").age(25).build();\r\n<\/pre>\n<p><strong>Creating our own generator<\/strong>        <\/p>\n<p>For creating custom generators JAnnocessor provides rich API and couple of examples. Unfortunately there is no guide or tutorial available. For this article I wanted to write quickly generator for FEST Assert 2.x but after some time digging in JAnnocessor source code I gave up. Instead I will just show concept.         <\/p>\n<p>In order to code custom generator you just need to create class that inherits from <code>org.jannocessor.extra.processor.AbstractGenerator<\/code>.         <\/p>\n<pre class=\"brush:java\">public class MyCustomGenerator extends AbstractGenerator&lt;AbstractJavaClass&gt; {\r\n\r\n\tpublic MyCustomGenerator(String destPackage, boolean inDebugMode) {\r\n\t\tsuper(destPackage, inDebugMode);\r\n\t}\r\n\r\n\t@Override\r\n\tprotected void generateCodeFrom(PowerList&lt;AbstractJavaClass&gt; models, ProcessingContext context) {\r\n\t\t\/\/ ....\r\n\t}\r\n}\r\n<\/pre>\n<p><code>PowerList&lt;AbstractJavaClass&gt; models<\/code> represents collection of all classes annotated with custom annotation. Then you have access to all class fields, methods, implemented interfaces etc. The only thing that I missed is rich access to classes superclass. In order to get superclass\u2019 fields I had to use Java Reflection API.         <\/p>\n<p>If you want to write custom generator I encourage you to look into examples like <a href=\"http:\/\/code.google.com\/p\/jannocessor\/source\/browse\/jannocessor-extras\/src\/main\/java\/org\/jannocessor\/extra\/processor\/BuilderGenerator.java\">BuilderGenerator<\/a>. It\u2019s not much but it will be definitely helpful.         <strong>&nbsp;<\/strong><\/p>\n<p><strong>Summary<\/strong>        <\/p>\n<p>In this post I\u2019ve shown how to setup and use JAnnocessor. Although I think its good and possibly very useful library, lack of documentation makes it impossible to use it in real serious project. I hope Nikolche will write good docs or build community around project that will do it. I also hope that project will move to github. It somehow become a standard so if author want\u2019s to build community around it \u2013 I think it is the only right move. Nevertheless I asked him about that and at least for now he doesn\u2019t have any plans to do so.  <\/p>\n<p><strong><i>Reference: <\/i><\/strong><a href=\"http:\/\/maciejwalkowiak.pl\/blog\/2012\/06\/18\/java-code-generation-with-jannocessor\/\">Java code generation with JAnnocessor <\/a> from our <a href=\"http:\/\/www.javacodegeeks.com\/p\/jcg.html\">JCG partner<\/a> Maciej Walkowiak at the <a href=\"http:\/\/maciejwalkowiak.pl\/\">Software Development Journey<\/a> blog.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this article I will show you how to generate code with JAnnocessor framework created by Nikolche Mihajlovski. First time I met JAnnocessor on GeeCON 2012 conference during Nikolche\u2019s speech: \u201cInnovative and Pragmatic Java Source Code Generation\u201d (slides). Afterwards I used it successfully in one of my projects. There are almost no resources about this &hellip;<\/p>\n","protected":false},"author":245,"featured_media":143,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[278,606],"class_list":["post-1707","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-code-generation","tag-jannocessor"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Java code generation with JAnnocessor - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"In this article I will show you how to generate code with JAnnocessor framework created by Nikolche Mihajlovski. First time I met JAnnocessor on GeeCON\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2012\/08\/java-code-generation-with-jannocessor.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java code generation with JAnnocessor - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"In this article I will show you how to generate code with JAnnocessor framework created by Nikolche Mihajlovski. First time I met JAnnocessor on GeeCON\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2012\/08\/java-code-generation-with-jannocessor.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2012-08-09T01:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2012-10-22T06:33:34+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/jannocessor-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Maciej Walkowiak\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Maciej Walkowiak\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/08\\\/java-code-generation-with-jannocessor.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/08\\\/java-code-generation-with-jannocessor.html\"},\"author\":{\"name\":\"Maciej Walkowiak\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/918c1b6d9d8de83830e5b24c0f0f4419\"},\"headline\":\"Java code generation with JAnnocessor\",\"datePublished\":\"2012-08-09T01:00:00+00:00\",\"dateModified\":\"2012-10-22T06:33:34+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/08\\\/java-code-generation-with-jannocessor.html\"},\"wordCount\":1165,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/08\\\/java-code-generation-with-jannocessor.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/jannocessor-logo.jpg\",\"keywords\":[\"Code Generation\",\"JAnnocessor\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/08\\\/java-code-generation-with-jannocessor.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/08\\\/java-code-generation-with-jannocessor.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/08\\\/java-code-generation-with-jannocessor.html\",\"name\":\"Java code generation with JAnnocessor - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/08\\\/java-code-generation-with-jannocessor.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/08\\\/java-code-generation-with-jannocessor.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/jannocessor-logo.jpg\",\"datePublished\":\"2012-08-09T01:00:00+00:00\",\"dateModified\":\"2012-10-22T06:33:34+00:00\",\"description\":\"In this article I will show you how to generate code with JAnnocessor framework created by Nikolche Mihajlovski. First time I met JAnnocessor on GeeCON\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/08\\\/java-code-generation-with-jannocessor.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/08\\\/java-code-generation-with-jannocessor.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/08\\\/java-code-generation-with-jannocessor.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/jannocessor-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/jannocessor-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/08\\\/java-code-generation-with-jannocessor.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Java code generation with JAnnocessor\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/918c1b6d9d8de83830e5b24c0f0f4419\",\"name\":\"Maciej Walkowiak\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/897c85e1c7fe1b9b9ed640f6ff04c5f2141980d6c5c2b933034783495c8e8db5?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/897c85e1c7fe1b9b9ed640f6ff04c5f2141980d6c5c2b933034783495c8e8db5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/897c85e1c7fe1b9b9ed640f6ff04c5f2141980d6c5c2b933034783495c8e8db5?s=96&d=mm&r=g\",\"caption\":\"Maciej Walkowiak\"},\"sameAs\":[\"http:\\\/\\\/maciejwalkowiak.pl\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/Maciej-Walkowiak\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Java code generation with JAnnocessor - Java Code Geeks","description":"In this article I will show you how to generate code with JAnnocessor framework created by Nikolche Mihajlovski. First time I met JAnnocessor on GeeCON","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2012\/08\/java-code-generation-with-jannocessor.html","og_locale":"en_US","og_type":"article","og_title":"Java code generation with JAnnocessor - Java Code Geeks","og_description":"In this article I will show you how to generate code with JAnnocessor framework created by Nikolche Mihajlovski. First time I met JAnnocessor on GeeCON","og_url":"https:\/\/www.javacodegeeks.com\/2012\/08\/java-code-generation-with-jannocessor.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2012-08-09T01:00:00+00:00","article_modified_time":"2012-10-22T06:33:34+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/jannocessor-logo.jpg","type":"image\/jpeg"}],"author":"Maciej Walkowiak","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Maciej Walkowiak","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2012\/08\/java-code-generation-with-jannocessor.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/08\/java-code-generation-with-jannocessor.html"},"author":{"name":"Maciej Walkowiak","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/918c1b6d9d8de83830e5b24c0f0f4419"},"headline":"Java code generation with JAnnocessor","datePublished":"2012-08-09T01:00:00+00:00","dateModified":"2012-10-22T06:33:34+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/08\/java-code-generation-with-jannocessor.html"},"wordCount":1165,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/08\/java-code-generation-with-jannocessor.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/jannocessor-logo.jpg","keywords":["Code Generation","JAnnocessor"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2012\/08\/java-code-generation-with-jannocessor.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2012\/08\/java-code-generation-with-jannocessor.html","url":"https:\/\/www.javacodegeeks.com\/2012\/08\/java-code-generation-with-jannocessor.html","name":"Java code generation with JAnnocessor - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/08\/java-code-generation-with-jannocessor.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/08\/java-code-generation-with-jannocessor.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/jannocessor-logo.jpg","datePublished":"2012-08-09T01:00:00+00:00","dateModified":"2012-10-22T06:33:34+00:00","description":"In this article I will show you how to generate code with JAnnocessor framework created by Nikolche Mihajlovski. First time I met JAnnocessor on GeeCON","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/08\/java-code-generation-with-jannocessor.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2012\/08\/java-code-generation-with-jannocessor.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2012\/08\/java-code-generation-with-jannocessor.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/jannocessor-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/jannocessor-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2012\/08\/java-code-generation-with-jannocessor.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"Java code generation with JAnnocessor"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/918c1b6d9d8de83830e5b24c0f0f4419","name":"Maciej Walkowiak","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/897c85e1c7fe1b9b9ed640f6ff04c5f2141980d6c5c2b933034783495c8e8db5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/897c85e1c7fe1b9b9ed640f6ff04c5f2141980d6c5c2b933034783495c8e8db5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/897c85e1c7fe1b9b9ed640f6ff04c5f2141980d6c5c2b933034783495c8e8db5?s=96&d=mm&r=g","caption":"Maciej Walkowiak"},"sameAs":["http:\/\/maciejwalkowiak.pl"],"url":"https:\/\/www.javacodegeeks.com\/author\/Maciej-Walkowiak"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/1707","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/245"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=1707"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/1707\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/143"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=1707"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=1707"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=1707"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}