aboutsummaryrefslogtreecommitdiff
path: root/website/usageExamples
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2017-05-08 21:28:02 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2017-05-29 21:02:54 +0200
commit8b7a7cbc813653a3248d6cf3a7779e220957bc85 (patch)
treeb9acfb9d68c6866acc3cfb9ee59d72ff43f1ebc3 /website/usageExamples
parent72fd50b9f1db1ab6bfc1753ba6a1e686a2f0f22c (diff)
downloadlombok-8b7a7cbc813653a3248d6cf3a7779e220957bc85.tar.gz
lombok-8b7a7cbc813653a3248d6cf3a7779e220957bc85.tar.bz2
lombok-8b7a7cbc813653a3248d6cf3a7779e220957bc85.zip
The great rename: the old ‘website’ is now ‘website-old’, and ‘website2’ is now ‘website’.
Diffstat (limited to 'website/usageExamples')
-rw-r--r--website/usageExamples/BuilderExample_post.jpage74
-rw-r--r--website/usageExamples/BuilderExample_pre.jpage10
-rw-r--r--website/usageExamples/CleanupExample_post.jpage26
-rw-r--r--website/usageExamples/CleanupExample_pre.jpage15
-rw-r--r--website/usageExamples/ConstructorExample_post.jpage28
-rw-r--r--website/usageExamples/ConstructorExample_pre.jpage16
-rw-r--r--website/usageExamples/DataExample_post.jpage119
-rw-r--r--website/usageExamples/DataExample_pre.jpage18
-rw-r--r--website/usageExamples/EqualsAndHashCodeExample_post.jpage72
-rw-r--r--website/usageExamples/EqualsAndHashCodeExample_pre.jpage25
-rw-r--r--website/usageExamples/GetterLazyExample_post.jpage26
-rw-r--r--website/usageExamples/GetterLazyExample_pre.jpage13
-rw-r--r--website/usageExamples/GetterSetterExample_post.jpage42
-rw-r--r--website/usageExamples/GetterSetterExample_pre.jpage26
-rw-r--r--website/usageExamples/LogExample_post.jpage23
-rw-r--r--website/usageExamples/LogExample_pre.jpage26
-rw-r--r--website/usageExamples/NonNullExample_post.jpage13
-rw-r--r--website/usageExamples/NonNullExample_pre.jpage10
-rw-r--r--website/usageExamples/Singular-snippetExample_post.jpage160
-rw-r--r--website/usageExamples/Singular-snippetExample_pre.jpage14
-rw-r--r--website/usageExamples/SneakyThrowsExample_post.jpage19
-rw-r--r--website/usageExamples/SneakyThrowsExample_pre.jpage13
-rw-r--r--website/usageExamples/SynchronizedExample_post.jpage23
-rw-r--r--website/usageExamples/SynchronizedExample_pre.jpage20
-rw-r--r--website/usageExamples/ToStringExample_post.jpage30
-rw-r--r--website/usageExamples/ToStringExample_pre.jpage24
-rw-r--r--website/usageExamples/ValueExample_post.jpage120
-rw-r--r--website/usageExamples/ValueExample_pre.jpage19
-rw-r--r--website/usageExamples/experimental/AccessorsExample_post.jpage20
-rw-r--r--website/usageExamples/experimental/AccessorsExample_pre.jpage14
-rw-r--r--website/usageExamples/experimental/DelegateExample_post.jpage97
-rw-r--r--website/usageExamples/experimental/DelegateExample_pre.jpage37
-rw-r--r--website/usageExamples/experimental/ExtensionMethodExample_post.jpage21
-rw-r--r--website/usageExamples/experimental/ExtensionMethodExample_pre.jpage24
-rw-r--r--website/usageExamples/experimental/FieldDefaultsExample_post.jpage12
-rw-r--r--website/usageExamples/experimental/FieldDefaultsExample_pre.jpage18
-rw-r--r--website/usageExamples/experimental/HelperExample_post.jpage14
-rw-r--r--website/usageExamples/experimental/HelperExample_pre.jpage15
-rw-r--r--website/usageExamples/experimental/UtilityClassExample_post.jpage11
-rw-r--r--website/usageExamples/experimental/UtilityClassExample_pre.jpage10
-rw-r--r--website/usageExamples/experimental/WitherExample_post.jpage21
-rw-r--r--website/usageExamples/experimental/WitherExample_pre.jpage14
-rw-r--r--website/usageExamples/experimental/onXExample_post.jpage22
-rw-r--r--website/usageExamples/experimental/onXExample_pre.jpage15
-rw-r--r--website/usageExamples/valExample_post.jpage21
-rw-r--r--website/usageExamples/valExample_pre.jpage21
46 files changed, 1431 insertions, 0 deletions
diff --git a/website/usageExamples/BuilderExample_post.jpage b/website/usageExamples/BuilderExample_post.jpage
new file mode 100644
index 00000000..54b064d7
--- /dev/null
+++ b/website/usageExamples/BuilderExample_post.jpage
@@ -0,0 +1,74 @@
+import java.util.Set;
+
+public class BuilderExample {
+ private String name;
+ private int age;
+ private Set<String> occupations;
+
+ BuilderExample(String name, int age, Set<String> occupations) {
+ this.name = name;
+ this.age = age;
+ this.occupations = occupations;
+ }
+
+ public static BuilderExampleBuilder builder() {
+ return new BuilderExampleBuilder();
+ }
+
+ public static class BuilderExampleBuilder {
+ private String name;
+ private int age;
+ private java.util.ArrayList<String> occupations;
+
+ BuilderExampleBuilder() {
+ }
+
+ public BuilderExampleBuilder name(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public BuilderExampleBuilder age(int age) {
+ this.age = age;
+ return this;
+ }
+
+ public BuilderExampleBuilder occupation(String occupation) {
+ if (this.occupations == null) {
+ this.occupations = new java.util.ArrayList<String>();
+ }
+
+ this.occupations.add(occupation);
+ return this;
+ }
+
+ public BuilderExampleBuilder occupations(Collection<? extends String> occupations) {
+ if (this.occupations == null) {
+ this.occupations = new java.util.ArrayList<String>();
+ }
+
+ this.occupations.addAll(occupations);
+ return this;
+ }
+
+ public BuilderExampleBuilder clearOccupations() {
+ if (this.occupations != null) {
+ this.occupations.clear();
+ }
+
+ return this;
+ }
+
+ public BuilderExample build() {
+ // complicated switch statement to produce a compact properly sized immutable set omitted.
+ // go to https://projectlombok.org/features/Singular-snippet.html to see it.
+ Set<String> occupations = ...;
+ return new BuilderExample(name, age, occupations);
+ }
+
+ @java.lang.Override
+ public String toString() {
+ return "BuilderExample.BuilderExampleBuilder(name = " + this.name + ", age = " + this.age + ", occupations = " + this.occupations + ")";
+ }
+ }
+} \ No newline at end of file
diff --git a/website/usageExamples/BuilderExample_pre.jpage b/website/usageExamples/BuilderExample_pre.jpage
new file mode 100644
index 00000000..1557fff4
--- /dev/null
+++ b/website/usageExamples/BuilderExample_pre.jpage
@@ -0,0 +1,10 @@
+import lombok.Builder;
+import lombok.Singular;
+import java.util.Set;
+
+@Builder
+public class BuilderExample {
+ private String name;
+ private int age;
+ @Singular private Set<String> occupations;
+}
diff --git a/website/usageExamples/CleanupExample_post.jpage b/website/usageExamples/CleanupExample_post.jpage
new file mode 100644
index 00000000..7e87c153
--- /dev/null
+++ b/website/usageExamples/CleanupExample_post.jpage
@@ -0,0 +1,26 @@
+import java.io.*;
+
+public class CleanupExample {
+ public static void main(String[] args) throws IOException {
+ InputStream in = new FileInputStream(args[0]);
+ try {
+ OutputStream out = new FileOutputStream(args[1]);
+ try {
+ byte[] b = new byte[10000];
+ while (true) {
+ int r = in.read(b);
+ if (r == -1) break;
+ out.write(b, 0, r);
+ }
+ } finally {
+ if (out != null) {
+ out.close();
+ }
+ }
+ } finally {
+ if (in != null) {
+ in.close();
+ }
+ }
+ }
+}
diff --git a/website/usageExamples/CleanupExample_pre.jpage b/website/usageExamples/CleanupExample_pre.jpage
new file mode 100644
index 00000000..9f639171
--- /dev/null
+++ b/website/usageExamples/CleanupExample_pre.jpage
@@ -0,0 +1,15 @@
+import lombok.Cleanup;
+import java.io.*;
+
+public class CleanupExample {
+ public static void main(String[] args) throws IOException {
+ @Cleanup InputStream in = new FileInputStream(args[0]);
+ @Cleanup OutputStream out = new FileOutputStream(args[1]);
+ byte[] b = new byte[10000];
+ while (true) {
+ int r = in.read(b);
+ if (r == -1) break;
+ out.write(b, 0, r);
+ }
+ }
+}
diff --git a/website/usageExamples/ConstructorExample_post.jpage b/website/usageExamples/ConstructorExample_post.jpage
new file mode 100644
index 00000000..8a2d5069
--- /dev/null
+++ b/website/usageExamples/ConstructorExample_post.jpage
@@ -0,0 +1,28 @@
+public class ConstructorExample<T> {
+ private int x, y;
+ @NonNull private T description;
+
+ private ConstructorExample(T description) {
+ if (description == null) throw new NullPointerException("description");
+ this.description = description;
+ }
+
+ public static <T> ConstructorExample<T> of(T description) {
+ return new ConstructorExample<T>(description);
+ }
+
+ @java.beans.ConstructorProperties({"x", "y", "description"})
+ protected ConstructorExample(int x, int y, T description) {
+ if (description == null) throw new NullPointerException("description");
+ this.x = x;
+ this.y = y;
+ this.description = description;
+ }
+
+ public static class NoArgsExample {
+ @NonNull private String field;
+
+ public NoArgsExample() {
+ }
+ }
+}
diff --git a/website/usageExamples/ConstructorExample_pre.jpage b/website/usageExamples/ConstructorExample_pre.jpage
new file mode 100644
index 00000000..ac0d3c28
--- /dev/null
+++ b/website/usageExamples/ConstructorExample_pre.jpage
@@ -0,0 +1,16 @@
+import lombok.AccessLevel;
+import lombok.RequiredArgsConstructor;
+import lombok.AllArgsConstructor;
+import lombok.NonNull;
+
+@RequiredArgsConstructor(staticName = "of")
+@AllArgsConstructor(access = AccessLevel.PROTECTED)
+public class ConstructorExample<T> {
+ private int x, y;
+ @NonNull private T description;
+
+ @NoArgsConstructor
+ public static class NoArgsExample {
+ @NonNull private String field;
+ }
+}
diff --git a/website/usageExamples/DataExample_post.jpage b/website/usageExamples/DataExample_post.jpage
new file mode 100644
index 00000000..bef0a0f1
--- /dev/null
+++ b/website/usageExamples/DataExample_post.jpage
@@ -0,0 +1,119 @@
+import java.util.Arrays;
+
+public class DataExample {
+ private final String name;
+ private int age;
+ private double score;
+ private String[] tags;
+
+ public DataExample(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ void setAge(int age) {
+ this.age = age;
+ }
+
+ public int getAge() {
+ return this.age;
+ }
+
+ public void setScore(double score) {
+ this.score = score;
+ }
+
+ public double getScore() {
+ return this.score;
+ }
+
+ public String[] getTags() {
+ return this.tags;
+ }
+
+ public void setTags(String[] tags) {
+ this.tags = tags;
+ }
+
+ @Override public String toString() {
+ return "DataExample(" + this.getName() + ", " + this.getAge() + ", " + this.getScore() + ", " + Arrays.deepToString(this.getTags()) + ")";
+ }
+
+ protected boolean canEqual(Object other) {
+ return other instanceof DataExample;
+ }
+
+ @Override public boolean equals(Object o) {
+ if (o == this) return true;
+ if (!(o instanceof DataExample)) return false;
+ DataExample other = (DataExample) o;
+ if (!other.canEqual((Object)this)) return false;
+ if (this.getName() == null ? other.getName() != null : !this.getName().equals(other.getName())) return false;
+ if (this.getAge() != other.getAge()) return false;
+ if (Double.compare(this.getScore(), other.getScore()) != 0) return false;
+ if (!Arrays.deepEquals(this.getTags(), other.getTags())) return false;
+ return true;
+ }
+
+ @Override public int hashCode() {
+ final int PRIME = 59;
+ int result = 1;
+ final long temp1 = Double.doubleToLongBits(this.getScore());
+ result = (result*PRIME) + (this.getName() == null ? 43 : this.getName().hashCode());
+ result = (result*PRIME) + this.getAge();
+ result = (result*PRIME) + (int)(temp1 ^ (temp1 >>> 32));
+ result = (result*PRIME) + Arrays.deepHashCode(this.getTags());
+ return result;
+ }
+
+ public static class Exercise<T> {
+ private final String name;
+ private final T value;
+
+ private Exercise(String name, T value) {
+ this.name = name;
+ this.value = value;
+ }
+
+ public static <T> Exercise<T> of(String name, T value) {
+ return new Exercise<T>(name, value);
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public T getValue() {
+ return this.value;
+ }
+
+ @Override public String toString() {
+ return "Exercise(name=" + this.getName() + ", value=" + this.getValue() + ")";
+ }
+
+ protected boolean canEqual(Object other) {
+ return other instanceof Exercise;
+ }
+
+ @Override public boolean equals(Object o) {
+ if (o == this) return true;
+ if (!(o instanceof Exercise)) return false;
+ Exercise<?> other = (Exercise<?>) o;
+ if (!other.canEqual((Object)this)) return false;
+ if (this.getName() == null ? other.getValue() != null : !this.getName().equals(other.getName())) return false;
+ if (this.getValue() == null ? other.getValue() != null : !this.getValue().equals(other.getValue())) return false;
+ return true;
+ }
+
+ @Override public int hashCode() {
+ final int PRIME = 59;
+ int result = 1;
+ result = (result*PRIME) + (this.getName() == null ? 43 : this.getName().hashCode());
+ result = (result*PRIME) + (this.getValue() == null ? 43 : this.getValue().hashCode());
+ return result;
+ }
+ }
+}
diff --git a/website/usageExamples/DataExample_pre.jpage b/website/usageExamples/DataExample_pre.jpage
new file mode 100644
index 00000000..404d3458
--- /dev/null
+++ b/website/usageExamples/DataExample_pre.jpage
@@ -0,0 +1,18 @@
+import lombok.AccessLevel;
+import lombok.Setter;
+import lombok.Data;
+import lombok.ToString;
+
+@Data public class DataExample {
+ private final String name;
+ @Setter(AccessLevel.PACKAGE) private int age;
+ private double score;
+ private String[] tags;
+
+ @ToString(includeFieldNames=true)
+ @Data(staticConstructor="of")
+ public static class Exercise<T> {
+ private final String name;
+ private final T value;
+ }
+}
diff --git a/website/usageExamples/EqualsAndHashCodeExample_post.jpage b/website/usageExamples/EqualsAndHashCodeExample_post.jpage
new file mode 100644
index 00000000..91e78250
--- /dev/null
+++ b/website/usageExamples/EqualsAndHashCodeExample_post.jpage
@@ -0,0 +1,72 @@
+import java.util.Arrays;
+
+public class EqualsAndHashCodeExample {
+ private transient int transientVar = 10;
+ private String name;
+ private double score;
+ private Shape shape = new Square(5, 10);
+ private String[] tags;
+ private int id;
+
+ public String getName() {
+ return this.name;
+ }
+
+ @Override public boolean equals(Object o) {
+ if (o == this) return true;
+ if (!(o instanceof EqualsAndHashCodeExample)) return false;
+ EqualsAndHashCodeExample other = (EqualsAndHashCodeExample) o;
+ if (!other.canEqual((Object)this)) return false;
+ if (this.getName() == null ? other.getName() != null : !this.getName().equals(other.getName())) return false;
+ if (Double.compare(this.score, other.score) != 0) return false;
+ if (!Arrays.deepEquals(this.tags, other.tags)) return false;
+ return true;
+ }
+
+ @Override public int hashCode() {
+ final int PRIME = 59;
+ int result = 1;
+ final long temp1 = Double.doubleToLongBits(this.score);
+ result = (result*PRIME) + (this.name == null ? 43 : this.name.hashCode());
+ result = (result*PRIME) + (int)(temp1 ^ (temp1 >>> 32));
+ result = (result*PRIME) + Arrays.deepHashCode(this.tags);
+ return result;
+ }
+
+ protected boolean canEqual(Object other) {
+ return other instanceof EqualsAndHashCodeExample;
+ }
+
+ public static class Square extends Shape {
+ private final int width, height;
+
+ public Square(int width, int height) {
+ this.width = width;
+ this.height = height;
+ }
+
+ @Override public boolean equals(Object o) {
+ if (o == this) return true;
+ if (!(o instanceof Square)) return false;
+ Square other = (Square) o;
+ if (!other.canEqual((Object)this)) return false;
+ if (!super.equals(o)) return false;
+ if (this.width != other.width) return false;
+ if (this.height != other.height) return false;
+ return true;
+ }
+
+ @Override public int hashCode() {
+ final int PRIME = 59;
+ int result = 1;
+ result = (result*PRIME) + super.hashCode();
+ result = (result*PRIME) + this.width;
+ result = (result*PRIME) + this.height;
+ return result;
+ }
+
+ protected boolean canEqual(Object other) {
+ return other instanceof Square;
+ }
+ }
+}
diff --git a/website/usageExamples/EqualsAndHashCodeExample_pre.jpage b/website/usageExamples/EqualsAndHashCodeExample_pre.jpage
new file mode 100644
index 00000000..64faf59f
--- /dev/null
+++ b/website/usageExamples/EqualsAndHashCodeExample_pre.jpage
@@ -0,0 +1,25 @@
+import lombok.EqualsAndHashCode;
+
+@EqualsAndHashCode(exclude={"id", "shape"})
+public class EqualsAndHashCodeExample {
+ private transient int transientVar = 10;
+ private String name;
+ private double score;
+ private Shape shape = new Square(5, 10);
+ private String[] tags;
+ private int id;
+
+ public String getName() {
+ return this.name;
+ }
+
+ @EqualsAndHashCode(callSuper=true)
+ public static class Square extends Shape {
+ private final int width, height;
+
+ public Square(int width, int height) {
+ this.width = width;
+ this.height = height;
+ }
+ }
+}
diff --git a/website/usageExamples/GetterLazyExample_post.jpage b/website/usageExamples/GetterLazyExample_post.jpage
new file mode 100644
index 00000000..5f34c43e
--- /dev/null
+++ b/website/usageExamples/GetterLazyExample_post.jpage
@@ -0,0 +1,26 @@
+public class GetterLazyExample {
+ private final java.util.concurrent.AtomicReference<java.lang.Object> cached = new java.util.concurrent.AtomicReference<java.lang.Object>();
+
+ public double[] getCached() {
+ java.lang.Object value = this.cached.get();
+ if (value == null) {
+ synchronized(this.cached) {
+ value = this.cached.get();
+ if (value == null) {
+ final double[] actualValue = expensive();
+ value = actualValue == null ? this.cached : actualValue;
+ this.cached.set(value);
+ }
+ }
+ }
+ return (double[])(value == this.cached ? null : value);
+ }
+
+ private double[] expensive() {
+ double[] result = new double[1000000];
+ for (int i = 0; i < result.length; i++) {
+ result[i] = Math.asin(i);
+ }
+ return result;
+ }
+}
diff --git a/website/usageExamples/GetterLazyExample_pre.jpage b/website/usageExamples/GetterLazyExample_pre.jpage
new file mode 100644
index 00000000..ca6c9d58
--- /dev/null
+++ b/website/usageExamples/GetterLazyExample_pre.jpage
@@ -0,0 +1,13 @@
+import lombok.Getter;
+
+public class GetterLazyExample {
+ @Getter(lazy=true) private final double[] cached = expensive();
+
+ private double[] expensive() {
+ double[] result = new double[1000000];
+ for (int i = 0; i < result.length; i++) {
+ result[i] = Math.asin(i);
+ }
+ return result;
+ }
+}
diff --git a/website/usageExamples/GetterSetterExample_post.jpage b/website/usageExamples/GetterSetterExample_post.jpage
new file mode 100644
index 00000000..241a3a4e
--- /dev/null
+++ b/website/usageExamples/GetterSetterExample_post.jpage
@@ -0,0 +1,42 @@
+public class GetterSetterExample {
+ /**
+ * Age of the person. Water is wet.
+ */
+ private int age = 10;
+
+ /**
+ * Name of the person.
+ */
+ private String name;
+
+ @Override public String toString() {
+ return String.format("%s (age: %d)", name, age);
+ }
+
+ /**
+ * Age of the person. Water is wet.
+ *
+ * @return The current value of this person's age. Circles are round.
+ */
+ public int getAge() {
+ return age;
+ }
+
+ /**
+ * Age of the person. Water is wet.
+ *
+ * @param age New value for this person's age. Sky is blue.
+ */
+ public void setAge(int age) {
+ this.age = age;
+ }
+
+ /**
+ * Changes the name of this person.
+ *
+ * @param name The new value.
+ */
+ protected void setName(String name) {
+ this.name = name;
+ }
+}
diff --git a/website/usageExamples/GetterSetterExample_pre.jpage b/website/usageExamples/GetterSetterExample_pre.jpage
new file mode 100644
index 00000000..4183aa5d
--- /dev/null
+++ b/website/usageExamples/GetterSetterExample_pre.jpage
@@ -0,0 +1,26 @@
+import lombok.AccessLevel;
+import lombok.Getter;
+import lombok.Setter;
+
+public class GetterSetterExample {
+ /**
+ * Age of the person. Water is wet.
+ *
+ * @param age New value for this person's age. Sky is blue.
+ * @return The current value of this person's age. Circles are round.
+ */
+ @Getter @Setter private int age = 10;
+
+ /**
+ * Name of the person.
+ * -- SETTER --
+ * Changes the name of this person.
+ *
+ * @param name The new value.
+ */
+ @Setter(AccessLevel.PROTECTED) private String name;
+
+ @Override public String toString() {
+ return String.format("%s (age: %d)", name, age);
+ }
+}
diff --git a/website/usageExamples/LogExample_post.jpage b/website/usageExamples/LogExample_post.jpage
new file mode 100644
index 00000000..eab3b046
--- /dev/null
+++ b/website/usageExamples/LogExample_post.jpage
@@ -0,0 +1,23 @@
+public class LogExample {
+ private static final java.util.logging.Logger log = java.util.logging.Logger.getLogger(LogExample.class.getName());
+
+ public static void main(String... args) {
+ log.error("Something's wrong here");
+ }
+}
+
+public class LogExampleOther {
+ private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(LogExampleOther.class);
+
+ public static void main(String... args) {
+ log.error("Something else is wrong here");
+ }
+}
+
+public class LogExampleCategory {
+ private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog("CounterLog");
+
+ public static void main(String... args) {
+ log.error("Calling the 'CounterLog' with a message");
+ }
+}
diff --git a/website/usageExamples/LogExample_pre.jpage b/website/usageExamples/LogExample_pre.jpage
new file mode 100644
index 00000000..ba27dd27
--- /dev/null
+++ b/website/usageExamples/LogExample_pre.jpage
@@ -0,0 +1,26 @@
+import lombok.extern.java.Log;
+import lombok.extern.slf4j.Slf4j;
+
+@Log
+public class LogExample {
+
+ public static void main(String... args) {
+ log.error("Something's wrong here");
+ }
+}
+
+@Slf4j
+public class LogExampleOther {
+
+ public static void main(String... args) {
+ log.error("Something else is wrong here");
+ }
+}
+
+@CommonsLog(topic="CounterLog")
+public class LogExampleCategory {
+
+ public static void main(String... args) {
+ log.error("Calling the 'CounterLog' with a message");
+ }
+}
diff --git a/website/usageExamples/NonNullExample_post.jpage b/website/usageExamples/NonNullExample_post.jpage
new file mode 100644
index 00000000..24175e06
--- /dev/null
+++ b/website/usageExamples/NonNullExample_post.jpage
@@ -0,0 +1,13 @@
+import lombok.NonNull;
+
+public class NonNullExample extends Something {
+ private String name;
+
+ public NonNullExample(@NonNull Person person) {
+ super("Hello");
+ if (person == null) {
+ throw new NullPointerException("person");
+ }
+ this.name = person.getName();
+ }
+}
diff --git a/website/usageExamples/NonNullExample_pre.jpage b/website/usageExamples/NonNullExample_pre.jpage
new file mode 100644
index 00000000..47556ce7
--- /dev/null
+++ b/website/usageExamples/NonNullExample_pre.jpage
@@ -0,0 +1,10 @@
+import lombok.NonNull;
+
+public class NonNullExample extends Something {
+ private String name;
+
+ public NonNullExample(@NonNull Person person) {
+ super("Hello");
+ this.name = person.getName();
+ }
+}
diff --git a/website/usageExamples/Singular-snippetExample_post.jpage b/website/usageExamples/Singular-snippetExample_post.jpage
new file mode 100644
index 00000000..4e2b0460
--- /dev/null
+++ b/website/usageExamples/Singular-snippetExample_post.jpage
@@ -0,0 +1,160 @@
+import java.util.Collection;
+import java.util.Set;
+import java.util.SortedMap;
+import com.google.common.collect.ImmutableList;
+
+public class SingularExample<T extends Number> {
+ private Set<String> occupations;
+ private ImmutableList<String> axes;
+ private SortedMap<Integer, T> elves;
+ private Collection<?> minutiae;
+
+ SingularExample(Set<String> occupations, ImmutableList<String> axes, SortedMap<Integer, T> elves, Collection<?> minutiae) {
+ this.occupations = occupations;
+ this.axes = axes;
+ this.elves = elves;
+ this.minutiae = minutiae;
+ }
+
+ public static class SingularExampleBuilder<T extends Number> {
+ private java.util.ArrayList<String> occupations;
+ private com.google.common.collect.ImmutableList.Builder<String> axes;
+ private java.util.ArrayList<Integer> elves$key;
+ private java.util.ArrayList<T> elves$value;
+ private java.util.ArrayList<java.lang.Object> minutiae;
+
+ SingularExampleBuilder() {
+ }
+
+ public SingularExampleBuilder<T> occupation(String occupation) {
+ if (this.occupations == null) {
+ this.occupations = new java.util.ArrayList<String>();
+ }
+
+ this.occupations.add(occupation);
+ return this;
+ }
+
+ @java.lang.SuppressWarnings("all")
+ public SingularExampleBuilder<T> occupations(java.util.Collection<? extends String> occupations) {
+ if (this.occupations == null) {
+ this.occupations = new java.util.ArrayList<String>();
+ }
+
+ this.occupations.addAll(occupations);
+ return this;
+ }
+
+ public SingularExampleBuilder<T> axis(String axis) {
+ if (this.axes == null) {
+ this.axes = com.google.common.collect.ImmutableList.builder();
+ }
+
+ this.axes.add(axis);
+ return this;
+ }
+
+ public SingularExampleBuilder<T> axes(java.lang.Iterable<? extends String> axes) {
+ if (this.axes == null) {
+ this.axes = com.google.common.collect.ImmutableList.builder();
+ }
+
+ this.axes.addAll(axes);
+ return this;
+ }
+
+ public SingularExampleBuilder<T> elf(Integer elfKey, T elfValue) {
+ if (this.elves$key == null) {
+ this.elves$key = new java.util.ArrayList<Integer>();
+ this.elves$value = new java.util.ArrayList<T>();
+ }
+
+ this.elves$key.add(elfKey);
+ this.elves$value.add(elfValue);
+ return this;
+ }
+
+ public SingularExampleBuilder<T> elves(java.util.Map<? extends Integer, ? extends T> elves) {
+ if (this.elves$key == null) {
+ this.elves$key = new java.util.ArrayList<Integer>();
+ this.elves$value = new java.util.ArrayList<T>();
+ }
+
+ for (java.util.Map.Entry<? extends Integer, ? extends T> $lombokEntry : elves.entrySet()) {
+ this.elves$key.add($lombokEntry.getKey());
+ this.elves$value.add($lombokEntry.getValue());
+ }
+ return this;
+ }
+
+ public SingularExampleBuilder<T> minutia(java.lang.Object minutia) {
+ if (this.minutiae == null) {
+ this.minutiae = new java.util.ArrayList<java.lang.Object>();
+ }
+
+ this.minutiae.add(minutia);
+ return this;
+ }
+
+ public SingularExampleBuilder<T> minutiae(java.util.Collection<?> minutiae) {
+ if (this.minutiae == null) {
+ this.minutiae = new java.util.ArrayList<java.lang.Object>();
+ }
+
+ this.minutiae.addAll(minutiae);
+ return this;
+ }
+
+ public SingularExample<T> build() {
+ java.util.Set<String> occupations;
+ switch (this.occupations == null ? 0 : this.occupations.size()) {
+ case 0:
+ occupations = java.util.Collections.emptySet();
+ break;
+
+ case 1:
+ occupations = java.util.Collections.singleton(this.occupations.get(0));
+ break;
+
+ default:
+ occupations = new java.util.LinkedHashSet<String>(this.occupations.size() < 1073741824 ? 1 + this.occupations.size() + (this.occupations.size() - 3) / 3 : java.lang.Integer.MAX_VALUE);
+ occupations.addAll(this.occupations);
+ occupations = java.util.Collections.unmodifiableSet(occupations);
+
+ }
+
+ com.google.common.collect.ImmutableList<String> axes = this.axes == null ? com.google.common.collect.ImmutableList.<String>of() : this.axes.build();
+
+ java.util.SortedMap<Integer, T> elves = new java.util.TreeMap<Integer, T>();
+ if (this.elves$key != null) for (int $i = 0; $i < (this.elves$key == null ? 0 : this.elves$key.size()); $i++) elves.put(this.elves$key.get($i), this.elves$value.get($i));
+ elves = java.util.Collections.unmodifiableSortedMap(elves);
+
+ java.util.Collection<java.lang.Object> minutiae;
+ switch (this.minutiae == null ? 0 : this.minutiae.size()) {
+ case 0:
+ minutiae = java.util.Collections.emptyList();
+ break;
+
+ case 1:
+ minutiae = java.util.Collections.singletonList(this.minutiae.get(0));
+ break;
+
+ default:
+ minutiae = java.util.Collections.unmodifiableList(new java.util.ArrayList<java.lang.Object>(this.minutiae));
+
+ }
+
+ return new SingularExample<T>(occupations, axes, elves, minutiae);
+ }
+
+ @java.lang.Override
+ public java.lang.String toString() {
+ return "SingularExample.SingularExampleBuilder(occupations=" + this.occupations + ", axes=" + this.axes + ", elves$key=" + this.elves$key + ", elves$value=" + this.elves$value + ", minutiae=" + this.minutiae + ")";
+ }
+ }
+
+ @java.lang.SuppressWarnings("all")
+ public static <T extends Number> SingularExampleBuilder<T> builder() {
+ return new SingularExampleBuilder<T>();
+ }
+}
diff --git a/website/usageExamples/Singular-snippetExample_pre.jpage b/website/usageExamples/Singular-snippetExample_pre.jpage
new file mode 100644
index 00000000..65f6bbc8
--- /dev/null
+++ b/website/usageExamples/Singular-snippetExample_pre.jpage
@@ -0,0 +1,14 @@
+import lombok.Builder;
+import lombok.Singular;
+import java.util.Collection;
+import java.util.Set;
+import java.util.SortedMap;
+import com.google.common.collect.ImmutableList;
+
+@Builder
+public class SingularExample<T extends Number> {
+ private @Singular Set<String> occupations;
+ private @Singular("axis") ImmutableList<String> axes;
+ private @Singular SortedMap<Integer, T> elves;
+ private @Singular Collection<?> minutiae;
+}
diff --git a/website/usageExamples/SneakyThrowsExample_post.jpage b/website/usageExamples/SneakyThrowsExample_post.jpage
new file mode 100644
index 00000000..916d94f0
--- /dev/null
+++ b/website/usageExamples/SneakyThrowsExample_post.jpage
@@ -0,0 +1,19 @@
+import lombok.Lombok;
+
+public class SneakyThrowsExample implements Runnable {
+ public String utf8ToString(byte[] bytes) {
+ try {
+ return new String(bytes, "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ throw Lombok.sneakyThrow(e);
+ }
+ }
+
+ public void run() {
+ try {
+ throw new Throwable();
+ } catch (Throwable t) {
+ throw Lombok.sneakyThrow(t);
+ }
+ }
+}
diff --git a/website/usageExamples/SneakyThrowsExample_pre.jpage b/website/usageExamples/SneakyThrowsExample_pre.jpage
new file mode 100644
index 00000000..be6d72d5
--- /dev/null
+++ b/website/usageExamples/SneakyThrowsExample_pre.jpage
@@ -0,0 +1,13 @@
+import lombok.SneakyThrows;
+
+public class SneakyThrowsExample implements Runnable {
+ @SneakyThrows(UnsupportedEncodingException.class)
+ public String utf8ToString(byte[] bytes) {
+ return new String(bytes, "UTF-8");
+ }
+
+ @SneakyThrows
+ public void run() {
+ throw new Throwable();
+ }
+}
diff --git a/website/usageExamples/SynchronizedExample_post.jpage b/website/usageExamples/SynchronizedExample_post.jpage
new file mode 100644
index 00000000..219ab88a
--- /dev/null
+++ b/website/usageExamples/SynchronizedExample_post.jpage
@@ -0,0 +1,23 @@
+public class SynchronizedExample {
+ private static final Object $LOCK = new Object[0];
+ private final Object $lock = new Object[0];
+ private final Object readLock = new Object();
+
+ public static void hello() {
+ synchronized($LOCK) {
+ System.out.println("world");
+ }
+ }
+
+ public int answerToLife() {
+ synchronized($lock) {
+ return 42;
+ }
+ }
+
+ public void foo() {
+ synchronized(readLock) {
+ System.out.println("bar");
+ }
+ }
+}
diff --git a/website/usageExamples/SynchronizedExample_pre.jpage b/website/usageExamples/SynchronizedExample_pre.jpage
new file mode 100644
index 00000000..ace39f85
--- /dev/null
+++ b/website/usageExamples/SynchronizedExample_pre.jpage
@@ -0,0 +1,20 @@
+import lombok.Synchronized;
+
+public class SynchronizedExample {
+ private final Object readLock = new Object();
+
+ @Synchronized
+ public static void hello() {
+ System.out.println("world");
+ }
+
+ @Synchronized
+ public int answerToLife() {
+ return 42;
+ }
+
+ @Synchronized("readLock")
+ public void foo() {
+ System.out.println("bar");
+ }
+}
diff --git a/website/usageExamples/ToStringExample_post.jpage b/website/usageExamples/ToStringExample_post.jpage
new file mode 100644
index 00000000..67e78f20
--- /dev/null
+++ b/website/usageExamples/ToStringExample_post.jpage
@@ -0,0 +1,30 @@
+import java.util.Arrays;
+
+public class ToStringExample {
+ private static final int STATIC_VAR = 10;
+ private String name;
+ private Shape shape = new Square(5, 10);
+ private String[] tags;
+ private int id;
+
+ public String getName() {
+ return this.getName();
+ }
+
+ public static class Square extends Shape {
+ private final int width, height;
+
+ public Square(int width, int height) {
+ this.width = width;
+ this.height = height;
+ }
+
+ @Override public String toString() {
+ return "Square(super=" + super.toString() + ", width=" + this.width + ", height=" + this.height + ")";
+ }
+ }
+
+ @Override public String toString() {
+ return "ToStringExample(" + this.getName() + ", " + this.shape + ", " + Arrays.deepToString(this.tags) + ")";
+ }
+}
diff --git a/website/usageExamples/ToStringExample_pre.jpage b/website/usageExamples/ToStringExample_pre.jpage
new file mode 100644
index 00000000..a15fb944
--- /dev/null
+++ b/website/usageExamples/ToStringExample_pre.jpage
@@ -0,0 +1,24 @@
+import lombok.ToString;
+
+@ToString(exclude="id")
+public class ToStringExample {
+ private static final int STATIC_VAR = 10;
+ private String name;
+ private Shape shape = new Square(5, 10);
+ private String[] tags;
+ private int id;
+
+ public String getName() {
+ return this.getName();
+ }
+
+ @ToString(callSuper=true, includeFieldNames=true)
+ public static class Square extends Shape {
+ private final int width, height;
+
+ public Square(int width, int height) {
+ this.width = width;
+ this.height = height;
+ }
+ }
+}
diff --git a/website/usageExamples/ValueExample_post.jpage b/website/usageExamples/ValueExample_post.jpage
new file mode 100644
index 00000000..8a5d4836
--- /dev/null
+++ b/website/usageExamples/ValueExample_post.jpage
@@ -0,0 +1,120 @@
+import java.util.Arrays;
+
+public final class ValueExample {
+ private final String name;
+ private int age;
+ private final double score;
+ protected final String[] tags;
+
+ @java.beans.ConstructorProperties({"name", "age", "score", "tags"})
+ public ValueExample(String name, int age, double score, String[] tags) {
+ this.name = name;
+ this.age = age;
+ this.score = score;
+ this.tags = tags;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public int getAge() {
+ return this.age;
+ }
+
+ public double getScore() {
+ return this.score;
+ }
+
+ public String[] getTags() {
+ return this.tags;
+ }
+
+ @java.lang.Override
+ public boolean equals(Object o) {
+ if (o == this) return true;
+ if (!(o instanceof ValueExample)) return false;
+ final ValueExample other = (ValueExample)o;
+ final Object this$name = this.getName();
+ final Object other$name = other.getName();
+ if (this$name == null ? other$name != null : !this$name.equals(other$name)) return false;
+ if (this.getAge() != other.getAge()) return false;
+ if (Double.compare(this.getScore(), other.getScore()) != 0) return false;
+ if (!Arrays.deepEquals(this.getTags(), other.getTags())) return false;
+ return true;
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ final int PRIME = 59;
+ int result = 1;
+ final Object $name = this.getName();
+ result = result * PRIME + ($name == null ? 43 : $name.hashCode());
+ result = result * PRIME + this.getAge();
+ final long $score = Double.doubleToLongBits(this.getScore());
+ result = result * PRIME + (int)($score >>> 32 ^ $score);
+ result = result * PRIME + Arrays.deepHashCode(this.getTags());
+ return result;
+ }
+
+ @java.lang.Override
+ public String toString() {
+ return "ValueExample(name=" + getName() + ", age=" + getAge() + ", score=" + getScore() + ", tags=" + Arrays.deepToString(getTags()) + ")";
+ }
+
+ ValueExample withAge(int age) {
+ return this.age == age ? this : new ValueExample(name, age, score, tags);
+ }
+
+ public static final class Exercise<T> {
+ private final String name;
+ private final T value;
+
+ private Exercise(String name, T value) {
+ this.name = name;
+ this.value = value;
+ }
+
+ public static <T> Exercise<T> of(String name, T value) {
+ return new Exercise<T>(name, value);
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public T getValue() {
+ return this.value;
+ }
+
+ @java.lang.Override
+ public boolean equals(Object o) {
+ if (o == this) return true;
+ if (!(o instanceof ValueExample.Exercise)) return false;
+ final Exercise<?> other = (Exercise<?>)o;
+ final Object this$name = this.getName();
+ final Object other$name = other.getName();
+ if (this$name == null ? other$name != null : !this$name.equals(other$name)) return false;
+ final Object this$value = this.getValue();
+ final Object other$value = other.getValue();
+ if (this$value == null ? other$value != null : !this$value.equals(other$value)) return false;
+ return true;
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ final int PRIME = 59;
+ int result = 1;
+ final Object $name = this.getName();
+ result = result * PRIME + ($name == null ? 43 : $name.hashCode());
+ final Object $value = this.getValue();
+ result = result * PRIME + ($value == null ? 43 : $value.hashCode());
+ return result;
+ }
+
+ @java.lang.Override
+ public String toString() {
+ return "ValueExample.Exercise(name=" + getName() + ", value=" + getValue() + ")";
+ }
+ }
+} \ No newline at end of file
diff --git a/website/usageExamples/ValueExample_pre.jpage b/website/usageExamples/ValueExample_pre.jpage
new file mode 100644
index 00000000..d9550c25
--- /dev/null
+++ b/website/usageExamples/ValueExample_pre.jpage
@@ -0,0 +1,19 @@
+import lombok.AccessLevel;
+import lombok.experimental.NonFinal;
+import lombok.experimental.Value;
+import lombok.experimental.Wither;
+import lombok.ToString;
+
+@Value public class ValueExample {
+ String name;
+ @Wither(AccessLevel.PACKAGE) @NonFinal int age;
+ double score;
+ protected String[] tags;
+
+ @ToString(includeFieldNames=true)
+ @Value(staticConstructor="of")
+ public static class Exercise<T> {
+ String name;
+ T value;
+ }
+}
diff --git a/website/usageExamples/experimental/AccessorsExample_post.jpage b/website/usageExamples/experimental/AccessorsExample_post.jpage
new file mode 100644
index 00000000..ae5a39db
--- /dev/null
+++ b/website/usageExamples/experimental/AccessorsExample_post.jpage
@@ -0,0 +1,20 @@
+public class AccessorsExample {
+ private int age = 10;
+
+ public int age() {
+ return this.age;
+ }
+
+ public AccessorsExample age(final int age) {
+ this.age = age;
+ return this;
+ }
+}
+
+class PrefixExample {
+ private String fName = "Hello, World!";
+
+ public String getName() {
+ return this.fName;
+ }
+}
diff --git a/website/usageExamples/experimental/AccessorsExample_pre.jpage b/website/usageExamples/experimental/AccessorsExample_pre.jpage
new file mode 100644
index 00000000..f1591aba
--- /dev/null
+++ b/website/usageExamples/experimental/AccessorsExample_pre.jpage
@@ -0,0 +1,14 @@
+import lombok.experimental.Accessors;
+import lombok.Getter;
+import lombok.Setter;
+
+@Accessors(fluent = true)
+public class AccessorsExample {
+ @Getter @Setter
+ private int age = 10;
+}
+
+class PrefixExample {
+ @Accessors(prefix = "f") @Getter
+ private String fName = "Hello, World!";
+}
diff --git a/website/usageExamples/experimental/DelegateExample_post.jpage b/website/usageExamples/experimental/DelegateExample_post.jpage
new file mode 100644
index 00000000..1c5239f1
--- /dev/null
+++ b/website/usageExamples/experimental/DelegateExample_post.jpage
@@ -0,0 +1,97 @@
+import java.util.ArrayList;
+import java.util.Collection;
+
+public class DelegationExample {
+ private interface SimpleCollection {
+ boolean add(String item);
+ boolean remove(Object item);
+ }
+
+ private final Collection<String> collection = new ArrayList<String>();
+
+ @java.lang.SuppressWarnings("all")
+ public boolean add(final java.lang.String item) {
+ return this.collection.add(item);
+ }
+
+ @java.lang.SuppressWarnings("all")
+ public boolean remove(final java.lang.Object item) {
+ return this.collection.remove(item);
+ }
+}
+
+class ExcludesDelegateExample {
+ long counter = 0L;
+
+ private interface Add {
+ boolean add(String x);
+ boolean addAll(Collection<? extends String> x);
+ }
+
+ private final Collection<String> collection = new ArrayList<String>();
+
+ public boolean add(String item) {
+ counter++;
+ return collection.add(item);
+ }
+
+ public boolean addAll(Collection<? extends String> col) {
+ counter += col.size();
+ return collection.addAll(col);
+ }
+
+ @java.lang.SuppressWarnings("all")
+ public int size() {
+ return this.collection.size();
+ }
+
+ @java.lang.SuppressWarnings("all")
+ public boolean isEmpty() {
+ return this.collection.isEmpty();
+ }
+
+ @java.lang.SuppressWarnings("all")
+ public boolean contains(final java.lang.Object arg0) {
+ return this.collection.contains(arg0);
+ }
+
+ @java.lang.SuppressWarnings("all")
+ public java.util.Iterator<java.lang.String> iterator() {
+ return this.collection.iterator();
+ }
+
+ @java.lang.SuppressWarnings("all")
+ public java.lang.Object[] toArray() {
+ return this.collection.toArray();
+ }
+
+ @java.lang.SuppressWarnings("all")
+ public <T extends .java.lang.Object>T[] toArray(final T[] arg0) {
+ return this.collection.<T>toArray(arg0);
+ }
+
+ @java.lang.SuppressWarnings("all")
+ public boolean remove(final java.lang.Object arg0) {
+ return this.collection.remove(arg0);
+ }
+
+ @java.lang.SuppressWarnings("all")
+ public boolean containsAll(final java.util.Collection<?> arg0) {
+ return this.collection.containsAll(arg0);
+ }
+
+ @java.lang.SuppressWarnings("all")
+ public boolean removeAll(final java.util.Collection<?> arg0) {
+ return this.collection.removeAll(arg0);
+ }
+
+ @java.lang.SuppressWarnings("all")
+ public boolean retainAll(final java.util.Collection<?> arg0) {
+ return this.collection.retainAll(arg0);
+ }
+
+ @java.lang.SuppressWarnings("all")
+ public void clear() {
+ this.collection.clear();
+ }
+}
diff --git a/website/usageExamples/experimental/DelegateExample_pre.jpage b/website/usageExamples/experimental/DelegateExample_pre.jpage
new file mode 100644
index 00000000..885ab3a8
--- /dev/null
+++ b/website/usageExamples/experimental/DelegateExample_pre.jpage
@@ -0,0 +1,37 @@
+import java.util.ArrayList;
+import java.util.Collection;
+
+import lombok.experimental.Delegate;
+
+public class DelegationExample {
+ private interface SimpleCollection {
+ boolean add(String item);
+ boolean remove(Object item);
+ }
+
+ @Delegate(types=SimpleCollection.class)
+ private final Collection<String> collection = new ArrayList<String>();
+}
+
+
+class ExcludesDelegateExample {
+ long counter = 0L;
+
+ private interface Add {
+ boolean add(String x);
+ boolean addAll(Collection<? extends String> x);
+ }
+
+ @Delegate(excludes=Add.class)
+ private final Collection<String> collection = new ArrayList<String>();
+
+ public boolean add(String item) {
+ counter++;
+ return collection.add(item);
+ }
+
+ public boolean addAll(Collection<? extends String> col) {
+ counter += col.size();
+ return collection.addAll(col);
+ }
+}
diff --git a/website/usageExamples/experimental/ExtensionMethodExample_post.jpage b/website/usageExamples/experimental/ExtensionMethodExample_post.jpage
new file mode 100644
index 00000000..de46d776
--- /dev/null
+++ b/website/usageExamples/experimental/ExtensionMethodExample_post.jpage
@@ -0,0 +1,21 @@
+public class ExtensionMethodExample {
+ public String test() {
+ int[] intArray = {5, 3, 8, 2};
+ java.util.Arrays.sort(intArray);
+
+ String iAmNull = null;
+ return Extensions.or(iAmNull, Extensions.toTitleCase("hELlO, WORlD!"));
+ }
+}
+
+class Extensions {
+ public static <T> T or(T obj, T ifNull) {
+ return obj != null ? obj : ifNull;
+ }
+
+ public static String toTitleCase(String in) {
+ if (in.isEmpty()) return in;
+ return "" + Character.toTitleCase(in.charAt(0)) +
+ in.substring(1).toLowerCase();
+ }
+}
diff --git a/website/usageExamples/experimental/ExtensionMethodExample_pre.jpage b/website/usageExamples/experimental/ExtensionMethodExample_pre.jpage
new file mode 100644
index 00000000..b3b9f1fa
--- /dev/null
+++ b/website/usageExamples/experimental/ExtensionMethodExample_pre.jpage
@@ -0,0 +1,24 @@
+import lombok.experimental.ExtensionMethod;
+
+@ExtensionMethod({java.util.Arrays.class, Extensions.class})
+public class ExtensionMethodExample {
+ public String test() {
+ int[] intArray = {5, 3, 8, 2};
+ intArray.sort();
+
+ String iAmNull = null;
+ return iAmNull.or("hELlO, WORlD!".toTitleCase());
+ }
+}
+
+class Extensions {
+ public static <T> T or(T obj, T ifNull) {
+ return obj != null ? obj : ifNull;
+ }
+
+ public static String toTitleCase(String in) {
+ if (in.isEmpty()) return in;
+ return "" + Character.toTitleCase(in.charAt(0)) +
+ in.substring(1).toLowerCase();
+ }
+}
diff --git a/website/usageExamples/experimental/FieldDefaultsExample_post.jpage b/website/usageExamples/experimental/FieldDefaultsExample_post.jpage
new file mode 100644
index 00000000..95c17a4b
--- /dev/null
+++ b/website/usageExamples/experimental/FieldDefaultsExample_post.jpage
@@ -0,0 +1,12 @@
+public class FieldDefaultsExample {
+ public final int a;
+ private final int b;
+ private int c;
+ final int d;
+
+ FieldDefaultsExample() {
+ a = 0;
+ b = 0;
+ d = 0;
+ }
+}
diff --git a/website/usageExamples/experimental/FieldDefaultsExample_pre.jpage b/website/usageExamples/experimental/FieldDefaultsExample_pre.jpage
new file mode 100644
index 00000000..c8335832
--- /dev/null
+++ b/website/usageExamples/experimental/FieldDefaultsExample_pre.jpage
@@ -0,0 +1,18 @@
+import lombok.AccessLevel;
+import lombok.experimental.FieldDefaults;
+import lombok.experimental.NonFinal;
+import lombok.experimental.PackagePrivate;
+
+@FieldDefaults(makeFinal=true, level=AccessLevel.PRIVATE)
+public class FieldDefaultsExample {
+ public final int a;
+ int b;
+ @NonFinal int c;
+ @PackagePrivate int d;
+
+ FieldDefaultsExample() {
+ a = 0;
+ b = 0;
+ d = 0;
+ }
+}
diff --git a/website/usageExamples/experimental/HelperExample_post.jpage b/website/usageExamples/experimental/HelperExample_post.jpage
new file mode 100644
index 00000000..04a97b9f
--- /dev/null
+++ b/website/usageExamples/experimental/HelperExample_post.jpage
@@ -0,0 +1,14 @@
+public class HelperExample {
+ int someMethod(int arg1) {
+ int localVar = 5;
+
+ class Helpers {
+ int helperMethod(int arg) {
+ return arg + localVar;
+ }
+ }
+ Helpers $Helpers = new Helpers();
+
+ return $Helpers.helperMethod(10);
+ }
+}
diff --git a/website/usageExamples/experimental/HelperExample_pre.jpage b/website/usageExamples/experimental/HelperExample_pre.jpage
new file mode 100644
index 00000000..cd86ef3c
--- /dev/null
+++ b/website/usageExamples/experimental/HelperExample_pre.jpage
@@ -0,0 +1,15 @@
+import lombok.experimental.Helper;
+
+public class HelperExample {
+ int someMethod(int arg1) {
+ int localVar = 5;
+
+ @Helper class Helpers {
+ int helperMethod(int arg) {
+ return arg + localVar;
+ }
+ }
+
+ return helperMethod(10);
+ }
+}
diff --git a/website/usageExamples/experimental/UtilityClassExample_post.jpage b/website/usageExamples/experimental/UtilityClassExample_post.jpage
new file mode 100644
index 00000000..70810230
--- /dev/null
+++ b/website/usageExamples/experimental/UtilityClassExample_post.jpage
@@ -0,0 +1,11 @@
+public final class UtilityClassExample {
+ private static final int CONSTANT = 5;
+
+ private UtilityClassExample() {
+ throw new java.lang.UnsupportedOperationException("This is a utility class and cannot be instantiated");
+ }
+
+ public static void addSomething(int in) {
+ return in + CONSTANT;
+ }
+}
diff --git a/website/usageExamples/experimental/UtilityClassExample_pre.jpage b/website/usageExamples/experimental/UtilityClassExample_pre.jpage
new file mode 100644
index 00000000..85731b81
--- /dev/null
+++ b/website/usageExamples/experimental/UtilityClassExample_pre.jpage
@@ -0,0 +1,10 @@
+import lombok.experimental.UtilityClass;
+
+@UtilityClass
+public class UtilityClassExample {
+ private final int CONSTANT = 5;
+
+ public void addSomething(int in) {
+ return in + CONSTANT;
+ }
+}
diff --git a/website/usageExamples/experimental/WitherExample_post.jpage b/website/usageExamples/experimental/WitherExample_post.jpage
new file mode 100644
index 00000000..bb5952af
--- /dev/null
+++ b/website/usageExamples/experimental/WitherExample_post.jpage
@@ -0,0 +1,21 @@
+import lombok.NonNull;
+
+public class WitherExample {
+ private final int age;
+ private @NonNull final String name;
+
+ public WitherExample(String name, int age) {
+ if (name == null) throw new NullPointerException();
+ this.name = name;
+ this.age = age;
+ }
+
+ public WitherExample withAge(int age) {
+ return this.age == age ? this : new WitherExample(age, name);
+ }
+
+ protected WitherExample withName(@NonNull String name) {
+ if (name == null) throw new java.lang.NullPointerException("name");
+ return this.name == name ? this : new WitherExample(age, name);
+ }
+} \ No newline at end of file
diff --git a/website/usageExamples/experimental/WitherExample_pre.jpage b/website/usageExamples/experimental/WitherExample_pre.jpage
new file mode 100644
index 00000000..5db799fc
--- /dev/null
+++ b/website/usageExamples/experimental/WitherExample_pre.jpage
@@ -0,0 +1,14 @@
+import lombok.AccessLevel;
+import lombok.NonNull;
+import lombok.experimental.Wither;
+
+public class WitherExample {
+ @Wither private final int age;
+ @Wither(AccessLevel.PROTECTED) @NonNull private final String name;
+
+ public WitherExample(String name, int age) {
+ if (name == null) throw new NullPointerException();
+ this.name = name;
+ this.age = age;
+ }
+}
diff --git a/website/usageExamples/experimental/onXExample_post.jpage b/website/usageExamples/experimental/onXExample_post.jpage
new file mode 100644
index 00000000..1be94f2a
--- /dev/null
+++ b/website/usageExamples/experimental/onXExample_post.jpage
@@ -0,0 +1,22 @@
+import javax.inject.Inject;
+import javax.persistence.Id;
+import javax.persistence.Column;
+import javax.validation.constraints.Max;
+
+public class OnXExample {
+ private long unid;
+
+ @Inject
+ public OnXExample(long unid) {
+ this.unid = unid;
+ }
+
+ @Id @Column(name="unique-id")
+ public long getUnid() {
+ return unid;
+ }
+
+ public void setUnid(@Max(10000) long unid) {
+ this.unid = unid;
+ }
+}
diff --git a/website/usageExamples/experimental/onXExample_pre.jpage b/website/usageExamples/experimental/onXExample_pre.jpage
new file mode 100644
index 00000000..f8fcb435
--- /dev/null
+++ b/website/usageExamples/experimental/onXExample_pre.jpage
@@ -0,0 +1,15 @@
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.inject.Inject;
+import javax.persistence.Id;
+import javax.persistence.Column;
+import javax.validation.constraints.Max;
+
+@AllArgsConstructor(onConstructor=@__(@Inject))
+public class OnXExample {
+ @Getter(onMethod=@__({@Id, @Column(name="unique-id")}))
+ @Setter(onParam=@__(@Max(10000)))
+ private long unid;
+}
diff --git a/website/usageExamples/valExample_post.jpage b/website/usageExamples/valExample_post.jpage
new file mode 100644
index 00000000..fa2e852e
--- /dev/null
+++ b/website/usageExamples/valExample_post.jpage
@@ -0,0 +1,21 @@
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+public class ValExample {
+ public String example() {
+ final ArrayList<String> example = new ArrayList<String>();
+ example.add("Hello, World!");
+ final String foo = example.get(0);
+ return foo.toLowerCase();
+ }
+
+ public void example2() {
+ final HashMap<Integer, String> map = new HashMap<Integer, String>();
+ map.put(0, "zero");
+ map.put(5, "five");
+ for (final Map.Entry<Integer, String> entry : map.entrySet()) {
+ System.out.printf("%d: %s\n", entry.getKey(), entry.getValue());
+ }
+ }
+}
diff --git a/website/usageExamples/valExample_pre.jpage b/website/usageExamples/valExample_pre.jpage
new file mode 100644
index 00000000..a621640f
--- /dev/null
+++ b/website/usageExamples/valExample_pre.jpage
@@ -0,0 +1,21 @@
+import java.util.ArrayList;
+import java.util.HashMap;
+import lombok.val;
+
+public class ValExample {
+ public String example() {
+ val example = new ArrayList<String>();
+ example.add("Hello, World!");
+ val foo = example.get(0);
+ return foo.toLowerCase();
+ }
+
+ public void example2() {
+ val map = new HashMap<Integer, String>();
+ map.put(0, "zero");
+ map.put(5, "five");
+ for (val entry : map.entrySet()) {
+ System.out.printf("%d: %s\n", entry.getKey(), entry.getValue());
+ }
+ }
+}