Skip to content

MorrisZ/pojo-mapping

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pojo-mapping

A tiny maven plugin for generating front-end model class based on backend Java Bean.

How to use

  1. Download source code,and run maven install.
cd pojo-mapping
mvn clean install -DskipTests
  1. Edit maven settings(~/.m2/settings.xml or ${MAVEN_HOME}/conf/settings.xml).

Add groupId to pluginGroups so that the plugin prefix, which is pojo-mapping, can be used in command line.

<pluginGroups>
    <!-- add this line -->
    <pluginGroup>com.morrisz.tools</pluginGroup>
</pluginGroups>
  1. Run genModel goal in project root.
mvn pojo-mapping:genModel -Dclass=com.foo.Foo

The generated front-end model would be printed to the logger like this:

/**
* Generated by pojo-mapping 1.0.0
*/
Ext.define('change.me.Foo', {
    extend: 'Ext.data.Model',
    idProperty: 'id',
    fields: [
        {name: 'firstName'},
        {name: 'address'},
        {name: 'lastName'}
    ]
});
Since it uses reflection, the class com.foo.Foo should be compiled first.

Command line arguments

# or:
mvn pojo-mapping:genModel -Dclass=com.foo.Foo -Dstyle=extjs -Dout=./foo.js
arguments required desc.
class true the model class
style false only extjs style is supported(for now, I guess...)
out false output file, defaults to maven logger

About

A Java POJO mapping tool for generating web front-end model.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published