From 65b97f74af72f44fb1ae00869d9a00421a872701 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Mon, 12 Jan 2015 05:27:04 +0100 Subject: added singleton builder support for javac: guava lists and sets. --- .../BuilderSingletonGuavaListsSets.java | 92 ++++++++++++++++++++++ .../before/BuilderSingletonGuavaListsSets.java | 14 ++++ 2 files changed, 106 insertions(+) create mode 100644 test/transform/resource/after-delombok/BuilderSingletonGuavaListsSets.java create mode 100644 test/transform/resource/before/BuilderSingletonGuavaListsSets.java (limited to 'test/transform/resource') diff --git a/test/transform/resource/after-delombok/BuilderSingletonGuavaListsSets.java b/test/transform/resource/after-delombok/BuilderSingletonGuavaListsSets.java new file mode 100644 index 00000000..d6b44b12 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderSingletonGuavaListsSets.java @@ -0,0 +1,92 @@ +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableCollection; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.ImmutableSortedSet; +class BuilderSingletonGuavaListsSets { + private ImmutableList cards; + private ImmutableCollection frogs; + private ImmutableSet rawSet; + private ImmutableSortedSet passes; + @java.lang.SuppressWarnings("all") + BuilderSingletonGuavaListsSets(final ImmutableList cards, final ImmutableCollection frogs, final ImmutableSet rawSet, final ImmutableSortedSet passes) { + this.cards = cards; + this.frogs = frogs; + this.rawSet = rawSet; + this.passes = passes; + } + @java.lang.SuppressWarnings("all") + public static class BuilderSingletonGuavaListsSetsBuilder { + private com.google.common.collect.ImmutableList.Builder cards; + private com.google.common.collect.ImmutableList.Builder frogs; + private com.google.common.collect.ImmutableSet.Builder rawSet; + private com.google.common.collect.ImmutableSortedSet.Builder passes; + @java.lang.SuppressWarnings("all") + BuilderSingletonGuavaListsSetsBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderSingletonGuavaListsSetsBuilder card(final T card) { + if (this.cards == null) this.cards = com.google.common.collect.ImmutableList.builder(); + this.cards.add(card); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingletonGuavaListsSetsBuilder cards(final java.lang.Iterable cards) { + if (this.cards == null) this.cards = com.google.common.collect.ImmutableList.builder(); + this.cards.addAll(cards); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingletonGuavaListsSetsBuilder frog(final Number frog) { + if (this.frogs == null) this.frogs = com.google.common.collect.ImmutableList.builder(); + this.frogs.add(frog); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingletonGuavaListsSetsBuilder frogs(final java.lang.Iterable frogs) { + if (this.frogs == null) this.frogs = com.google.common.collect.ImmutableList.builder(); + this.frogs.addAll(frogs); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingletonGuavaListsSetsBuilder rawSet(final java.lang.Object rawSet) { + if (this.rawSet == null) this.rawSet = com.google.common.collect.ImmutableSet.builder(); + this.rawSet.add(rawSet); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingletonGuavaListsSetsBuilder rawSet(final java.lang.Iterable rawSet) { + if (this.rawSet == null) this.rawSet = com.google.common.collect.ImmutableSet.builder(); + this.rawSet.addAll(rawSet); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingletonGuavaListsSetsBuilder pass(final String pass) { + if (this.passes == null) this.passes = com.google.common.collect.ImmutableSortedSet.naturalOrder(); + this.passes.add(pass); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingletonGuavaListsSetsBuilder passes(final java.lang.Iterable passes) { + if (this.passes == null) this.passes = com.google.common.collect.ImmutableSortedSet.naturalOrder(); + this.passes.addAll(passes); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingletonGuavaListsSets build() { + com.google.common.collect.ImmutableList cards = this.cards == null ? com.google.common.collect.ImmutableList.of() : this.cards.build(); + com.google.common.collect.ImmutableCollection frogs = this.frogs == null ? com.google.common.collect.ImmutableList.of() : this.frogs.build(); + com.google.common.collect.ImmutableSet rawSet = this.rawSet == null ? com.google.common.collect.ImmutableSet.of() : this.rawSet.build(); + com.google.common.collect.ImmutableSortedSet passes = this.passes == null ? com.google.common.collect.ImmutableSortedSet.of() : this.passes.build(); + return new BuilderSingletonGuavaListsSets(cards, frogs, rawSet, passes); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderSingletonGuavaListsSets.BuilderSingletonGuavaListsSetsBuilder(cards=" + this.cards + ", frogs=" + this.frogs + ", rawSet=" + this.rawSet + ", passes=" + this.passes + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderSingletonGuavaListsSetsBuilder builder() { + return new BuilderSingletonGuavaListsSetsBuilder(); + } +} \ No newline at end of file diff --git a/test/transform/resource/before/BuilderSingletonGuavaListsSets.java b/test/transform/resource/before/BuilderSingletonGuavaListsSets.java new file mode 100644 index 00000000..060d2903 --- /dev/null +++ b/test/transform/resource/before/BuilderSingletonGuavaListsSets.java @@ -0,0 +1,14 @@ +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableCollection; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.ImmutableSortedSet; + +import lombok.Singular; + +@lombok.Builder +class BuilderSingletonGuavaListsSets { + @Singular private ImmutableList cards; + @Singular private ImmutableCollection frogs; + @Singular("rawSet") private ImmutableSet rawSet; + @Singular private ImmutableSortedSet passes; +} -- cgit