mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-11 18:29:05 +01:00
Guice stuff.
This commit is contained in:
@@ -27,6 +27,8 @@ import net.sf.briar.api.serial.Raw;
|
||||
import net.sf.briar.api.serial.Reader;
|
||||
import net.sf.briar.api.serial.ReaderFactory;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
/** A bundle that deserialises its contents on demand using a reader. */
|
||||
class BundleReaderImpl implements BundleReader {
|
||||
|
||||
@@ -42,6 +44,7 @@ class BundleReaderImpl implements BundleReader {
|
||||
private final BatchFactory batchFactory;
|
||||
private State state = State.START;
|
||||
|
||||
@Inject
|
||||
BundleReaderImpl(InputStream in, ReaderFactory readerFactory,
|
||||
PublicKey publicKey, Signature signature,
|
||||
MessageDigest messageDigest, MessageParser messageParser,
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package net.sf.briar.protocol;
|
||||
|
||||
import net.sf.briar.api.protocol.Message;
|
||||
import net.sf.briar.api.protocol.BundleReader;
|
||||
import net.sf.briar.api.protocol.BundleWriter;
|
||||
import net.sf.briar.api.protocol.MessageEncoder;
|
||||
import net.sf.briar.api.protocol.MessageParser;
|
||||
|
||||
import com.google.inject.AbstractModule;
|
||||
|
||||
@@ -8,6 +11,11 @@ public class ProtocolModule extends AbstractModule {
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(Message.class).to(MessageImpl.class);
|
||||
bind(BatchFactory.class).to(BatchFactoryImpl.class);
|
||||
bind(BundleReader.class).to(BundleReaderImpl.class);
|
||||
bind(BundleWriter.class).to(BundleWriterImpl.class);
|
||||
bind(HeaderFactory.class).to(HeaderFactoryImpl.class);
|
||||
bind(MessageEncoder.class).to(MessageEncoderImpl.class);
|
||||
bind(MessageParser.class).to(MessageParserImpl.class);
|
||||
}
|
||||
}
|
||||
|
||||
15
components/net/sf/briar/serial/SerialModule.java
Normal file
15
components/net/sf/briar/serial/SerialModule.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package net.sf.briar.serial;
|
||||
|
||||
import net.sf.briar.api.serial.ReaderFactory;
|
||||
import net.sf.briar.api.serial.WriterFactory;
|
||||
|
||||
import com.google.inject.AbstractModule;
|
||||
|
||||
public class SerialModule extends AbstractModule {
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(ReaderFactory.class).to(ReaderFactoryImpl.class);
|
||||
bind(WriterFactory.class).to(WriterFactoryImpl.class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user