-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fix] Alias 'valueOf' generation validates nested aliases recursively (…
…#352) Certain nested aliases no longer result in Java which cannot compile.
- Loading branch information
1 parent
ecdf838
commit 671bb6e
Showing
7 changed files
with
241 additions
and
12 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
conjure-java-core/src/integrationInput/java/com/palantir/product/BinaryAliasOne.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,44 @@ | ||
package com.palantir.product; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonValue; | ||
import com.palantir.conjure.java.lib.Bytes; | ||
import java.util.Objects; | ||
import javax.annotation.Generated; | ||
|
||
@Generated("com.palantir.conjure.java.types.AliasGenerator") | ||
public final class BinaryAliasOne { | ||
private final Bytes value; | ||
|
||
private BinaryAliasOne(Bytes value) { | ||
Objects.requireNonNull(value, "value cannot be null"); | ||
this.value = value; | ||
} | ||
|
||
@JsonValue | ||
public Bytes get() { | ||
return value; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return value.toString(); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object other) { | ||
return this == other | ||
|| (other instanceof BinaryAliasOne | ||
&& this.value.equals(((BinaryAliasOne) other).value)); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return value.hashCode(); | ||
} | ||
|
||
@JsonCreator | ||
public static BinaryAliasOne of(Bytes value) { | ||
return new BinaryAliasOne(value); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
conjure-java-core/src/integrationInput/java/com/palantir/product/BinaryAliasTwo.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,43 @@ | ||
package com.palantir.product; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonValue; | ||
import java.util.Objects; | ||
import javax.annotation.Generated; | ||
|
||
@Generated("com.palantir.conjure.java.types.AliasGenerator") | ||
public final class BinaryAliasTwo { | ||
private final BinaryAliasOne value; | ||
|
||
private BinaryAliasTwo(BinaryAliasOne value) { | ||
Objects.requireNonNull(value, "value cannot be null"); | ||
this.value = value; | ||
} | ||
|
||
@JsonValue | ||
public BinaryAliasOne get() { | ||
return value; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return value.toString(); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object other) { | ||
return this == other | ||
|| (other instanceof BinaryAliasTwo | ||
&& this.value.equals(((BinaryAliasTwo) other).value)); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return value.hashCode(); | ||
} | ||
|
||
@JsonCreator | ||
public static BinaryAliasTwo of(BinaryAliasOne value) { | ||
return new BinaryAliasTwo(value); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
conjure-java-core/src/integrationInput/java/com/palantir/product/StringAliasOne.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,47 @@ | ||
package com.palantir.product; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonValue; | ||
import java.util.Objects; | ||
import javax.annotation.Generated; | ||
|
||
@Generated("com.palantir.conjure.java.types.AliasGenerator") | ||
public final class StringAliasOne { | ||
private final String value; | ||
|
||
private StringAliasOne(String value) { | ||
Objects.requireNonNull(value, "value cannot be null"); | ||
this.value = value; | ||
} | ||
|
||
@JsonValue | ||
public String get() { | ||
return value; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return value.toString(); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object other) { | ||
return this == other | ||
|| (other instanceof StringAliasOne | ||
&& this.value.equals(((StringAliasOne) other).value)); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return value.hashCode(); | ||
} | ||
|
||
public static StringAliasOne valueOf(String value) { | ||
return new StringAliasOne(value); | ||
} | ||
|
||
@JsonCreator | ||
public static StringAliasOne of(String value) { | ||
return new StringAliasOne(value); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
conjure-java-core/src/integrationInput/java/com/palantir/product/StringAliasThree.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,43 @@ | ||
package com.palantir.product; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonValue; | ||
import java.util.Objects; | ||
import javax.annotation.Generated; | ||
|
||
@Generated("com.palantir.conjure.java.types.AliasGenerator") | ||
public final class StringAliasThree { | ||
private final StringAliasTwo value; | ||
|
||
private StringAliasThree(StringAliasTwo value) { | ||
Objects.requireNonNull(value, "value cannot be null"); | ||
this.value = value; | ||
} | ||
|
||
@JsonValue | ||
public StringAliasTwo get() { | ||
return value; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return value.toString(); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object other) { | ||
return this == other | ||
|| (other instanceof StringAliasThree | ||
&& this.value.equals(((StringAliasThree) other).value)); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return value.hashCode(); | ||
} | ||
|
||
@JsonCreator | ||
public static StringAliasThree of(StringAliasTwo value) { | ||
return new StringAliasThree(value); | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
conjure-java-core/src/integrationInput/java/com/palantir/product/StringAliasTwo.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,44 @@ | ||
package com.palantir.product; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonValue; | ||
import java.util.Objects; | ||
import java.util.Optional; | ||
import javax.annotation.Generated; | ||
|
||
@Generated("com.palantir.conjure.java.types.AliasGenerator") | ||
public final class StringAliasTwo { | ||
private final Optional<StringAliasOne> value; | ||
|
||
private StringAliasTwo(Optional<StringAliasOne> value) { | ||
Objects.requireNonNull(value, "value cannot be null"); | ||
this.value = value; | ||
} | ||
|
||
@JsonValue | ||
public Optional<StringAliasOne> get() { | ||
return value; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return value.toString(); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object other) { | ||
return this == other | ||
|| (other instanceof StringAliasTwo | ||
&& this.value.equals(((StringAliasTwo) other).value)); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return value.hashCode(); | ||
} | ||
|
||
@JsonCreator | ||
public static StringAliasTwo of(Optional<StringAliasOne> value) { | ||
return new StringAliasTwo(value); | ||
} | ||
} |
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