You have to cast the class to the type you want. If you don't know the type ahead of time, you can call javaSource.getSourceType() then do the cast to the appropriate JavaClass, JavaAnnotation, JavaEnum, or JavaInterface.

~Lincoln

On Thu, Oct 27, 2011 at 6:19 PM, Richard Kennard <richard@kennardconsulting.com> wrote:
Lincoln,

Yeah, I think that's pretty much it, thanks!

How do I get from there to an actual org.jboss.forge.parser.java.JavaClass?

Richard.

On 28/10/2011 9:12 AM, Lincoln Baxter, III wrote:
> Hey Richard,
>
> You can use JavaSourceFacet.getJavaResource("foo.Bar").getJavaSource();
>
> Is that what you were looking for?
>
> ~Lincoln
>
> On Thu, Oct 27, 2011 at 6:26 AM, Richard Kennard <richard@kennardconsulting.com <mailto:richard@kennardconsulting.com>> wrote:
>
>     Hi guys,
>
>     I was hoping there was a way in Forge to lookup the classes in the project being 'forged'. For example, in regular Java I can do...
>
>        Class.forName( "foo.Bar" );
>
>     So I was hoping for a Forge equivalent like...
>
>        org.jboss.forge.parser.java.JavaClass.forName( "foo.Bar" )
>
>     ...that would return me an org.jboss.forge.parser.java.JavaClass representing Bar. Note that Bar is a class in the project being forged. It is not an
>     actual Class in the VM.
>
>     Regards,
>
>     Richard.
>     _______________________________________________
>     forge-dev mailing list
>     forge-dev@lists.jboss.org <mailto:forge-dev@lists.jboss.org>
>     https://lists.jboss.org/mailman/listinfo/forge-dev
>
>
>
>
> --
> Lincoln Baxter, III
> http://ocpsoft.com
> http://scrumshark.com
> "Keep it Simple"
>
>
> _______________________________________________
> forge-dev mailing list
> forge-dev@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/forge-dev

_______________________________________________
forge-dev mailing list
forge-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/forge-dev



--
Lincoln Baxter, III
http://ocpsoft.com
http://scrumshark.com
"Keep it Simple"