diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2018-04-10 00:12:24 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2018-04-10 00:23:49 +0200 |
commit | 57fb2b9773d96777ba343e28e5e2ae4d6fa96f42 (patch) | |
tree | 267a4d14f3ead6079d7383198a0705a675d7c9bd /usage_examples/experimental | |
parent | 4dce9a351d2e459fb2d03bdb9c99b62a2b29f8d0 (diff) | |
download | lombok-57fb2b9773d96777ba343e28e5e2ae4d6fa96f42.tar.gz lombok-57fb2b9773d96777ba343e28e5e2ae4d6fa96f42.tar.bz2 lombok-57fb2b9773d96777ba343e28e5e2ae4d6fa96f42.zip |
[website] Whoops we had 2 copies of usage_examples. Fixed that by deleting the one that was NOT being used for the website.
Diffstat (limited to 'usage_examples/experimental')
20 files changed, 0 insertions, 425 deletions
diff --git a/usage_examples/experimental/AccessorsExample_post.jpage b/usage_examples/experimental/AccessorsExample_post.jpage deleted file mode 100644 index ae5a39db..00000000 --- a/usage_examples/experimental/AccessorsExample_post.jpage +++ /dev/null @@ -1,20 +0,0 @@ -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/usage_examples/experimental/AccessorsExample_pre.jpage b/usage_examples/experimental/AccessorsExample_pre.jpage deleted file mode 100644 index f1591aba..00000000 --- a/usage_examples/experimental/AccessorsExample_pre.jpage +++ /dev/null @@ -1,14 +0,0 @@ -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/usage_examples/experimental/DelegateExample_post.jpage b/usage_examples/experimental/DelegateExample_post.jpage deleted file mode 100644 index 1c5239f1..00000000 --- a/usage_examples/experimental/DelegateExample_post.jpage +++ /dev/null @@ -1,97 +0,0 @@ -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/usage_examples/experimental/DelegateExample_pre.jpage b/usage_examples/experimental/DelegateExample_pre.jpage deleted file mode 100644 index 885ab3a8..00000000 --- a/usage_examples/experimental/DelegateExample_pre.jpage +++ /dev/null @@ -1,37 +0,0 @@ -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/usage_examples/experimental/ExtensionMethodExample_post.jpage b/usage_examples/experimental/ExtensionMethodExample_post.jpage deleted file mode 100644 index de46d776..00000000 --- a/usage_examples/experimental/ExtensionMethodExample_post.jpage +++ /dev/null @@ -1,21 +0,0 @@ -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/usage_examples/experimental/ExtensionMethodExample_pre.jpage b/usage_examples/experimental/ExtensionMethodExample_pre.jpage deleted file mode 100644 index b3b9f1fa..00000000 --- a/usage_examples/experimental/ExtensionMethodExample_pre.jpage +++ /dev/null @@ -1,24 +0,0 @@ -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/usage_examples/experimental/FieldDefaultsExample_post.jpage b/usage_examples/experimental/FieldDefaultsExample_post.jpage deleted file mode 100644 index 95c17a4b..00000000 --- a/usage_examples/experimental/FieldDefaultsExample_post.jpage +++ /dev/null @@ -1,12 +0,0 @@ -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/usage_examples/experimental/FieldDefaultsExample_pre.jpage b/usage_examples/experimental/FieldDefaultsExample_pre.jpage deleted file mode 100644 index c8335832..00000000 --- a/usage_examples/experimental/FieldDefaultsExample_pre.jpage +++ /dev/null @@ -1,18 +0,0 @@ -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/usage_examples/experimental/FieldNameConstantsExample_post.jpage b/usage_examples/experimental/FieldNameConstantsExample_post.jpage deleted file mode 100644 index 6300ed0e..00000000 --- a/usage_examples/experimental/FieldNameConstantsExample_post.jpage +++ /dev/null @@ -1,7 +0,0 @@ -public class FieldNameConstantsExample { - public static final String I_AM_A_FIELD = "iAmAField"; - static final String AND_SO_AM_I = "andSoAmI"; - - private final String iAmAField; - private final int andSoAmI; -} diff --git a/usage_examples/experimental/FieldNameConstantsExample_pre.jpage b/usage_examples/experimental/FieldNameConstantsExample_pre.jpage deleted file mode 100644 index dc6376eb..00000000 --- a/usage_examples/experimental/FieldNameConstantsExample_pre.jpage +++ /dev/null @@ -1,9 +0,0 @@ -import lombok.experimental.FieldNameConstants; -import lombok.AccessLevel; - -@FieldNameConstants -public class FieldNameConstantsExample { - private final String iAmAField; - @FieldNameConstants(level = AccessLevel.PACKAGE) - private final int andSoAmI; -} diff --git a/usage_examples/experimental/HelperExample_post.jpage b/usage_examples/experimental/HelperExample_post.jpage deleted file mode 100644 index 04a97b9f..00000000 --- a/usage_examples/experimental/HelperExample_post.jpage +++ /dev/null @@ -1,14 +0,0 @@ -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/usage_examples/experimental/HelperExample_pre.jpage b/usage_examples/experimental/HelperExample_pre.jpage deleted file mode 100644 index cd86ef3c..00000000 --- a/usage_examples/experimental/HelperExample_pre.jpage +++ /dev/null @@ -1,15 +0,0 @@ -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/usage_examples/experimental/UtilityClassExample_post.jpage b/usage_examples/experimental/UtilityClassExample_post.jpage deleted file mode 100644 index 70810230..00000000 --- a/usage_examples/experimental/UtilityClassExample_post.jpage +++ /dev/null @@ -1,11 +0,0 @@ -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/usage_examples/experimental/UtilityClassExample_pre.jpage b/usage_examples/experimental/UtilityClassExample_pre.jpage deleted file mode 100644 index 85731b81..00000000 --- a/usage_examples/experimental/UtilityClassExample_pre.jpage +++ /dev/null @@ -1,10 +0,0 @@ -import lombok.experimental.UtilityClass; - -@UtilityClass -public class UtilityClassExample { - private final int CONSTANT = 5; - - public void addSomething(int in) { - return in + CONSTANT; - } -} diff --git a/usage_examples/experimental/WitherExample_post.jpage b/usage_examples/experimental/WitherExample_post.jpage deleted file mode 100644 index 3447192a..00000000 --- a/usage_examples/experimental/WitherExample_post.jpage +++ /dev/null @@ -1,21 +0,0 @@ -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(name, age); - } - - protected WitherExample withName(@NonNull String name) { - if (name == null) throw new java.lang.NullPointerException("name"); - return this.name == name ? this : new WitherExample(name, age); - } -}
\ No newline at end of file diff --git a/usage_examples/experimental/WitherExample_pre.jpage b/usage_examples/experimental/WitherExample_pre.jpage deleted file mode 100644 index 5db799fc..00000000 --- a/usage_examples/experimental/WitherExample_pre.jpage +++ /dev/null @@ -1,14 +0,0 @@ -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/usage_examples/experimental/onXExample_post.jpage b/usage_examples/experimental/onXExample_post.jpage deleted file mode 100644 index 1be94f2a..00000000 --- a/usage_examples/experimental/onXExample_post.jpage +++ /dev/null @@ -1,22 +0,0 @@ -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/usage_examples/experimental/onXExample_pre.jpage b/usage_examples/experimental/onXExample_pre.jpage deleted file mode 100644 index e54371ae..00000000 --- a/usage_examples/experimental/onXExample_pre.jpage +++ /dev/null @@ -1,17 +0,0 @@ -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")})) //JDK7 -// @Setter(onParam=@__(@Max(10000))) //JDK7 - @Getter(onMethod_={@Id, @Column(name="unique-id")}) //JDK8 - @Setter(onParam_=@Max(10000)) //JDK8 - private long unid; -} diff --git a/usage_examples/experimental/varExample_post.jpage b/usage_examples/experimental/varExample_post.jpage deleted file mode 100644 index d0a7c124..00000000 --- a/usage_examples/experimental/varExample_post.jpage +++ /dev/null @@ -1,21 +0,0 @@ -import java.util.ArrayList; -import lombok.var; - -public class VarExample { - public String example() { - ArrayList<String> example = new ArrayList<String>(); - example.add("Hello, World!"); - final String foo = example.get(0); - return foo.toLowerCase(); - } - - public void example2() { - ArrayList<String> list = new ArrayList<String>(); - list.add("zero"); - list.add("one"); - list.add("two"); - for(int i = 0; i < list.size(); ++i) { - System.out.printf("%d: %s\n", i, list.get(i)); - } - } -} diff --git a/usage_examples/experimental/varExample_pre.jpage b/usage_examples/experimental/varExample_pre.jpage deleted file mode 100644 index e58c4c0d..00000000 --- a/usage_examples/experimental/varExample_pre.jpage +++ /dev/null @@ -1,21 +0,0 @@ -import java.util.ArrayList; -import lombok.var; - -public class VarExample { - public String example() { - var example = new ArrayList<String>(); - example.add("Hello, World!"); - final var foo = example.get(0); - return foo.toLowerCase(); - } - - public void example2() { - var list = new ArrayList<String>(); - list.add("zero"); - list.add("one"); - list.add("two"); - for(var i = 0; i < list.size(); ++i) { - System.out.printf("%d: %s\n", i, list.get(i)); - } - } -} |