ojobuilder.2.3.4.source-code.Builder-template.stg Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pojobuilder Show documentation
Show all versions of pojobuilder Show documentation
The PojoBuilder Generator is a Java 6 compliant annotation processor that generates a fluent builder class for POJOs (Plain Old Java Object)
delimiters "<", ">"
builderClass(model) ::= <<
package ;
/**
* The {@link } is a Builder for {@link } objects.
*
* \
* This class has been generated.
* Please DO NOT MODIFIY this file
* since it will be overwritten
* by the PojoBuilder generator.
* \
*/
@Generated("PojoBuilder")
public abstract class extends implements Cloneable {
protected self;
/**
* Creates a new {@link }.
*/
public () {
self = ()this;
}
/**
* Returns a clone of this builder.
* @return the clone
*/
@Override
public Object clone() {
try {
result = ()super.clone();
result.self = result;
return result;
} catch (CloneNotSupportedException e) {
throw new InternalError(e.getMessage());
}
}
/**
* Returns a clone of this builder.
* @return the clone
*/
@SuppressWarnings("unchecked")
public but() {
return ()clone();
}
/**
* Creates a new {@link } based on this builder's settings.
* @return the created
*/
public build() throws {
return result;
}
/**
* Copies properties from \original\ into the builder
* @param original the object to be copied
* @return this builder
*/
public copy( original) {
return self;
}
}
>>
importStatement(importName) ::= <<
import ;
>>
propertyVar(property) ::= <<
protected value$; // mandatory constructor parameter
protected boolean isSet$ = false;
>>
propertyWith(property) ::= <<
/**
* Sets the default value for the {@link #} property.
* @param value the default value
* @return this builder
*/
public with( value) {
this.value$ = value;
this.isSet$ = true;
return self;
}
>>
propertySetterCall(property) ::= <<
if ( this.isSet$) {
result.( this.value$);
}
>>
propertyAssignment(property) ::= <<
if ( this.isSet$) {
result. = this.value$;
}
>>
productContructorCall(model) ::= <<
result = .( );
result = new ( );
>>
constructorArgument(property) ::= < >>
throwsElements(exceptionType) ::= << >>
copyPropertyByGetter(property) ::= <(original.());
>>
copyPropertyByFieldAccess(property) ::= <(original.);
>>