Skip to content

Commit

Permalink
LazilyInitializedEncoding overrides overloads with Endpoint (#2168)
Browse files Browse the repository at this point in the history
LazilyInitializedEncoding overrides overloads with Endpoint
  • Loading branch information
carterkozak authored Jan 16, 2024
1 parent 05c5461 commit 5dd1783
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.palantir.conjure.java.undertow.runtime;

import com.google.common.base.Suppliers;
import com.palantir.conjure.java.undertow.lib.Endpoint;
import com.palantir.conjure.java.undertow.lib.TypeMarker;
import com.palantir.logsafe.Preconditions;
import java.io.IOException;
Expand Down Expand Up @@ -45,11 +46,21 @@ public <T> Serializer<T> serializer(TypeMarker<T> type) {
return new LazilyInitializedSerializer<>(() -> delegate.serializer(type));
}

@Override
public <T> Serializer<T> serializer(TypeMarker<T> type, Endpoint endpoint) {
return new LazilyInitializedSerializer<>(() -> delegate.serializer(type, endpoint));
}

@Override
public <T> Deserializer<T> deserializer(TypeMarker<T> type) {
return new LazilyInitializedDeserializer<>(() -> delegate.deserializer(type));
}

@Override
public <T> Deserializer<T> deserializer(TypeMarker<T> type, Endpoint endpoint) {
return new LazilyInitializedDeserializer<>(() -> delegate.deserializer(type, endpoint));
}

@Override
public String getContentType() {
return delegate.getContentType();
Expand Down Expand Up @@ -77,6 +88,11 @@ private static final class LazilyInitializedSerializer<T> implements Serializer<
public void serialize(T value, OutputStream output) throws IOException {
delegate.get().serialize(value, output);
}

@Override
public String toString() {
return "LazilyInitializedSerializer{" + delegate + '}';
}
}

private static final class LazilyInitializedDeserializer<T> implements Deserializer<T> {
Expand All @@ -91,5 +107,10 @@ private static final class LazilyInitializedDeserializer<T> implements Deseriali
public T deserialize(InputStream input) throws IOException {
return delegate.get().deserialize(input);
}

@Override
public String toString() {
return "LazilyInitializedDeserializer{" + delegate + '}';
}
}
}

0 comments on commit 5dd1783

Please sign in to comment.