net.nullschool.grains.generate.builder_impl.stg Maven / Gradle / Ivy
The newest version!
group BuilderImpl;
builder_property_impl(prop, grain, type) ::= <<
public () { return ; }
public ( ) {
this. = ;
return this;
}
>>
builder_getter_case(prop) ::= <<
case "": return ();
>>
builder_put_case(prop) ::= <<
case "":
$original = ();
(<\\>
$value == null ? : <\\>
.apply($value)()$value);
return $original;
>>
builder_impl(grain, type) ::= <<
/**
* Code generated implementation of .
*/
@(.class)
@(.class)
private static final class
extends
implements {
;}; separator="\n">
private final $extensions = new ();
public int size() { return + $extensions.size(); }
public iterator() {
return .chainMapIterators(new BasisIter($KEYS), .newMapIterator($extensions));
}
public get( $key) {
switch (()$key) {
default: return $extensions.get($key);
}
}
private put( $key, $value, boolean $dissoc) {
$original;
switch ($key) {
default:
return $dissoc ? $extensions.remove($key) : $extensions.put($key, $value);
}
}
public put( $key, $value) {
return put($key, $value, false);
}
public remove( $key) {
return put(()$key, null, true);
}
public build() {
return new (
, }; wrap>
.asSortedMap($extensions));
}
}
>>