BAEL-1706 move code to guest module (#4123)

This commit is contained in:
chrisoberle 2018-04-28 14:50:47 -04:00 committed by Eugen
parent 9b4405675e
commit 12cdd5357d
7 changed files with 191 additions and 184 deletions

View File

@ -41,11 +41,18 @@
<version>${org.hamcrest.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<log4j2.version>2.8.2</log4j2.version>
<org.hamcrest.version>1.3</org.hamcrest.version>
<assertj.version>3.6.1</assertj.version>
</properties>
</project>

View File

@ -1,50 +1,50 @@
package com.baeldung.optionalparams;
public class MultiVitamin {
private String name; // required
private int vitaminA; // in mcg
private int vitaminC; // in mg
private int calcium; // in mg
private int iron; // in mg
public MultiVitamin(String name) {
this.name = name;
}
public String getName() {
return name;
}
public int getVitaminA() {
return vitaminA;
}
public void setVitaminA(int vitaminA) {
this.vitaminA = vitaminA;
}
public int getVitaminC() {
return vitaminC;
}
public void setVitaminC(int vitaminC) {
this.vitaminC = vitaminC;
}
public int getCalcium() {
return calcium;
}
public void setCalcium(int calcium) {
this.calcium = calcium;
}
public int getIron() {
return iron;
}
public void setIron(int iron) {
this.iron = iron;
}
package com.stackify.optionalparams;
public class MultiVitamin {
private String name; // required
private int vitaminA; // in mcg
private int vitaminC; // in mg
private int calcium; // in mg
private int iron; // in mg
public MultiVitamin(String name) {
this.name = name;
}
public String getName() {
return name;
}
public int getVitaminA() {
return vitaminA;
}
public void setVitaminA(int vitaminA) {
this.vitaminA = vitaminA;
}
public int getVitaminC() {
return vitaminC;
}
public void setVitaminC(int vitaminC) {
this.vitaminC = vitaminC;
}
public int getCalcium() {
return calcium;
}
public void setCalcium(int calcium) {
this.calcium = calcium;
}
public int getIron() {
return iron;
}
public void setIron(int iron) {
this.iron = iron;
}
}

View File

@ -1,4 +1,4 @@
package com.baeldung.optionalparams;
package com.stackify.optionalparams;
public class MultiVitaminAllowingNulls {

View File

@ -1,56 +1,56 @@
package com.baeldung.optionalparams;
public class MultiVitaminOverloading {
static final int DEFAULT_IRON_AMOUNT = 20;
private final String name; // required
private final int vitaminA; // in mcg
private final int vitaminC; // in mg
private final int calcium; // in mg
private final int iron; // in mg
public MultiVitaminOverloading(String name) {
this(name, 0);
}
public MultiVitaminOverloading(String name, int vitaminA) {
this(name, vitaminA, 0);
}
public MultiVitaminOverloading(String name, int vitaminA, int vitaminC) {
this(name, vitaminA, vitaminC, 0);
}
public MultiVitaminOverloading(String name, int vitaminA, int vitaminC, int calcium) {
this(name, vitaminA, vitaminC, calcium, DEFAULT_IRON_AMOUNT);
}
public MultiVitaminOverloading(String name, int vitaminA, int vitaminC, int calcium, int iron) {
this.name = name;
this.vitaminA = vitaminA;
this.vitaminC = vitaminC;
this.calcium = calcium;
this.iron = iron;
}
public String getName() {
return name;
}
public int getVitaminA() {
return vitaminA;
}
public int getVitaminC() {
return vitaminC;
}
public int getCalcium() {
return calcium;
}
public int getIron() {
return iron;
}
package com.stackify.optionalparams;
public class MultiVitaminOverloading {
static final int DEFAULT_IRON_AMOUNT = 20;
private final String name; // required
private final int vitaminA; // in mcg
private final int vitaminC; // in mg
private final int calcium; // in mg
private final int iron; // in mg
public MultiVitaminOverloading(String name) {
this(name, 0);
}
public MultiVitaminOverloading(String name, int vitaminA) {
this(name, vitaminA, 0);
}
public MultiVitaminOverloading(String name, int vitaminA, int vitaminC) {
this(name, vitaminA, vitaminC, 0);
}
public MultiVitaminOverloading(String name, int vitaminA, int vitaminC, int calcium) {
this(name, vitaminA, vitaminC, calcium, DEFAULT_IRON_AMOUNT);
}
public MultiVitaminOverloading(String name, int vitaminA, int vitaminC, int calcium, int iron) {
this.name = name;
this.vitaminA = vitaminA;
this.vitaminC = vitaminC;
this.calcium = calcium;
this.iron = iron;
}
public String getName() {
return name;
}
public int getVitaminA() {
return vitaminA;
}
public int getVitaminC() {
return vitaminC;
}
public int getCalcium() {
return calcium;
}
public int getIron() {
return iron;
}
}

View File

@ -1,4 +1,4 @@
package com.baeldung.optionalparams;
package com.stackify.optionalparams;
public class MultiVitaminStaticFactoryMethods {

View File

@ -1,77 +1,77 @@
package com.baeldung.optionalparams;
public class MultiVitaminWithBuilder {
private final String name; // required
private final int vitaminA; // in mcg
private final int vitaminC; // in mg
private final int calcium; // in mg
private final int iron; // in mg
private MultiVitaminWithBuilder(MultiVitaminBuilder builder) {
this.name = builder.name;
this.vitaminA = builder.vitaminA;
this.vitaminC = builder.vitaminC;
this.calcium = builder.calcium;
this.iron = builder.iron;
}
public String getName() {
return name;
}
public int getVitaminA() {
return vitaminA;
}
public int getVitaminC() {
return vitaminC;
}
public int getCalcium() {
return calcium;
}
public int getIron() {
return iron;
}
public static class MultiVitaminBuilder {
private static final int ZERO = 0;
private final String name; // required
private int vitaminA = ZERO;
private int vitaminC = ZERO;
private int calcium = ZERO;
private int iron = ZERO;
public MultiVitaminBuilder(String name) {
this.name = name;
}
public MultiVitaminBuilder withVitaminA(int vitaminA) {
this.vitaminA = vitaminA;
return this;
}
public MultiVitaminBuilder withVitaminC(int vitaminC) {
this.vitaminC = vitaminC;
return this;
}
public MultiVitaminBuilder withCalcium(int calcium) {
this.calcium = calcium;
return this;
}
public MultiVitaminBuilder withIron(int iron) {
this.iron = iron;
return this;
}
public MultiVitaminWithBuilder build() {
return new MultiVitaminWithBuilder(this);
}
}
}
package com.stackify.optionalparams;
public class MultiVitaminWithBuilder {
private final String name; // required
private final int vitaminA; // in mcg
private final int vitaminC; // in mg
private final int calcium; // in mg
private final int iron; // in mg
private MultiVitaminWithBuilder(MultiVitaminBuilder builder) {
this.name = builder.name;
this.vitaminA = builder.vitaminA;
this.vitaminC = builder.vitaminC;
this.calcium = builder.calcium;
this.iron = builder.iron;
}
public String getName() {
return name;
}
public int getVitaminA() {
return vitaminA;
}
public int getVitaminC() {
return vitaminC;
}
public int getCalcium() {
return calcium;
}
public int getIron() {
return iron;
}
public static class MultiVitaminBuilder {
private static final int ZERO = 0;
private final String name; // required
private int vitaminA = ZERO;
private int vitaminC = ZERO;
private int calcium = ZERO;
private int iron = ZERO;
public MultiVitaminBuilder(String name) {
this.name = name;
}
public MultiVitaminBuilder withVitaminA(int vitaminA) {
this.vitaminA = vitaminA;
return this;
}
public MultiVitaminBuilder withVitaminC(int vitaminC) {
this.vitaminC = vitaminC;
return this;
}
public MultiVitaminBuilder withCalcium(int calcium) {
this.calcium = calcium;
return this;
}
public MultiVitaminBuilder withIron(int iron) {
this.iron = iron;
return this;
}
public MultiVitaminWithBuilder build() {
return new MultiVitaminWithBuilder(this);
}
}
}

View File

@ -1,4 +1,4 @@
package com.baeldung.optionalparams;
package com.stackify.optionalparams;
import static org.assertj.core.api.Assertions.assertThat;