Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Generated Classes for Dagger for comparison between old and new generation code.
//Code generated by dagger-compiler.
package coffee;
import dagger.internal.Binding;
import dagger.internal.Linker;
import dagger.MembersInjector;
import java.util.Set;
/**
* A {@code Binder<AbstractPump>} implementation which satisfies
* Dagger's infrastructure requirements including:
*
* Owning the dependency links between {@code AbstractPump} and its
* dependencies.
*
* Being a {@code MembersInjector<AbstractPump>} and handling injection
* of annotated fields.
*/
final class AbstractPump$InjectAdapter extends Binding<AbstractPump>
implements MembersInjector<AbstractPump> {
private Binding<Set<String>> field_labels;
public AbstractPump$InjectAdapter() {
super(null, "members/coffee.AbstractPump", NOT_A_SINGLETON, AbstractPump.class);
}
/**
* Used internally to link bindings/providers together at run time
* according to their dependency graph.
*/
@Override
public void attach(Linker linker) {
field_labels = (Binding<Set<String>>) linker.requestBinding("@javax.inject.Named(value=Foo)/java.util.Set<java.lang.String>", AbstractPump.class);
}
/**
* Used internally obtain dependency information, such as for cyclical
* graph detection.
*/
@Override
public void getDependencies(Set<Binding<?>> getBindings, Set<Binding<?>> injectMembersBindings) {
injectMembersBindings.add(field_labels);
}
/**
* Injects any {@code @Inject} annotated fields in the given instance,
* satisfying the contract for {@code Provider<AbstractPump>}.
*/
@Override
public void injectMembers(AbstractPump object) {
object.labels = field_labels.get();
}
}
//Code generated by dagger-compiler.
package coffee;
import dagger.internal.Binding;
import dagger.internal.Linker;
import dagger.MembersInjector;
import java.util.Set;
import javax.inject.Provider;
/**
* A {@code Binder<CoffeeApp>} implementation which satisfies
* Dagger's infrastructure requirements including:
*
* Owning the dependency links between {@code CoffeeApp} and its
* dependencies.
*
* Being a {@code Provider<CoffeeApp>} and handling creation and
* preparation of object instances.
*
* Being a {@code MembersInjector<CoffeeApp>} and handling injection
* of annotated fields.
*/
final class CoffeeApp$InjectAdapter extends Binding<CoffeeApp>
implements Provider<CoffeeApp>, MembersInjector<CoffeeApp> {
private Binding<CoffeeMaker> field_coffeeMaker;
public CoffeeApp$InjectAdapter() {
super("coffee.CoffeeApp", "members/coffee.CoffeeApp", NOT_A_SINGLETON, CoffeeApp.class);
}
/**
* Used internally to link bindings/providers together at run time
* according to their dependency graph.
*/
@Override
public void attach(Linker linker) {
field_coffeeMaker = (Binding<CoffeeMaker>) linker.requestBinding("coffee.CoffeeMaker", CoffeeApp.class);
}
/**
* Used internally obtain dependency information, such as for cyclical
* graph detection.
*/
@Override
public void getDependencies(Set<Binding<?>> getBindings, Set<Binding<?>> injectMembersBindings) {
injectMembersBindings.add(field_coffeeMaker);
}
/**
* Returns the fully provisioned instance satisfying the contract for
* {@code Provider<CoffeeApp>}.
*/
@Override
public CoffeeApp get() {
CoffeeApp result = new CoffeeApp();
injectMembers(result);
return result;
}
/**
* Injects any {@code @Inject} annotated fields in the given instance,
* satisfying the contract for {@code Provider<CoffeeApp>}.
*/
@Override
public void injectMembers(CoffeeApp object) {
object.coffeeMaker = field_coffeeMaker.get();
}
}
//Code generated by dagger-compiler.
package coffee;
import dagger.internal.Binding;
import dagger.internal.ModuleAdapter;
import dagger.internal.SetBinding;
import java.util.Map;
public final class DripCoffeeModule$ModuleAdapter extends ModuleAdapter<DripCoffeeModule> {
private static final String[] ENTRY_POINTS = { "members/coffee.CoffeeApp", };
private static final Class<?>[] STATIC_INJECTIONS = { };
private static final Class<?>[] INCLUDES = { coffee.PumpModule.class, };
public DripCoffeeModule$ModuleAdapter() {
super(ENTRY_POINTS, STATIC_INJECTIONS, false /*overrides*/, INCLUDES, true /*complete*/);
}
/**
* Used internally obtain dependency information, such as for cyclical
* graph detection.
*/
@Override
public void getBindings(Map<String, Binding<?>> map) {
SetBinding.add(map, "@javax.inject.Named(value=Foo)/java.util.Set<java.lang.String>", new AddStringProvidesAdapter(module));
}
@Override
protected DripCoffeeModule newModule() {
return new coffee.DripCoffeeModule();
}
/**
* A {@code Binder<java.lang.String>} implementation which satisfies
* Dagger's infrastructure requirements including:
*
* Being a {@code Provider<java.lang.String>} and handling creation and
* preparation of object instances.
*/
private static class AddStringProvidesAdapter extends Binding<String>
implements javax.inject.Provider<String> {
private final DripCoffeeModule module;
public AddStringProvidesAdapter(DripCoffeeModule module) {
super("@javax.inject.Named(value=Foo)/java.lang.String", null, NOT_A_SINGLETON, coffee.DripCoffeeModule.class);
this.module = module;
}
/**
* Returns the fully provisioned instance satisfying the contract for
* {@code Provider<java.lang.String>}.
*/
@Override
public String get() {
return module.addString();
}
}
}
//Code generated by dagger-compiler.
package coffee;
import dagger.internal.Binding;
import dagger.internal.Linker;
import dagger.internal.ModuleAdapter;
import java.util.Map;
import java.util.Set;
public final class PumpModule$ModuleAdapter extends ModuleAdapter<PumpModule> {
private static final String[] ENTRY_POINTS = { };
private static final Class<?>[] STATIC_INJECTIONS = { };
private static final Class<?>[] INCLUDES = { };
public PumpModule$ModuleAdapter() {
super(ENTRY_POINTS, STATIC_INJECTIONS, false /*overrides*/, INCLUDES, false /*complete*/);
}
/**
* Used internally obtain dependency information, such as for cyclical
* graph detection.
*/
@Override
public void getBindings(Map<String, Binding<?>> map) {
map.put("coffee.Pump", new ProvidePumpProvidesAdapter(module));
}
@Override
protected PumpModule newModule() {
throw new UnsupportedOperationException("No no-args constructor on coffee.PumpModule");
}
/**
* A {@code Binder<coffee.Pump>} implementation which satisfies
* Dagger's infrastructure requirements including:
*
* Owning the dependency links between {@code coffee.Pump} and its
* dependencies.
*
* Being a {@code Provider<coffee.Pump>} and handling creation and
* preparation of object instances.
*/
private static class ProvidePumpProvidesAdapter extends Binding<Pump>
implements javax.inject.Provider<Pump> {
private final PumpModule module;
private Binding<Thermosiphon> parameter_pump;
public ProvidePumpProvidesAdapter(PumpModule module) {
super("coffee.Pump", null, NOT_A_SINGLETON, coffee.PumpModule.class);
this.module = module;
}
/**
* Used internally to link bindings/providers together at run time
* according to their dependency graph.
*/
@Override
public void attach(Linker linker) {
parameter_pump = (Binding<Thermosiphon>) linker.requestBinding("coffee.Thermosiphon", coffee.PumpModule.class);
}
/**
* Used internally obtain dependency information, such as for cyclical
* graph detection.
*/
@Override
public void getDependencies(Set<Binding<?>> getBindings, Set<Binding<?>> injectMembersBindings) {
getBindings.add(parameter_pump);
}
/**
* Returns the fully provisioned instance satisfying the contract for
* {@code Provider<coffee.Pump>}.
*/
@Override
public Pump get() {
return module.providePump(parameter_pump.get());
}
}
}
//Code generated by dagger-compiler.
package coffee;
import dagger.internal.Binding;
import dagger.internal.Linker;
import java.util.Set;
import javax.inject.Provider;
/**
* A {@code Binder<Thermosiphon>} implementation which satisfies
* Dagger's infrastructure requirements including:
*
* Being a {@code Provider<Thermosiphon>} and handling creation and
* preparation of object instances.
*
* Being a {@code MembersInjector<Thermosiphon>} and handling injection
* of annotated fields.
*/
final class Thermosiphon$InjectAdapter extends Binding<Thermosiphon>
implements Provider<Thermosiphon> {
private Binding<Heater> parameter_heater;
private Binding<AbstractPump> supertype;
public Thermosiphon$InjectAdapter() {
super("coffee.Thermosiphon", "members/coffee.Thermosiphon", NOT_A_SINGLETON, Thermosiphon.class);
}
/**
* Used internally to link bindings/providers together at run time
* according to their dependency graph.
*/
@Override
public void attach(Linker linker) {
parameter_heater = (Binding<Heater>) linker.requestBinding("coffee.Heater", Thermosiphon.class);
supertype = (dagger.internal.Binding<coffee.AbstractPump>) linker.requestBinding("members/coffee.AbstractPump", Thermosiphon.class, false);
}
/**
* Used internally obtain dependency information, such as for cyclical
* graph detection.
*/
@Override
public void getDependencies(Set<Binding<?>> getBindings, Set<Binding<?>> injectMembersBindings) {
getBindings.add(parameter_heater);
injectMembersBindings.add(supertype);
}
/**
* Returns the fully provisioned instance satisfying the contract for
* {@code Provider<Thermosiphon>}.
*/
@Override
public Thermosiphon get() {
Thermosiphon result = new Thermosiphon(parameter_heater.get());
injectMembers(result);
return result;
}
/**
* Injects any {@code @Inject} annotated fields in the given instance,
* satisfying the contract for {@code Provider<Thermosiphon>}.
*/
@Override
public void injectMembers(Thermosiphon object) {
supertype.injectMembers(object);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment