Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added one more test
- Loading branch information
Michail Plushnikov
committed
Apr 10, 2016
1 parent
9b8adad
commit c65ef86
Showing
6 changed files
with
186 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
test-manual/src/main/java/de/plushnikov/value/ValueWithPackagePrivate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,27 @@ | |||
package de.plushnikov.value; | |||
|
|||
import lombok.Value; | |||
import lombok.experimental.NonFinal; | |||
import lombok.experimental.PackagePrivate; | |||
|
|||
@Value | |||
public class ValueWithPackagePrivate { | |||
private int privateInt; | |||
protected int protectedInt; | |||
public int publicInt; | |||
int anInt; | |||
|
|||
@PackagePrivate | |||
int annotatedInt; | |||
|
|||
@NonFinal | |||
int nonFinalInt; | |||
|
|||
@PackagePrivate | |||
public int shouldBePublicInt; | |||
|
|||
public static void main(String[] args) { | |||
final ValueWithPackagePrivate test = new ValueWithPackagePrivate(1, 2, 3, 4, 5, 6, 7); | |||
System.out.println(test); | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,107 @@ | |||
public final class ValueWithPackagePrivate { | |||
private final int privateInt; | |||
protected final int protectedInt; | |||
public final int publicInt; | |||
private final int anInt; | |||
|
|||
final int annotatedInt; | |||
|
|||
private int nonFinalInt; | |||
|
|||
public final int shouldBePublicInt; | |||
|
|||
@java.beans.ConstructorProperties({"privateInt", "protectedInt", "publicInt", "anInt", "annotatedInt", "nonFinalInt", "shouldBePublicInt"}) | |||
public ValueWithPackagePrivate(int privateInt, int protectedInt, int publicInt, int anInt, int annotatedInt, int nonFinalInt, int shouldBePublicInt) { | |||
this.privateInt = privateInt; | |||
this.protectedInt = protectedInt; | |||
this.publicInt = publicInt; | |||
this.anInt = anInt; | |||
this.annotatedInt = annotatedInt; | |||
this.nonFinalInt = nonFinalInt; | |||
this.shouldBePublicInt = shouldBePublicInt; | |||
} | |||
|
|||
public static void main(String[] args) { | |||
final ValueWithPackagePrivate test = new ValueWithPackagePrivate(1, 2, 3, 4, 5, 6, 7); | |||
System.out.println(test); | |||
} | |||
|
|||
public int getPrivateInt() { | |||
return this.privateInt; | |||
} | |||
|
|||
public int getProtectedInt() { | |||
return this.protectedInt; | |||
} | |||
|
|||
public int getPublicInt() { | |||
return this.publicInt; | |||
} | |||
|
|||
public int getAnInt() { | |||
return this.anInt; | |||
} | |||
|
|||
public int getAnnotatedInt() { | |||
return this.annotatedInt; | |||
} | |||
|
|||
public int getNonFinalInt() { | |||
return this.nonFinalInt; | |||
} | |||
|
|||
public int getShouldBePublicInt() { | |||
return this.shouldBePublicInt; | |||
} | |||
|
|||
public boolean equals(Object o) { | |||
if (o == this) { | |||
return true; | |||
} | |||
if (!(o instanceof ValueWithPackagePrivate)) { | |||
return false; | |||
} | |||
final ValueWithPackagePrivate other = (ValueWithPackagePrivate) o; | |||
if (this.privateInt != other.privateInt) { | |||
return false; | |||
} | |||
if (this.protectedInt != other.protectedInt) { | |||
return false; | |||
} | |||
if (this.publicInt != other.publicInt) { | |||
return false; | |||
} | |||
if (this.anInt != other.anInt) { | |||
return false; | |||
} | |||
if (this.annotatedInt != other.annotatedInt) { | |||
return false; | |||
} | |||
if (this.nonFinalInt != other.nonFinalInt) { | |||
return false; | |||
} | |||
if (this.shouldBePublicInt != other.shouldBePublicInt) { | |||
return false; | |||
} | |||
|
|||
return true; | |||
} | |||
|
|||
public int hashCode() { | |||
final int PRIME = 59; | |||
int result = 1; | |||
result = result * PRIME + this.privateInt; | |||
result = result * PRIME + this.protectedInt; | |||
result = result * PRIME + this.publicInt; | |||
result = result * PRIME + this.anInt; | |||
result = result * PRIME + this.annotatedInt; | |||
result = result * PRIME + this.nonFinalInt; | |||
result = result * PRIME + this.shouldBePublicInt; | |||
return result; | |||
} | |||
|
|||
public String toString() { | |||
return "ValueWithPackagePrivate(privateInt=" + this.privateInt + ", protectedInt=" + this.protectedInt + ", publicInt=" + this.publicInt | |||
+ ", anInt=" + this.anInt + ", annotatedInt=" + this.annotatedInt + ", nonFinalInt=" + this.nonFinalInt + ", shouldBePublicInt=" + this.shouldBePublicInt +")"; | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,25 @@ | |||
import lombok.Value; | |||
import lombok.experimental.NonFinal; | |||
import lombok.experimental.PackagePrivate; | |||
|
|||
@Value | |||
public class ValueWithPackagePrivate { | |||
private int privateInt; | |||
protected int protectedInt; | |||
public int publicInt; | |||
int anInt; | |||
|
|||
@PackagePrivate | |||
int annotatedInt; | |||
|
|||
@NonFinal | |||
int nonFinalInt; | |||
|
|||
@PackagePrivate | |||
public int shouldBePublicInt; | |||
|
|||
public static void main(String[] args) { | |||
final ValueWithPackagePrivate test = new ValueWithPackagePrivate(1, 2, 3, 4, 5, 6, 7); | |||
System.out.println(test); | |||
} | |||
} |