Hi George,

It sounds like your Parser interface is located in one of Tapestrys
blessed packages (pages, components, mixins etc.)

/Joakim


On Tue, Aug 21, 2012 at 5:27 AM, George Christman
<gchrist...@cardaddy.com> wrote:
> Hello, in my DMSServiceLocator.class, I have a method called getParser() with
> a return type called Parser.  I'm trying to return a service called
> AutoMateParser with an Impl that extends Parser, however I'm' getting a
> compiling error saying Parser is required, found AutoMateParser. When I
> return new AutoMateServiceImpl() rather than my service interface, I receive
> no compiling errors. It doesn't appear my getParser() method realizes
> autoMateParser is of the same type. I tried casting AutoMateParser with
> Parser, "return (Parser) autoMateParser;" which resolved compiling errors,
> but received a cast exception. I'm wondering if anybody knows how to do
> this. Thanks in advance.
>
> below is a sample of my code.
>
> AppModule
>
> public static void bind(ServiceBinder binder) {
>         binder.bind(AutoMateParser.class, AutoMateParserImpl.class);
> }
>
> public class DMSServiceLocator {
>
>     @Inject
>     private AutoMateParser autoMateParser;
>
>     public Parser getParser() {
>         if(automate) {
>         return autoMateParser();
>         } else {
>            //Different data scrubber, but also extends Parser
>            return homenetParser();
>         }
>     }
>
> }
>
> public class AutoMateParserImpl extends Parser implements AutoMateParser {
>     protected Vehicle parseCar(String vehicleData) {
>         //some data scrubbing code
>     }
> }
>
> public class Parser {
>     //some csv line reader code
>     protected abstract Vehicle parseCar(String carData);
> }
>
>
>
>
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/Compiling-error-returning-service-interface-in-service-locator-method-tp5715645.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to