Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor third party builder discovery.
This helps discover the builder methods which can be on value, or builder, and discovered in multiple orders.
- Loading branch information
Showing
12 changed files
with
529 additions
and
192 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
35 changes: 35 additions & 0 deletions
35
...g/immutables/fixture/builder/attribute_builders/ThirdPartyImmutableWithNestedBuilder.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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package org.immutables.fixture.builder.attribute_builders; | ||
|
||
public class ThirdPartyImmutableWithNestedBuilder { | ||
|
||
private final String value; | ||
|
||
private ThirdPartyImmutableWithNestedBuilder(String value) { | ||
this.value = value; | ||
} | ||
|
||
public String getValue() { | ||
return value; | ||
} | ||
|
||
public static class Builder { | ||
|
||
private String value; | ||
|
||
public Builder() { | ||
} | ||
|
||
public Builder(ThirdPartyImmutableWithNestedBuilder copy) { | ||
this.value = copy.getValue(); | ||
} | ||
|
||
public Builder setValue(String value) { | ||
this.value = value; | ||
return this; | ||
} | ||
|
||
public ThirdPartyImmutableWithNestedBuilder doTheBuild() { | ||
return new ThirdPartyImmutableWithNestedBuilder(value); | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
value-fixture/src/org/immutables/fixture/builder/detection/NestedDetection.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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package org.immutables.fixture.builder.detection; | ||
|
||
import org.immutables.fixture.builder.attribute_builders.ThirdPartyImmutableWithNestedBuilder; | ||
|
||
public interface NestedDetection { | ||
ThirdPartyImmutableWithNestedBuilder getThirdParty(); | ||
} |
12 changes: 12 additions & 0 deletions
12
...-fixture/src/org/immutables/fixture/builder/detection/NewTokenAttributeBuilderParent.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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.immutables.fixture.builder.detection; | ||
|
||
import org.immutables.value.Value.Immutable; | ||
import org.immutables.value.Value.Style; | ||
|
||
@Immutable | ||
@Style( | ||
attributeBuilderDetection = true, | ||
attributeBuilder = {"*Builder", "builder", "new"} | ||
) | ||
public abstract class NewTokenAttributeBuilderParent implements NestedDetection{ | ||
} |
12 changes: 12 additions & 0 deletions
12
...ixture/src/org/immutables/fixture/builder/detection/NoNewTokenAttributeBuilderParent.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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.immutables.fixture.builder.detection; | ||
|
||
import org.immutables.value.Value.Immutable; | ||
import org.immutables.value.Value.Style; | ||
|
||
@Immutable | ||
@Style( | ||
attributeBuilderDetection = true, | ||
attributeBuilder = {"*Builder", "builder"} | ||
) | ||
public abstract class NoNewTokenAttributeBuilderParent implements NestedDetection { | ||
} |
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
Oops, something went wrong.