Commit 920776e1 authored by Daniel Bluhm's avatar Daniel Bluhm

Fix generated files not being placed in packages

Signed-off-by: Daniel Bluhm's avatarDaniel Bluhm <bluhmdj@ornl.gov>
parent b5c87036
......@@ -61,9 +61,9 @@ public class ImplementationWriter
private static final String CLASS = "class";
/**
* Name of class to be generated.
* Fully qualified name of class to be generated.
*/
private String className;
private String fqn;
/**
* Constructor
......@@ -80,7 +80,11 @@ public class ImplementationWriter
@NonNull Fields fields, @NonNull Types types
) {
this.template = IMPL_TEMPLATE;
this.className = className;
if (packageName != null) {
this.fqn = String.format("%s.%s", packageName, className);
} else {
this.fqn = className;
}
this.context.put(PACKAGE, packageName);
this.context.put(INTERFACE, interfaceName);
this.context.put(CLASS, className);
......@@ -90,6 +94,6 @@ public class ImplementationWriter
@Override
public Writer openWriter(Filer filer) throws IOException {
return filer.createSourceFile(className).openWriter();
return filer.createSourceFile(fqn).openWriter();
}
}
......@@ -59,9 +59,9 @@ public class InterfaceWriter
private static final String TYPES = "types";
/**
* Name of generated interface;
* Fully qualified name of generated interface;
*/
private String interfaceName;
private String fqn;
/**
......@@ -78,7 +78,11 @@ public class InterfaceWriter
@NonNull Types types
) {
this.template = TEMPLATE;
this.interfaceName = interfaceName;
if (packageName != null) {
this.fqn = String.format("%s.%s", packageName, interfaceName);
} else {
this.fqn = interfaceName;
}
context.put(PACKAGE, packageName);
context.put(INTERFACE, interfaceName);
context.put(FIELDS, fields);
......@@ -87,6 +91,6 @@ public class InterfaceWriter
@Override
public Writer openWriter(Filer filer) throws IOException {
return filer.createSourceFile(interfaceName).openWriter();
return filer.createSourceFile(fqn).openWriter();
}
}
......@@ -76,9 +76,9 @@ public class PersistenceHandlerWriter
private static final String TEMPLATE = "templates/PersistenceHandler.vm";
/**
* Name of generated class.
* Fully qualified name of the class for file output.
*/
private String className;
private String fqn;
/**
* Constructor
*
......@@ -99,7 +99,11 @@ public class PersistenceHandlerWriter
) {
super();
this.template = TEMPLATE;
this.className = className;
if (packageName != null) {
this.fqn = String.format("%s.%s", packageName, className);
} else {
this.fqn = className;
}
this.context.put(PACKAGE, packageName);
this.context.put(ELEMENT_INTERFACE, elementInterface);
this.context.put(CLASS, className);
......@@ -112,6 +116,6 @@ public class PersistenceHandlerWriter
@Override
public Writer openWriter(Filer filer) throws IOException {
return filer.createSourceFile(className).openWriter();
return filer.createSourceFile(fqn).openWriter();
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment