Reputation: 187
I created a custom maven archetype that has a ClassName.java class that contains a property ${propertyName} with its getter and setter.
package ${package};
// Start of user code (import)
// End of user code (import)
/**
* Block ${BlockName}
*/
public class ${BlockName} extends Block<${BlockName}DTO> {
/**
* Item ${itemName}
*/
private final Item<${itemType}> ${itemName} = new Item.Control<${itemType}>(this, "${itemName}") {
};
// Getter and Setter
}
What I want to achieve when creating a new project from this custom archetype is giving multiple class names (for example: Car, Bicycle ...), and give also multiple properties for each class (for example: Car.door, Car.window, Bicycle.wheel ...), and have as output the classes created from the template ClassName.java as Car.java and Bicycle.java, but in each class have the ${itemName}, getters and setters replaced with the properties given.
Upvotes: 0
Views: 488
Reputation: 35843
You can probably code a groovy script for that and run it post-generation
Is there a way to post-process project generated from archetype?
On the other hand: Generating getters/setters is standard IDE functionality (e.g. easily done in Eclipse), so I am not sure whether this is really useful in an archetype.
Upvotes: 1