// Add the property for the encoder instance...
jClass.getProperties().add(new JNamedType(new JType(decoderClass), encoderName));
// Create the encoder in the constructor...
JMethod defaultConstructor = jClass.getDefaultConstructor();
defaultConstructor.appendToBody("\n " + encoderName + " = new " + decoderClass.getSimpleName() + "();");
// Configure the encoder in the constructor (if needed)....
if(dataDecoder instanceof Configurable) {
Properties configuration = ((Configurable) dataDecoder).getConfiguration();
if(configuration != null) {
Set<Map.Entry<Object, Object>> encoderConfig = configuration.entrySet();
String encoderPropertiesName = encoderName + "Properties";
jClass.getRawImports().add(new JType(Properties.class));
defaultConstructor.appendToBody("\n Properties " + encoderPropertiesName + " = new Properties();");
for(Map.Entry<Object, Object> entry : encoderConfig) {
defaultConstructor.appendToBody("\n " + encoderPropertiesName + ".setProperty(\"" + entry.getKey() + "\", \"" + entry.getValue() + "\");");
}
defaultConstructor.appendToBody("\n " + encoderName + ".setConfiguration(" + encoderPropertiesName + ");");
}
}
// Add the encoder encode instruction to te write method...
if (decoderClass == DABigDecimalDecoder.class){