рдЬрд╛рдорди рдХреЗ рд╕рд╛рде рдХреЛрдб рдмрдирд╛рдирд╛

рдХреЛрдб рдЬрдирд░реЗрд╢рди


рдХрд╛рдо рдХреЗ рд╡рд┐рднрд┐рдиреНрди рд╕реНрдерд╛рдиреЛрдВ рдкрд░ рдХрдИ рдкрд░рд┐рдпреЛрдЬрдирд╛рдУрдВ рдореЗрдВ, рдореИрдВрдиреЗ рдХреЛрдб рдкреАрдврд╝реА рдХрд╛ рдЙрдкрдпреЛрдЧ рдХрд┐рдпрд╛ред рдХреНрдпреЛрдВ?

рд╕рдмрд╕реЗ рдЕрдзрд┐рдХ рдмрд╛рд░, рдпрд╣ рдкрд░рд┐рд╡рд░реНрддрдиреЛрдВ рдХреЗ рджреМрд░рд╛рди рдХреЛрдб рдХреА рд╢реБрджреНрдзрддрд╛ рдХрд╛ рд╕рдВрд░рдХреНрд╖рдг рд╕реБрдирд┐рд╢реНрдЪрд┐рдд рдХрд░рддрд╛ рд╣реИред рдЙрджрд╛рд╣рд░рдг рдХреЗ рд▓рд┐рдП, рдбреЛрдореЗрди рдореЙрдбрд▓ рдореЗрдВ рдПрдХ рдЕрдиреНрдп рдбреЗрдЯрд╛ рдкреНрд░рдХрд╛рд░ рдЬреЛрдбрд╝рддреЗ рд╕рдордп, рдЖрдкрдХреЛ рдЬрд╛рд╡рд╛ рдореЗрдВ рдПрдХ рд╡рд░реНрдЧ, рд╕реА ++ рдореЗрдВ рдПрдХ рд╡рд░реНрдЧ, рдЙрдирдХреЗ рдмреАрдЪ рдПрдХ рд░реВрдкрд╛рдВрддрд░рдг рдХреЛрдб рдФрд░ рдПрдирдо рдореЗрдВ рдПрдХ рдореВрд▓реНрдп рдЬреЛрдбрд╝рдирд╛ рд╣реЛрдЧрд╛ред рдХреЛрдб рдЙрддреНрдкрдиреНрди рдХрд░рдиреЗ рдФрд░ рдкреЗрди рдХреЗ рд╕рд╛рде рдХрд╛рдо рдХрд┐рдП рдмрд┐рдирд╛, рдмрд╣реБрдд рдХреБрдЫ рд╣реИ, рдФрд░ рдЗрд╕рдореЗрдВ рд╕реЗ рдХреБрдЫ рдХреЛ рднреВрд▓рдиреЗ рдХрд╛ рдореМрдХрд╛ рд╣рдореЗрд╢рд╛ рдорд┐рд▓рддрд╛ рд╣реИред

рдХрднреА-рдХрднреА рдкреНрд░рддрд┐рдмрд┐рдВрдм рдХреЛрдб рдкреАрдврд╝реА рдХреЗ рд▓рд┐рдП рдПрдХ рд╡рд┐рдХрд▓реНрдк рд╣реЛ рд╕рдХрддрд╛ рд╣реИ, рд▓реЗрдХрд┐рди рдлрд┐рд░ рднреА рдРрд╕реЗ рдХреЛрдб рдкреАрдврд╝реА рдХреЗ рд▓рд┐рдП рдЯреЗрдореНрдкрд▓реЗрдЯ рдХреА рддреБрд▓рдирд╛ рдореЗрдВ рдХрдо рдкрдардиреАрдп рд╣реЛрдВрдЧреЗред

рдХреЛрдб рдЬрдирд░реЗрдЯ рдХрд░рдиреЗ рдХреА рдкреНрд░рд╛рд░рдВрднрд┐рдХ рдЬрд╛рдирдХрд╛рд░реА рдмрд╣реБрдд рдЕрд▓рдЧ рджрд┐рдЦ рд╕рдХрддреА рд╣реИ - рдпрд╣ рдПрдХ рдЬрд╛рд╡рд╛ рдХреНрд▓рд╛рд╕ рд╣реЛ рд╕рдХрддреА рд╣реИ, рдЬрд┐рд╕рдХреЗ рдорд╛рдзреНрдпрдо рд╕реЗ рд╣рдо рдкрд░рд╛рд╡рд░реНрддрди рдХреЗ рдорд╛рдзреНрдпрдо рд╕реЗ рдЧреБрдгреЛрдВ рдХреЛ рдкрдврд╝рддреЗ рд╣реИрдВ рдФрд░ C ++, рдпрд╛ csv рдлрд╝рд╛рдЗрд▓, рдпрд╛ XML, рдпрд╛ рдХреБрдЫ рдФрд░ рдореЗрдВ рдПрдХ рдХреНрд▓рд╛рд╕ рдЙрддреНрдкрдиреНрди рдХрд░рддреЗ рд╣реИрдВред



рдореИрдВ рдпрд╣ рдмрддрд╛рдиреЗ рдХреА рдХреЛрд╢рд┐рд╢ рдХрд░реВрдВрдЧрд╛ рдХрд┐ рдореИрдВ рдЬреИрд╡рди рдлреНрд░реЗрдорд╡рд░реНрдХ рдХрд╛ рдЙрдкрдпреЛрдЧ рдХрд░рдХреЗ рдорд╛рд╡реЗрди рдкрд░рд┐рдпреЛрдЬрдирд╛рдУрдВ рдореЗрдВ рдХреЛрдб рдХреИрд╕реЗ рдЙрддреНрдкрдиреНрди рдХрд░рддрд╛ рд╣реВрдВред



рд╕рдорд╕реНрдпрд╛ рдХрд╛ рдмрдпрд╛рди


рдЙрджрд╛рд╣рд░рдг рдХреЗ рд▓рд┐рдП, рдЪрд▓реЛ рдорд╛рдирдЪрд┐рддреНрд░реЛрдВ рдХреЗ рд▓рд┐рдП рдПрдХ рд╕реЗрд╡рд╛ рд╕реЗ рдПрдХ рдХрд╛рд░реНрдп рд▓реЗрддреЗ рд╣реИрдВ, рдЬрд┐рд╕реЗ рдореИрдВ рд▓рдВрдмреЗ рд╕рдордп рд╕реЗ рд▓рд┐рдЦ рд░рд╣рд╛ рд╣реВрдВ, рд▓реЗрдХрд┐рди рдЕрднреА рддрдХ рдирд╣реАрдВ рд▓рд┐рдЦрд╛ рд╣реИред рдпрд░реВрд╢рд▓реЗрдо рдореЗрдВ рдорд╛рдирдЪрд┐рддреНрд░ рдкрд░ рдПрдХ рдмрд┐рдВрджреБ рд╣реИ рдФрд░ рдЗрд╕рдХреЗ рд▓рд┐рдП рдЧреБрдгреЛрдВ рдХреА рдПрдХ рд╕реВрдЪреА рд╣реИ рдЬреЛ рдЗрд╕ рдмрд┐рдВрджреБ рдкрд░ рд╣реЛ рд╕рдХрддреА рд╣реИред рдЙрджрд╛рд╣рд░рдг рдХреЗ рд▓рд┐рдП, рдпрд╣ рджреВрд╕рд░реЗ рдордВрджрд┐рд░ рдпрд╛ рдмреАрдЬрд╛рдиреНрдЯрд┐рдпрдо, рдПрдХ рдИрд╕рд╛рдИ рдпрд╛ рдореБрд╕реНрд▓рд┐рдо рдордВрджрд┐рд░, рдЖрджрд┐ рдХреЗ рд╕рдордп рдХреЛ рд╕рдВрджрд░реНрднрд┐рдд рдХрд░рддрд╛ рд╣реИред

рд╕реНрд░реЛрдд рдлрд╝рд╛рдЗрд▓ рдЗрд╕ рддрд░рд╣ рджрд┐рдЦрддреА рд╣реИ:

name,group christian, religion jewish, religion muslim, religion ancient, time firsttemple, time secondtemple, time hasmonean, time hordus, time roma, time byzantee, time arab, time ottoman, time persian, time crusaider, time pray, type museum, type restaurant, type other, type 
      





name,group christian, religion jewish, religion muslim, religion ancient, time firsttemple, time secondtemple, time hasmonean, time hordus, time roma, time byzantee, time arab, time ottoman, time persian, time crusaider, time pray, type museum, type restaurant, type other, type





name,group christian, religion jewish, religion muslim, religion ancient, time firsttemple, time secondtemple, time hasmonean, time hordus, time roma, time byzantee, time arab, time ottoman, time persian, time crusaider, time pray, type museum, type restaurant, type other, type





name,group christian, religion jewish, religion muslim, religion ancient, time firsttemple, time secondtemple, time hasmonean, time hordus, time roma, time byzantee, time arab, time ottoman, time persian, time crusaider, time pray, type museum, type restaurant, type other, type









рдЗрд╕рдХреЗ рдЖрдзрд╛рд░ рдкрд░, рдореИрдВ рдЗрд╕ рдкреНрд░рдХрд╛рд░ рдХреА рдлрд╛рдЗрд▓ рдмрдирд╛рдирд╛ рдЪрд╛рд╣рддрд╛ рд╣реВрдВ:

package org.citymap;



import java.io.Serializable;



public class PointAttributes implements Serializable {



    

      private boolean muslim;



      public boolean isMuslim () {

         return muslim;

     }



     public void setMuslim ( boolean value ) {

          muslim = value;

     }

   ....



        public boolean equals ( Object o ) {

         if ( this == o ) return true ;

         if ( o == null || getClass () != o.getClass ()) return false ;



         PointAttributes that = ( PointAttributes ) o;



         

          if ( muslim != that.muslim ) return false ;

         

          if ( christian != that.christian ) return false ;

         

         ...

         





         return true ;

     }



     public int hashCode () {

         int result = 0 ;

         

           result = 31 * result + ( muslim ? 1 : 0 ) ;

         

           result = 31 * result + ( christian ? 1 : 0 ) ;

         

          ....

         

         return result;

     }





}







package org.citymap;



import java.io.Serializable;



public class PointAttributes implements Serializable {



    

      private boolean muslim;



      public boolean isMuslim () {

         return muslim;

     }



     public void setMuslim ( boolean value ) {

          muslim = value;

     }

   ....



        public boolean equals ( Object o ) {

         if ( this == o ) return true ;

         if ( o == null || getClass () != o.getClass ()) return false ;



         PointAttributes that = ( PointAttributes ) o;



         

          if ( muslim != that.muslim ) return false ;

         

          if ( christian != that.christian ) return false ;

         

         ...

         





         return true ;

     }



     public int hashCode () {

         int result = 0 ;

         

           result = 31 * result + ( muslim ? 1 : 0 ) ;

         

           result = 31 * result + ( christian ? 1 : 0 ) ;

         

          ....

         

         return result;

     }





}











Maven


рд╣рдо рдорд╛рд╡реЗрди рдореЗрдВ рдкреНрд░реЛрдЬреЗрдХреНрдЯ рдмрдирд╛рддреЗ рд╣реИрдВред рд╣рдо рдЗрд╕реЗ рдмрд╣реБ-рдореЙрдбреНрдпреВрд▓рд░ рдмрдирд╛рддреЗ рд╣реИрдВ, рдЕрдиреНрдпрдерд╛ рдЦреВрдмрд╕реВрд░рддреА рд╕реЗ рдХреЛрдб рдЙрддреНрдкрдиреНрди рдХрд░рдирд╛ рдЕрд╕рдВрднрд╡ рд╣реИред рдбреИрдб рдореЙрдбреНрдпреВрд▓ рдореЗрдВ, рд╕рдмрдореЙрдбреНрдпреВрд▓ рд╕реВрдЪреАрдмрджреНрдз рд╣реИрдВ:

<modules> <module>util</module> <module>codegen</module> <module>common</module> <module>persistency</module> <module>web</module> </modules> 
      





<modules> <module>util</module> <module>codegen</module> <module>common</module> <module>persistency</module> <module>web</module> </modules>





<modules> <module>util</module> <module>codegen</module> <module>common</module> <module>persistency</module> <module>web</module> </modules>





<modules> <module>util</module> <module>codegen</module> <module>common</module> <module>persistency</module> <module>web</module> </modules>









рдФрд░ рд╡рд╣ рдЦреБрдж "рдкреЛрдо" рдХреЗ рд░реВрдк рдореЗрдВ рдирд┐рд░реНрджрд┐рд╖реНрдЯ рд╣реИ



рдХреЛрдбрдЬреЗрди рдореЙрдбреНрдпреВрд▓ рдореЗрдВ рдПрдХ рдкреАрдврд╝реА рдХреЛрдб рд╣реЛрдЧрд╛, рдФрд░ рд╣рдо рд╕рд╛рдорд╛рдиреНрдп рдореЙрдбреНрдпреВрд▓ рдореЗрдВ рдЙрддреНрдкрдиреНрди рдХрд░реЗрдВрдЧреЗред

Org.citymap.CommonTemplatesRunner рд╡рд░реНрдЧ рд╡рд╛рд╕реНрддрд╡ рдореЗрдВ рдЙрддреНрдкрдиреНрди рдХрд░реЗрдЧрд╛

рдЗрд╕рд▓рд┐рдП, рд╕рд╛рдорд╛рдиреНрдп рдореЙрдбреНрдпреВрд▓ рдореЗрдВ рд╣рдо рдирд┐рдореНрдирд▓рд┐рдЦрд┐рдд рдХрд╛рд░реНрдп рдХрд░рддреЗ рд╣реИрдВ:

<build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <version>1.5</version> <executions> <execution> <id>add-source</id> <phase>generate-sources</phase> <goals> <goal>add-source</goal> </goals> <configuration> <sources> <source>target/gencode</source> </sources> </configuration> </execution> </executions> </plugin> <plugin> <artifactId>maven-antrun-plugin</artifactId> <version>1.6</version> <executions> <execution> <phase> generate-sources </phase> <configuration> <target> <java classname="org.citymap.CommonTemplatesRunner"> <classpath refid="maven.dependency.classpath" /> <arg value="${project.build.directory}"/> </java> </target> </configuration> <goals> <goal>run</goal> </goals> </execution> </executions> </plugin> </plugins> </build> 
      





<build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <version>1.5</version> <executions> <execution> <id>add-source</id> <phase>generate-sources</phase> <goals> <goal>add-source</goal> </goals> <configuration> <sources> <source>target/gencode</source> </sources> </configuration> </execution> </executions> </plugin> <plugin> <artifactId>maven-antrun-plugin</artifactId> <version>1.6</version> <executions> <execution> <phase> generate-sources </phase> <configuration> <target> <java classname="org.citymap.CommonTemplatesRunner"> <classpath refid="maven.dependency.classpath" /> <arg value="${project.build.directory}"/> </java> </target> </configuration> <goals> <goal>run</goal> </goals> </execution> </executions> </plugin> </plugins> </build>





<build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <version>1.5</version> <executions> <execution> <id>add-source</id> <phase>generate-sources</phase> <goals> <goal>add-source</goal> </goals> <configuration> <sources> <source>target/gencode</source> </sources> </configuration> </execution> </executions> </plugin> <plugin> <artifactId>maven-antrun-plugin</artifactId> <version>1.6</version> <executions> <execution> <phase> generate-sources </phase> <configuration> <target> <java classname="org.citymap.CommonTemplatesRunner"> <classpath refid="maven.dependency.classpath" /> <arg value="${project.build.directory}"/> </java> </target> </configuration> <goals> <goal>run</goal> </goals> </execution> </executions> </plugin> </plugins> </build>





<build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <version>1.5</version> <executions> <execution> <id>add-source</id> <phase>generate-sources</phase> <goals> <goal>add-source</goal> </goals> <configuration> <sources> <source>target/gencode</source> </sources> </configuration> </execution> </executions> </plugin> <plugin> <artifactId>maven-antrun-plugin</artifactId> <version>1.6</version> <executions> <execution> <phase> generate-sources </phase> <configuration> <target> <java classname="org.citymap.CommonTemplatesRunner"> <classpath refid="maven.dependency.classpath" /> <arg value="${project.build.directory}"/> </java> </target> </configuration> <goals> <goal>run</goal> </goals> </execution> </executions> </plugin> </plugins> </build>







рдЬреИрд╕рд╛ рдХрд┐ рдЖрдк рджреЗрдЦ рд╕рдХрддреЗ рд╣реИрдВ, рд╣рдордиреЗ рдПрдХ рдирд┐рд░реНрджреЗрд╢рд┐рдХрд╛ рдЬреЛрдбрд╝реА рд╣реИ рдЬрд┐рд╕рдореЗрдВ рд▓рдХреНрд╖реНрдп рдХреЗ рд╕рд╛рде рдЦрдЯрд╛рд╕ рд╣реИред рдпрд╣ рдЖрд╡рд╢реНрдпрдХ рд╣реИ рддрд╛рдХрд┐ рдЬрдм mvan рд╕рд╛рдл рд╣реЛ рддреЛ рдЙрддреНрдкрдиреНрди рдХреЛрдб рдорд┐рдЯ рдЬрд╛рдП (рд╕рднреА рд╕рдВрдХрд▓рди рдЙрддреНрдкрд╛рджреЛрдВ рдХреА рддрд░рд╣)ред рдФрд░ рдЕрдВрдЯрд╛ рдХреЗ рд╕рд╛рде, рд╣рдо рдЬреЗрдирд░реЗрдЯрд░-рд╕реЛрд░реНрд╕ рд╕реНрдЯреЗрдЬ рдкрд░ рдХреЛрдб рдЬрдирд░реЗрдЯрд░ рдЪрд▓рд╛рддреЗ рд╣реИрдВред рдПрдХ рддрд░реНрдХ рдХреЗ рд░реВрдк рдореЗрдВ, рд╣рдо рдЬрдирд░реЗрдЯрд░ рдХреЗ рдкрд╛рд╕ рдЬрд╛рддреЗ рд╣реИрдВ рдЬрд╣рд╛рдВ рдХреЛрдб рдЙрддреНрдкрдиреНрди рд╣реЛрддрд╛ рд╣реИ (рд╡рд░реНрддрдорд╛рди рдирд┐рд░реНрджреЗрд╢рд┐рдХрд╛ рдЗрд╕ рдмрд╛рдд рдкрд░ рдирд┐рд░реНрднрд░ рдХрд░рддреА рд╣реИ рдХрд┐ рдЗрд╕ рдкрд░рд┐рдпреЛрдЬрдирд╛ рдореЗрдВ рдбреИрдб рд▓реЙрдиреНрдЪ рдХрд┐рдпрд╛ рдЧрдпрд╛ рдерд╛ рдпрд╛ рдбреИрдб рдореЗрдВ)



jamon




рдкреАрдврд╝реА рдХреЗ рд▓рд┐рдП, рдореИрдВ рдЬреИрдорди рдлреНрд░реЗрдорд╡рд░реНрдХ рдХрд╛ рдЙрдкрдпреЛрдЧ рдХрд░рддрд╛ рд╣реВрдВ рдХреНрдпреЛрдВрдХрд┐ рдЗрд╕рдореЗрдВ рдорд╛рд╡реЗрди рдХреЗ рд▓рд┐рдП рдПрдХ рдмрдврд╝рд┐рдпрд╛ рдкреНрд▓рдЧрдЗрди рд╣реИред

рдореИрдВ рдЗрд╕реЗ рдЗрд╕ рддрд░рд╣ рдХреЗ рдХреЛрдбрдЬреЗрди рдкреНрд░реЛрдЬреЗрдХреНрдЯ рдореЗрдВ рдЬреЛрдбрд╝рддрд╛ рд╣реВрдВ:

<dependencies> <dependency> <groupId>org.jamon</groupId> <artifactId>jamon-runtime</artifactId> <version>2.3.1</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <version>1.5</version> <executions> <execution> <id>add-source</id> <phase>generate-sources</phase> <goals> <goal>add-source</goal> </goals> <configuration> <sources> <source>target/gencode</source> </sources> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.jamon</groupId> <artifactId>jamon-maven-plugin</artifactId> <version>2.3.2</version> <executions> <execution> <phase>generate-sources</phase> <goals> <goal>translate</goal> </goals> <configuration> <templateSourceDir>src/main/jamon</templateSourceDir> <templateOutputDir>target/gencode</templateOutputDir> </configuration> </execution> </executions> </plugin> </plugins> </build> 
      









<dependencies> <dependency> <groupId>org.jamon</groupId> <artifactId>jamon-runtime</artifactId> <version>2.3.1</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <version>1.5</version> <executions> <execution> <id>add-source</id> <phase>generate-sources</phase> <goals> <goal>add-source</goal> </goals> <configuration> <sources> <source>target/gencode</source> </sources> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.jamon</groupId> <artifactId>jamon-maven-plugin</artifactId> <version>2.3.2</version> <executions> <execution> <phase>generate-sources</phase> <goals> <goal>translate</goal> </goals> <configuration> <templateSourceDir>src/main/jamon</templateSourceDir> <templateOutputDir>target/gencode</templateOutputDir> </configuration> </execution> </executions> </plugin> </plugins> </build>









<dependencies> <dependency> <groupId>org.jamon</groupId> <artifactId>jamon-runtime</artifactId> <version>2.3.1</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <version>1.5</version> <executions> <execution> <id>add-source</id> <phase>generate-sources</phase> <goals> <goal>add-source</goal> </goals> <configuration> <sources> <source>target/gencode</source> </sources> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.jamon</groupId> <artifactId>jamon-maven-plugin</artifactId> <version>2.3.2</version> <executions> <execution> <phase>generate-sources</phase> <goals> <goal>translate</goal> </goals> <configuration> <templateSourceDir>src/main/jamon</templateSourceDir> <templateOutputDir>target/gencode</templateOutputDir> </configuration> </execution> </executions> </plugin> </plugins> </build>









<dependencies> <dependency> <groupId>org.jamon</groupId> <artifactId>jamon-runtime</artifactId> <version>2.3.1</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <version>1.5</version> <executions> <execution> <id>add-source</id> <phase>generate-sources</phase> <goals> <goal>add-source</goal> </goals> <configuration> <sources> <source>target/gencode</source> </sources> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.jamon</groupId> <artifactId>jamon-maven-plugin</artifactId> <version>2.3.2</version> <executions> <execution> <phase>generate-sources</phase> <goals> <goal>translate</goal> </goals> <configuration> <templateSourceDir>src/main/jamon</templateSourceDir> <templateOutputDir>target/gencode</templateOutputDir> </configuration> </execution> </executions> </plugin> </plugins> </build>









<dependencies> <dependency> <groupId>org.jamon</groupId> <artifactId>jamon-runtime</artifactId> <version>2.3.1</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <version>1.5</version> <executions> <execution> <id>add-source</id> <phase>generate-sources</phase> <goals> <goal>add-source</goal> </goals> <configuration> <sources> <source>target/gencode</source> </sources> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.jamon</groupId> <artifactId>jamon-maven-plugin</artifactId> <version>2.3.2</version> <executions> <execution> <phase>generate-sources</phase> <goals> <goal>translate</goal> </goals> <configuration> <templateSourceDir>src/main/jamon</templateSourceDir> <templateOutputDir>target/gencode</templateOutputDir> </configuration> </execution> </executions> </plugin> </plugins> </build>













рд╡рд╣ рд╕реНрд╡рдпрдВ рдХреЛрдб рдмрдирд╛рддрд╛ рд╣реИ - src / main / jamon рдореЗрдВ рдЯреЗрдореНрдкреНрд▓реЗрдЯ рдХреЗ рдЖрдзрд╛рд░ рдкрд░, рд╡рд╣ рдЙрди рдлрд╝рд╛рдЗрд▓реЛрдВ рдХреЛ рдЙрддреНрдкрдиреНрди рдХрд░реЗрдЧрд╛ рдЬреЛ рдЯрд╛рд░реНрдЧреЗрдЯ / рдЧреЗрдирдХреЛрдб рдореЗрдВ рдЯреЗрдореНрдкреНрд▓реЗрдЯ рджреНрд╡рд╛рд░рд╛ рдЙрддреНрдкрдиреНрди рдХрд░ рд╕рдХрддреЗ рд╣реИрдВред рдореБрдЭреЗ рдЙрдореНрдореАрдж рд╣реИ рдХрд┐ рдХреЛрдИ рднреА рдкреАрдврд╝реА рдХреЗ рдкреАрдврд╝реА рдХреЗ рд╕рд╛рде рднреНрд░рдорд┐рдд рди рд╣реЛ :)



рдореЗрд░рд╛ рдЯреЗрдореНрдкрд▓реЗрдЯ рдЗрд╕ рддрд░рд╣ рджрд┐рдЦрддрд╛ рд╣реИ:

<% import >

   java.util.*;

   org.citymap.*;

  org.apache.commons.lang.StringUtils;

</% import >

<%args>

   Map<String, PointProperty> pojos;

</%args>

package org.citymap;



import java.io.Serializable;



public class PointAttributes implements Serializable {



     <% for String name:pojos.keySet () %>

       private boolean <% name%>;



      public boolean is<% StringUtils.capitalize ( name ) %> () {

         return <% name%>;

     }



       public boolean get<% StringUtils.capitalize ( name ) %> () {

         return <% name%>;

     }



       public void set<% StringUtils.capitalize ( name ) %> ( boolean value ) {

          <% name%> = value;

     }





     </% for >



     public boolean equals ( Object o ) {

         if ( this == o ) return true ;

         if ( o == null || getClass () != o.getClass ()) return false ;



         PointAttributes that = ( PointAttributes ) o;



          <% for String name:pojos.keySet () %>

          if ( <% name%> != that.<% name%> ) return false ;

          </% for >





         return true ;

     }



     public int hashCode () {

         int result = 0 ;

          <% for String name:pojos.keySet () %>

           result = 31 * result + ( <% name%> ? 1 : 0 ) ;

          </% for >

         return result;

     }



}










рдФрд░ рдореИрдВ рдЗрд╕реЗ рдЗрд╕ рддрд░рд╣ рдХрд╣рддрд╛ рд╣реВрдВ:

public class CommonTemplatesRunner {

     public static void main ( String [] args ) throws IOException {

         String targetDir = args [ 0 ] ;

         final Reader csv = new InputStreamReader ( CodeGen. class .getClassLoader () .getResourceAsStream ( "properties.csv" )) ;

         final ObjectCSVMapper<PointProperty> csvProcessor = new ObjectCSVMapper<PointProperty> ( PointProperty.class, csv ) ;

         final Map<String, PointProperty> pojos = csvProcessor.getEntities () ;

         File dir = new File ( targetDir+ "/gencode/org/citymap" ) ;

         dir.mkdirs () ;

         FileWriter fw = new FileWriter ( new File ( dir, "PointAttributes.java" )) ;

         new PointAttributesTemplate () .render ( fw, pojos ) ;



     }

}










рдпрд╣ рдЗрд╕рдХреЗ рд▓рд┐рдП рдПрдХ рддрд░реНрдХ рдмрдирд╛рдиреЗ рдХреЗ рд▓рд┐рдП рдмрдирд╛ рд╣реБрдЖ рд╣реИ - рдпрд╣ рд╡рд╣реА рдорд╛рдирдЪрд┐рддреНрд░ <рд╕реНрдЯреНрд░рд┐рдВрдЧ, рдкреЙрдЗрдВрдЯрдкреНрд░реЙрдкрд░реНрдЯреА>ред

рдореИрдВ рд╢реБрд░реБрдЖрдд рд╕реЗ рд╕рдВрдХреЗрдд рджрд┐рдпрд╛ рдЧрдпрд╛ рд╣реИ рдХрд┐ рдЧреБрдгрд╕реНрдерд╛рди рд╕реЗ рдЯрд╛рдЗрдк рдкреНрд╡рд╛рдЗрдВрдЯрдкреНрд░реЙрдкрд░реНрдЯреА рдХреА рд╡рд╕реНрддреБрдУрдВ рдХрд╛ рдирд┐рд░реНрдорд╛рдг рдХрд░рддреЗ рд╣реБрдП, рд╕реБрдкрд░рд╕реНрдХреЙрд╡ рд▓рд╛рдЗрдмреНрд░реЗрд░реА рдХрд╛ рдЙрдкрдпреЛрдЧ рдХрд░ рд░рд╣рд╛ рд╣реВрдВред



рдЗрд╕рд▓рд┐рдП, рд╣рдо рдЗрд╕ рдкреНрд░рдХреНрд░рд┐рдпрд╛ рдХреЛ рджреЛрд╣рд░рд╛рддреЗ рд╣реИрдВ:



рдХреЛрдбрдЬрди рдореЙрдбреНрдпреВрд▓ рдореЗрдВ рдХреБрдЫ рднреА рд╢реБрд░реВ рдирд╣реАрдВ рд╣реЛрддрд╛ рд╣реИ, рдХреЗрд╡рд▓ рдПрдХ рдХреЛрдб рдЬрдирд░реЗрдЯрд░ рдмрдирд╛рдпрд╛ рдЬрд╛рддрд╛ рд╣реИред

PointAttributesTemplate.jamon рдЯреЗрдореНрдкрд▓реЗрдЯ рдХреЗ рдЖрдзрд╛рд░ рдкрд░, PointAttributesTemplate рд╡рд░реНрдЧ рдмрдирд╛рдпрд╛ рдЧрдпрд╛ рд╣реИ



рд╕рд╛рдорд╛рдиреНрдп рдореЙрдбреНрдпреВрд▓ рдореЗрдВ, CommonTemplatesRunner рд▓реЙрдиреНрдЪ рдХрд┐рдпрд╛ рдЧрдпрд╛ рд╣реИ:



1. properties.csv рд╕реЗ рд╣рдо рдЯрд╛рдЗрдкрдкреНрд░реЛрдкрд░реЗрдЯреА рдХреЗ рдкреНрд░рдХрд╛рд░ рдмрдирд╛рддреЗ рд╣реИрдВред

2. рдЙрдиреНрд╣реЗрдВ PointAttributesTemplate рдХреЗ рддрд░реНрдХ рдХреЗ рд░реВрдк рдореЗрдВ рдкрд╛рд╕ рдХрд░реЗрдВ рдФрд░ рдпрд╣ PointAttributes.java рдЙрддреНрдкрдиреНрди рдХрд░рддрд╛ рд╣реИ



рдУрд╣ред рд╡рд╣ рд╕рдм рд╣реИред

рдкреНрд░рд╢реНрди?




All Articles