templates.associations.stg Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fulib Show documentation
Show all versions of fulib Show documentation
Fulib is a Java-code generating library.
emptySetDecl(roleName,otherClassName,roleType) ::=
<<
public static final EMPTY_ = new ()
{ @Override public boolean add( value){ throw new UnsupportedOperationException("No direct add! Use xy.with(obj)"); }};
>>
roleAttrDecl(roleName,roleType,toMany,otherClassName) ::=
<<
private = null;
>>
propertyDecl(roleName) ::=
<< public static final String PROPERTY_ = "";>>
getMethod(roleName,toMany,otherClassName,roleType) ::=
<<
public get()
{
if (this. == null)
{
return EMPTY_;
}
return this.;
return this.;
}
>>
setMethod(roleName,toMany,myClassName,otherClassName,otherRoleName,otherToMany,roleType) ::=
<<
public with(Object... value)
{
if(value==null) return this;
for (Object item : value)
{
if (item == null) continue;
if (item instanceof java.util.Collection)
{
for (Object i : (java.util.Collection) item)
{
this.with(i);
}
}
else if (item instanceof )
{
if (this. == null)
{
this. = new ();
}
if ( ! this..contains(item))
{
this..add(()item);
(()item).(this);
firePropertyChange("", null, item);
}
}
else throw new IllegalArgumentException();
}
return this;
}
public set( value)
{
if (this. != value)
{
oldValue = this.;
if (this. != null)
{
this. = null;
oldValue.;
}
this. = value;
if (value != null)
{
value.(this);
}
firePropertyChange("", oldValue, value);
}
return this;
}
>>
withoutMethod(roleName,toMany,myClassName,otherClassName,otherRoleName,otherToMany,roleType) ::=
<<
public without(Object... value)
{
if (this. == null || value==null) return this;
for (Object item : value)
{
if (item == null) continue;
if (item instanceof java.util.Collection)
{
for (Object i : (java.util.Collection) item)
{
this.without(i);
}
}
else if (item instanceof )
{
if (this..contains(item))
{
this..remove(()item);
(()item).;
firePropertyChange("", item, null);
}
}
}
return this;
}
>>
withoutThis(toMany,otherRoleName) ::=
<%
without(this)
set(null)
%>
prefix(toMany) ::=
<%
with
set
%>
cap(n) ::=
<%
%>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy