hexMachina icon indicating copy to clipboard operation
hexMachina copied to clipboard

Allow instances in DSL to be mapped under different name

Open st3veV opened this issue 9 years ago • 0 comments

Allow overriding mapping ids for instances - for example:

<!-- I know I'll have just one instance so mapping it with id is redundant information so I'd like to get rid of it -->
<instance id="myInstance" map-id="" type="some.package.SomeType" map-type="some.package.ISomeType" />

<!-- But I know I can't remove it in case of 'id' because I still want to work with it inside the DSL and pass it around -->
<instance id="myOtherInstance" map-id="" type="some.package.SomeOtherType" map-type="some.package.ISomeOtherType">
    <argument ref="myInstance" />
</instance>

so then I can have a commands cleaner when working only with singletons - like this:

class MyCommand extends BasicCommand {

    //@Inject("myInstance") - I don't have to do this when I map the instance with empty map-id
    @Inject
    public var instance:ISomeType;

}

st3veV avatar Nov 11 '16 07:11 st3veV