Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .codegen.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "engineHash": "205c0e9", "specHash": "5bf3652", "version": "0.1.0" }
{ "engineHash": "41bba7c", "specHash": "9ccadb1", "version": "0.1.0" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
package com.box.sdkgen.schemas.v2025r0.userreferencev2025r0;

import com.box.sdkgen.internal.NullableFieldTracker;
import com.box.sdkgen.internal.SerializableObject;
import com.box.sdkgen.serialization.json.EnumWrapper;
import com.fasterxml.jackson.annotation.JsonFilter;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import java.util.Objects;

@JsonFilter("nullablePropertyFilter")
public class UserReferenceV2025R0 extends SerializableObject {

@JsonDeserialize(
using = UserReferenceV2025R0TypeField.UserReferenceV2025R0TypeFieldDeserializer.class)
@JsonSerialize(
using = UserReferenceV2025R0TypeField.UserReferenceV2025R0TypeFieldSerializer.class)
protected EnumWrapper<UserReferenceV2025R0TypeField> type;

protected final String id;

public UserReferenceV2025R0(@JsonProperty("id") String id) {
super();
this.id = id;
this.type = new EnumWrapper<UserReferenceV2025R0TypeField>(UserReferenceV2025R0TypeField.USER);
}

protected UserReferenceV2025R0(Builder builder) {
super();
this.type = builder.type;
this.id = builder.id;
markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
}

public EnumWrapper<UserReferenceV2025R0TypeField> getType() {
return type;
}

public String getId() {
return id;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
UserReferenceV2025R0 casted = (UserReferenceV2025R0) o;
return Objects.equals(type, casted.type) && Objects.equals(id, casted.id);
}

@Override
public int hashCode() {
return Objects.hash(type, id);
}

@Override
public String toString() {
return "UserReferenceV2025R0{" + "type='" + type + '\'' + ", " + "id='" + id + '\'' + "}";
}

public static class Builder extends NullableFieldTracker {

protected EnumWrapper<UserReferenceV2025R0TypeField> type;

protected final String id;

public Builder(String id) {
super();
this.id = id;
this.type =
new EnumWrapper<UserReferenceV2025R0TypeField>(UserReferenceV2025R0TypeField.USER);
}

public Builder type(UserReferenceV2025R0TypeField type) {
this.type = new EnumWrapper<UserReferenceV2025R0TypeField>(type);
return this;
}

public Builder type(EnumWrapper<UserReferenceV2025R0TypeField> type) {
this.type = type;
return this;
}

public UserReferenceV2025R0 build() {
return new UserReferenceV2025R0(this);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package com.box.sdkgen.schemas.v2025r0.userreferencev2025r0;

import com.box.sdkgen.serialization.json.EnumWrapper;
import com.box.sdkgen.serialization.json.Valuable;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import java.io.IOException;
import java.util.Arrays;

public enum UserReferenceV2025R0TypeField implements Valuable {
USER("user");

private final String value;

UserReferenceV2025R0TypeField(String value) {
this.value = value;
}

public String getValue() {
return value;
}

public static class UserReferenceV2025R0TypeFieldDeserializer
extends JsonDeserializer<EnumWrapper<UserReferenceV2025R0TypeField>> {

public UserReferenceV2025R0TypeFieldDeserializer() {
super();
}

@Override
public EnumWrapper<UserReferenceV2025R0TypeField> deserialize(
JsonParser p, DeserializationContext ctxt) throws IOException {
String value = p.getValueAsString();
return Arrays.stream(UserReferenceV2025R0TypeField.values())
.filter((v) -> v.getValue().equalsIgnoreCase(value))
.findFirst()
.map(EnumWrapper::new)
.orElse(new EnumWrapper<UserReferenceV2025R0TypeField>(value));
}
}

public static class UserReferenceV2025R0TypeFieldSerializer
extends JsonSerializer<EnumWrapper<UserReferenceV2025R0TypeField>> {

public UserReferenceV2025R0TypeFieldSerializer() {
super();
}

@Override
public void serialize(
EnumWrapper<UserReferenceV2025R0TypeField> value,
JsonGenerator gen,
SerializerProvider serializers)
throws IOException {
gen.writeString(value.getStringValue());
}
}
}
Loading