In the following code, two constructors are generated for Y. It might be
necessary to inject different code using 'after constructor' or 'before
constructor'. There us currently no way to specify this.
class X{
1 -- * Y;
* -- 1 Z;
Integer i;
}
class Y{
1 -- 1 Z;
String name;
}
class Z{
}
The generated code of Y class includes two constructors:
public Y(String aName, Z aZ, X aX)
{
name = aName;
if (aZ == null || aZ.getY() != null)
{
throw new RuntimeException("Unable to create Y due to aZ");
}
z = aZ;
boolean didAddX = setX(aX);
if (!didAddX)
{
throw new RuntimeException("Unable to create y due to x");
}
}
public Y(String aName, X aX)
{
name = aName;
z = new Z(this);
boolean didAddX = setX(aX);
if (!didAddX)
{
throw new RuntimeException("Unable to create y due to x");
}
}
If we want to inject specific code into one of these constructors, let's say in
public Y(String aName, X aX), the same code will be injected into the other
constructor. Sometimes, we do not want to do injection into all constructors
because it may lead to duplication and other issues.
Please use tags such as 'stateMachines', 'Tracing', etc. to help us
categorize this request.
Original issue reported on code.google.com by TimothyCLethbridge on 6 Feb 2014 at 8:35
Original issue reported on code.google.com by
TimothyCLethbridge
on 6 Feb 2014 at 8:35