Hi Rudy,
You're right: We don't yet have nested class support, and the top-level
class is what should be returned, so I'm a bit surprised that this is what
is happening. Do you know if this problem is caused by the JavaParser API
or by the forge Resources API?
Care to file an issue? Thanks!
https://issues.jboss.org/browse/FORGE
~Lincoln
On Tue, Jan 31, 2012 at 10:06 AM, Rudy De Busscher <rdebusscher(a)gmail.com>wrote:
Hi All,
Seems that nested classes aren't handled correctly by forge.
If you have a java source file like this
public class CustomProjectStageHolder implements ProjectStageHolder
{
public static final class CustomProjectStage extends ProjectStage
{
private static final long serialVersionUID = 1029094387976167179L;
}
public static final CustomProjectStage CustomProjectStage = new
CustomProjectStage();
}
And consider then following statements:
JavaResource javaResource = factory.getResourceFrom(new
File("/path/to/file/RudyHolder.java")).reify(JavaResource.class);
javaResource.getJavaSource().getQualifiedName();
The javaResource is indeed pointing to the file, you can verify with
javaResource.getFullyQualifiedName()
But if you ask for the javaSource, as in the second statement, you get the nested class,
CustomProjectStage in our example.
Relation between JavaResource and JavaSource indicates that multiple classes per java
file wasn't considered. And isn't common for entity classes etc that have to be
handled by Forge.
So when there are no plans in supporting this in Forge, isn't it logic to return the
main class, instead of the nested class?
Thx for the clarification.
Regards
Rudy
--
Rudy De Busscher
http://www.c4j.be
_______________________________________________
forge-users mailing list
forge-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/forge-users
--
Lincoln Baxter, III
http://ocpsoft.com
http://scrumshark.com
"Keep it Simple"