I'm looking through the Flexmojos code to understand the GraniteDS
generator, and I noticed that there are 2 GraniteDS generators one for
1.1.0, and one for 2.0.0.

At a glance it appears that the 1.1.0 usesd the "shaded110" package
name while the 2.0.0 doesn't, also it looks like there is a
GeneratorFactory that allows you to retrieve a GraniteDS generator
based on a "hint" which is defined in each of the 1.1.0 and 2.0.0
GraniteDS generators:

@Component( role =
org.sonatype.flexmojos.generator.api.Generator.class, hint =
"graniteds2" )
public final class GraniteDsGenerator


@Component( role =
org.sonatype.flexmojos.generator.api.Generator.class, hint =
"graniteds1" )
public final class GraniteDsGenerator


@Component( role = GeneratorFactory.class )
public class GeneratorFactory
{

    @Requirement( role = Generator.class )
    private Map<String, Generator> generators;

    public Generator getGenerator( String hint )
    {
        return generators.get( hint );
    }

}


It appears that the <generatorToUse> parameter of the
flexmojos:generator configuration allows you to change that to use
GraniteDS 2.0.0 ("graniteds1" default, and "graniteds2" as another
option):

               <executions>
                    <execution>
                        <goals>
                            <goal>optimize</goal> <!-- Optimized RSL
generation -->
                            <goal>generate</goal> <!-- ActionScript
POJOs generation based on Java POJOs -->
                        </goals>
                        <configuration>
                                <generatorToUse>graniteds2</generatorToUse>
                            <includeJavaClasses>
                                <includeClass>com.webwars.*.Message*</
includeClass>
                            </includeJavaClasses>

                            <beanTemplate>
                                <template>${basedir}/src-generation/
template/beanBase.gsp</template>
                                <template>${basedir}/src-generation/
template/bean.gsp</template>
                            </beanTemplate>
                            <outputDirectory>${project.basedir}/src-
network</outputDirectory>
                        </configuration>
                    </execution>
                </executions>

This properly uses the org.granite.collections.IMap.

The generator plugin documentation could be improved to include how to
use graniteds1 or graniteds2. Currently it only lists that graniteds1
is the default and not what the other possible options are.


On Dec 7, 5:45 pm, Doug Daniels <[email protected]> wrote:
> I'm not sure how I can force the Map of
> shaded110.org.granite.collection.IMap to anything else. I'll look into
> that. Is there any way I can include the
> shaded110.org.granite.collections.IMap being used explicitly in
> flexmojos (I assume it's being automatically built when I run through
> Maven, but not when I run through Flexbuilder).
>
> In the bean.gsp Granite templates (that use Groovy and Velocity), I
> believe the type is exposed in the:
>
> ${jImport.as3Type.packageName}, and is automatically built.
>
> I can't find any options in the generator mojo except for the
> "extraOptions" but I'm unsure what options Granite DS generator
> exposes (does anyone else on the flexmojos list have more details on
> GraniteDS generation?).
>
> http://sites.sonatype.org/flexmojos/flexmojos-maven-plugin/generate-m...
>
> On Dec 7, 4:34 pm, velo <[email protected]> wrote:
>
> > Ow crap.... that is a real bug on flexmojos =/
>
> > To keep compatibility with granite 1.0 and 2.0 flexmojos do move
> > granite code to shaded110 package.
>
> > I believe it is possible to workaround it, but I don't know granite
> > that well to tell you how.  I assume you can force Map to be mapped to
> > org.granite.collection.IMap....
>
> > VELO
>
> > On Dec 7, 7:48 pm, Doug Daniels <[email protected]> wrote:
>
> > > I'm trying to use the Flexmojos AS code generation tools, and I have a
> > > Java class with a Map<K,V> field that when I run the code generation
> > > it generates an Actionscript class with an:
> > >    shaded110.org.granite.collections.IMap
>
> > > Typed field, I'm trying to figure out what SWC or library this
> > > shaded110.org.granite.collections.IMap exists in because I'm managing
> > > a FlexBuilder environment alongside the Flexmojos maven build (meaning
> > > I have a separate lib/ folder containing any SWC's that are needed.
>
> > > I've looked at the latest Granite DS build and it seems like there is
> > > no mention of the  shaded110.org.granite.collections.IMap. Although
> > > there does exist a org.granite.collections.IMap. What version of
> > > GraniteDS does Flexmojos use and is that configurable?

-- 
You received this message because you are subscribed to the Google
Groups "Flex Mojos" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/flex-mojos?hl=en?hl=en

http://blog.flex-mojos.info/

Reply via email to