Code Generator for Eclipse Code
Brought to you by:
hotzst
changed | /examples/plugin.xml |
added | /examples/src/ch/sahits/codegen/example/CountryChanger.java |
--- a/examples/plugin.xml +++ b/examples/plugin.xml @@ -7,5 +7,11 @@ class="ch.sahits.codegen.xml.XMLParserWithoutDB"> </xmlparser> </extension> + <extension + point="ch.sahits.codegen.sql.manipulation"> + <manipulationClass + class="ch.sahits.codegen.example.CountryChanger"> + </manipulationClass> + </extension> </plugin>
--- a +++ b/examples/src/ch/sahits/codegen/example/CountryChanger.java @@ -0,0 +1,43 @@ +package ch.sahits.codegen.example; + +import ch.sahits.codegen.sql.generator.BasicDataManipulator; +import ch.sahits.codegen.sql.generator.IFieldValueConverter; +import ch.sahits.codegen.sql.model.ICurrentRecordSet; +/** + * This is an example class that demonstrates the extension point + * ch.sahits.codegen.sql.manipulation using the Derby example + * databse Country + * @author Andi Hotz + * @since 1.1.0 + */ +public class CountryChanger extends BasicDataManipulator { + /** This constructor must be supplied */ + public CountryChanger(ICurrentRecordSet record) { + super(record); + } + /** + * Register the fields to manipulate + */ + @Override + public void init() { + registerConverter("COUNTRY", new IFieldValueConverter(){ + public String convert(Object input) { + return ((String)input).toLowerCase()+" changed to lower case"; + } + }); + registerConverter("COUNTRY_ISO_CODE ", new IFieldValueConverter(){ + public String convert(Object input) { + return ((String)input).toLowerCase(); + } + }); + registerConverter("REGION ", new IFieldValueConverter(){ + public String convert(Object input) { + return ((String)input).replace(' ', '_'); + } + }); + } + + + + +}