Skip to content

Commit 333168f

Browse files
committed
Merge remote-tracking branch 'upstream/master' into BAEL-1754
2 parents 35c5016 + 4d80039 commit 333168f

486 files changed

Lines changed: 7735 additions & 2097 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎README.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,9 @@ CI - Jenkins
3434
================================
3535
This tutorials project is being built **[>> HERE](https://rest-security.ci.cloudbees.com/job/tutorials-unit/)**
3636

37+
### Relevant Articles:
38+
================================
39+
40+
- [Apache Maven Standard Directory Layout](http://www.baeldung.com/maven-directory-structure)
41+
- [Apache Maven Tutorial](http://www.baeldung.com/maven)
42+
- [Designing a User Friendly Java Library](http://www.baeldung.com/design-a-user-friendly-java-library)

‎algorithms/README.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@
2020
- [A Maze Solver in Java](http://www.baeldung.com/java-solve-maze)
2121
- [Create a Sudoku Solver in Java](http://www.baeldung.com/java-sudoku)
2222
- [Displaying Money Amounts in Words](http://www.baeldung.com/java-money-into-words)
23-
- [A Collaborative Filtering Recommendation System in Java](http://www.baeldung.com/java-collaborative-filtering-recommendations)
23+
- [A Collaborative Filtering Recommendation System in Java](http://www.baeldung.com/java-collaborative-filtering-recommendations)
24+
- [Find All Pairs of Numbers in an Array That Add Up to a Given Sum](http://www.baeldung.com/java-algorithm-number-pairs-sum)

‎asciidoctor/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22

33
- [Introduction to Asciidoctor](http://www.baeldung.com/introduction-to-asciidoctor)
44
- [Generating a Book with Asciidoctor](http://www.baeldung.com/asciidoctor-book)
5+
- [Introduction to Asciidoctor in Java](http://www.baeldung.com/asciidoctor)

‎autovalue/pom.xml‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,29 @@
1818
<artifactId>auto-value</artifactId>
1919
<version>${auto-value.version}</version>
2020
</dependency>
21+
<dependency>
22+
<groupId>com.google.auto.factory</groupId>
23+
<artifactId>auto-factory</artifactId>
24+
<version>${auto-factory.version}</version>
25+
<exclusions>
26+
<exclusion>
27+
<groupId>com.google.guava</groupId>
28+
<artifactId>guava</artifactId>
29+
</exclusion>
30+
</exclusions>
31+
</dependency>
32+
33+
<dependency>
34+
<groupId>com.google.inject</groupId>
35+
<artifactId>guice</artifactId>
36+
<version>${guice.version}</version>
37+
</dependency>
2138
</dependencies>
2239

2340
<properties>
2441
<auto-value.version>1.3</auto-value.version>
42+
<auto-factory.version>1.0-beta5</auto-factory.version>
43+
<guice.version>4.2.0</guice.version>
2544
</properties>
2645

2746
</project>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.baeldung.autofactory;
2+
3+
import com.baeldung.autofactory.model.Camera;
4+
import com.baeldung.autofactory.model.Phone;
5+
import com.baeldung.autofactory.model.PhoneFactory;
6+
import com.baeldung.autofactory.modules.SonyCameraModule;
7+
import com.google.inject.Guice;
8+
import com.google.inject.Injector;
9+
10+
public class App {
11+
12+
public static void main(String[] args) {
13+
PhoneFactory phoneFactory = new PhoneFactory(() -> new Camera("Unknown", "XXX"));
14+
Phone simplePhone = phoneFactory.create("other parts");
15+
16+
Injector injector = Guice.createInjector(new SonyCameraModule());
17+
PhoneFactory injectedFactory = injector.getInstance(PhoneFactory.class);
18+
Phone xperia = injectedFactory.create("Xperia");
19+
}
20+
21+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.baeldung.autofactory;
2+
3+
import com.baeldung.autofactory.custom.SmartPhone;
4+
5+
/**
6+
* @author aiet
7+
*/
8+
public interface CustomStorage {
9+
10+
SmartPhone customROMInGB(int romSize);
11+
12+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.baeldung.autofactory.custom;
2+
3+
/**
4+
* @author aiet
5+
*/
6+
public abstract class AbstractFactory {
7+
8+
abstract CustomPhone newInstance(String brand);
9+
10+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.baeldung.autofactory.custom;
2+
3+
import com.google.auto.factory.AutoFactory;
4+
5+
/**
6+
* @author aiet
7+
*/
8+
@AutoFactory(extending = AbstractFactory.class)
9+
public class CustomPhone {
10+
11+
private final String brand;
12+
13+
public CustomPhone(String brand) {
14+
this.brand = brand;
15+
}
16+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.baeldung.autofactory.custom;
2+
3+
import com.baeldung.autofactory.CustomStorage;
4+
import com.google.auto.factory.AutoFactory;
5+
6+
/**
7+
* @author aiet
8+
*/
9+
@AutoFactory(className = "SamsungFactory", allowSubclasses = true, implementing = CustomStorage.class)
10+
public class SmartPhone {
11+
12+
private int romSize;
13+
14+
public SmartPhone(int romSize) {
15+
this.romSize = romSize;
16+
}
17+
18+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.baeldung.autofactory.model;
2+
3+
/**
4+
* @author aiet
5+
*/
6+
public class Camera {
7+
8+
private final String manufacturer;
9+
private final String serial;
10+
11+
public Camera(String manufacturer, String serial) {
12+
this.manufacturer = manufacturer;
13+
this.serial = serial;
14+
}
15+
16+
public String getManufacturer() {
17+
return manufacturer;
18+
}
19+
20+
public String getSerial() {
21+
return serial;
22+
}
23+
24+
}

0 commit comments

Comments
 (0)