org.fulib.templates.associations.pojo.stg Maven / Gradle / Ivy
import "java.dicts.stg"
import "javadoc.stg"
collectionImpl(role, other) ::= <%
\<>
%>
collectionItf(role, other) ::= <%
\<>
%>
roleType(role, other) ::= <%
%>
// --------------- Declarations ---------------
roleSignatures(role, other) ::= <<
propertyDecl: class//staticAttribute/PROPERTY_
roleAttrDecl: class//attribute/
getMethod: class//property/get()
initMethod: class//property/_init()
propertyMethod: class//property/Property()
withItem: class//property/with()
withArray: class//property/with(...)
withColl: class//property/with(Collection\ extends \>)
withoutItem: class//property/without()
withoutArray: class//property/without(...)
withoutColl: class//property/without(Collection\ extends \>)
setMethod: class//property/set()
>>
roleAttrDecl(role, other) ::= <<
private ;
>>
propertyDecl(role, other) ::= <<
/** @since */
public static final String PROPERTY_ = "";
>>
// --------------- Simple Accessors ---------------
getMethod(role, other) ::= <<
public get()
{
return this. != null ? import(java.util.Collections).unmodifiable(this.) : import(java.util.Collections).empty();
return this.;
}
>>
setMethod(role, other) ::= <<
public set( value)
{
if (this. == value)
{
return this;
}
final oldValue = this.;
if (this. != null)
{
this. = null;
oldValue.;
}
this. = value;
if (value != null)
{
value.;
}
this. = value;
return this;
}
>>
// --------------- With ---------------
withItem(role, other) ::= <<
public with( value)
{
if (this. == null)
{
this. = new ();
}
if (!this..contains(value))
{
this..add(value);
value.;
}
return this;
}
>>
withArray(role, other) ::= <<
public with(... value)
{
for (final item : value)
{
this.with(item);
}
return this;
}
>>
withColl(role, other) ::= <<
public with(import(java.util.Collection)\ extends \> value)
{
for (final item : value)
{
this.with(item);
}
return this;
}
>>
// --------------- Without ---------------
withoutItem(role, other) ::= <<
public without( value)
{
if (this. != null && this..remove(value))
{
value.;
}
if (this. != null)
{
this..remove(value);
}
return this;
}
>>
withoutArray(role, other) ::= <<
public without(... value)
{
for (final item : value)
{
this.without(item);
}
return this;
}
>>
withoutColl(role, other) ::= <<
public without(import(java.util.Collection)\ extends \> value)
{
for (final item : value)
{
this.without(item);
}
return this;
}
>>
// --------------- Helpers ---------------
withoutThis(other) ::= <%
without(this)
set(null)
%>
withThis(other) ::= <%
with(this)
set(this)
%>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy