Merge pull request #8125 from eugenp/revert-8119-BAEL-3275-2

Revert "BAEL-3275: Using blocking queue for pub-sub"
This commit is contained in:
Eric Martin
2019-10-31 20:43:47 -05:00
committed by GitHub
parent db85c8f275
commit 3225470df5
20543 changed files with 1642750 additions and 0 deletions
@@ -0,0 +1,45 @@
package com.baeldung.dagger.intro;
/**
* Brand of a {@link Car}.
*
* @author Donato Rimenti
*
*/
public class Brand {
/**
* The name of the brand.
*/
private String name;
/**
* Instantiates a new Brand.
*
* @param name
* the {@link #name}
*/
public Brand(String name) {
this.name = name;
}
/**
* Gets the {@link #name}.
*
* @return the {@link #name}
*/
public String getName() {
return name;
}
/**
* Sets the {@link #name}.
*
* @param name
* the new {@link #name}
*/
public void setName(String name) {
this.name = name;
}
}
@@ -0,0 +1,75 @@
package com.baeldung.dagger.intro;
import javax.inject.Inject;
/**
* Represents a car.
*
* @author Donato Rimenti
*
*/
public class Car {
/**
* The car's engine.
*/
private Engine engine;
/**
* The car's brand.
*/
private Brand brand;
/**
* Instantiates a new Car.
*
* @param engine
* the {@link #engine}
* @param brand
* the {@link #brand}
*/
@Inject
public Car(Engine engine, Brand brand) {
this.engine = engine;
this.brand = brand;
}
/**
* Gets the {@link #engine}.
*
* @return the {@link #engine}
*/
public Engine getEngine() {
return engine;
}
/**
* Sets the {@link #engine}.
*
* @param engine
* the new {@link #engine}
*/
public void setEngine(Engine engine) {
this.engine = engine;
}
/**
* Gets the {@link #brand}.
*
* @return the {@link #brand}
*/
public Brand getBrand() {
return brand;
}
/**
* Sets the {@link #brand}.
*
* @param brand
* the new {@link #brand}
*/
public void setBrand(Brand brand) {
this.brand = brand;
}
}
@@ -0,0 +1,24 @@
package com.baeldung.dagger.intro;
/**
* Engine of a {@link Car}.
*
* @author Donato Rimenti
*
*/
public class Engine {
/**
* Starts the engine.
*/
public void start() {
System.out.println("Engine started");
}
/**
* Stops the engine.
*/
public void stop() {
System.out.println("Engine stopped");
}
}
@@ -0,0 +1,24 @@
package com.baeldung.dagger.intro;
import javax.inject.Singleton;
import dagger.Component;
/**
* Dagger component for building vehicles.
*
* @author Donato Rimenti
*
*/
@Singleton
@Component(modules = VehiclesModule.class)
public interface VehiclesComponent {
/**
* Builds a {@link Car}.
*
* @return a {@link Car}
*/
public Car buildCar();
}
@@ -0,0 +1,37 @@
package com.baeldung.dagger.intro;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
/**
* Dagger module for providing vehicles components.
*
* @author Donato Rimenti
*
*/
@Module
public class VehiclesModule {
/**
* Creates an {@link Engine}.
*
* @return an {@link Engine}
*/
@Provides
public Engine provideEngine() {
return new Engine();
}
/**
* Creates a {@link Brand}.
*
* @return a {@link Brand}
*/
@Provides
@Singleton
public Brand provideBrand() {
return new Brand("Baeldung");
}
}
+13
View File
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
</pattern>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="STDOUT" />
</root>
</configuration>