net.nullschool.grains.generate.grain_impl.stg Maven / Gradle / Ivy
The newest version!
group ConstImpl;
grain_property_impl(prop, grain, type) ::= <<
public () { return ; }
public ( ) {
return new (
, }; wrap>
$extensions);
}
>>
grain_getter_case(prop) ::= <<
case "": return ();
>>
grain_with_case(prop) ::= <<
case "": return (<\\>
$value == null ? : <\\>
.apply($value)()$value);
>>
grain_impl(grain, type) ::= <<
/**
* Code generated implementation of .
*/
@(.class)
@(.class)
private static final class
extends
implements ,,!> {
;}; separator="\n">
private final $extensions;
private (
, }; wrap>
$extensions) {
= ;}; separator="\n">
this.$extensions = $extensions;
}
public int size() { return + $extensions.size(); }
public iterator() {
return .chainMapIterators(new BasisIter($KEYS), $extensions.iterator());
}
public get( $key) {
switch (()$key) {
default: return $extensions.get($key);
}
}
private with( $key, $value, boolean $dissoc) {
switch ($key) {
}
$newExtensions =
$dissoc ? $extensions.without($key) : $extensions.with($key, $value);
if ($newExtensions == $extensions) {
return this;
}
return new (
, }; wrap>
$newExtensions);
}
public with( $key, $value) {
return with($key, $value, false);
}
public withAll( $map) {
return $map.isEmpty() ? this : .putAll(newBuilder(), $map).build();
}
public without( $key) {
return with(()$key, null, true);
}
public withoutAll( $keys) {
return $keys.isEmpty() ? this : .removeAll(newBuilder(), $keys).build();
}
public newBuilder() {
$builder = new ();
= this.;}; separator="\n">
$builder.$extensions.putAll(this.$extensions);
return $builder;
}
public extensions() {
return $extensions;
}
private writeReplace() { return new ().setPayload(this); }
private void readObject( in) throws {
throw new ("proxy expected");
}
}
>>