Note that there are some explanatory texts on larger screens.

plurals
  1. PODagger and dependecies on provided classes
    primarykey
    data
    text
    <p>I am "Daggering" my Android app and I am facing a little problem that I don't know if it's me or framework's fault. If it's me I will be very disappointed by myself :)</p> <p>I have the following class to provide:</p> <pre><code>@Singleton public class XmlService { private final DataCommitter&lt;XmlWritable&gt; mXmlCommitter; private final DataReader&lt;XmlPushable&gt; mXmlReader; private final ConcurrentObjectMonitor mConcObjMonitor; @Inject public XmlService(DataCommitter&lt;XmlWritable&gt; xmlCommitter, DataReader&lt;XmlPushable&gt; xmlProvider, ConcurrentObjectMonitor concObjMonitor) { mXmlCommitter = xmlCommitter; mXmlReader = xmlProvider; mConcObjMonitor = concObjMonitor; } </code></pre> <p>With the following (among the others) class:</p> <pre><code>public class XmlDataReader implements DataReader&lt;XmlPushable&gt; { // No Singleton no more. // Eager Singleton (Therefore it should be made thread safe) //static XmlDataReader mInstance = new XmlDataReader(); [CUT] protected XmlPullParser mXmlPullParser; @Inject public void XmlDataRead(XmlPullParser xmlPullParser) { mXmlPullParser = xmlPullParser; } </code></pre> <p>This class is referred in my XmlServiceModule like this:</p> <pre><code>@Module(complete = true) public class XmlServiceModule { @Provides DataReader&lt;XmlPushable&gt; provideDataReader(XmlDataReader dataReader) { return dataReader; } } </code></pre> <p>Now, the question is, is it legal to Inject provided classes? Because I am getting an error with the @Inject on the XmlDataReader ctor: Cannot inject public void XmlDataRead(org.xmlpull.v1.XmlPullParser).</p> <hr> <p>EDIT: sorry guys, there was an error in my sample code, but I will leave it as is, because it can be useful in order to understand Christian's answer below.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload