class CloudJacksonJson extends LegacyJacksonJson {

	protected final CloudJacksonCodec codec = new CloudJacksonCodec();

	public CloudJacksonCodec getCodec() {
		return codec;
	}

	@Override
	public String codecName() {
		return getCodecName(LegacyJacksonJson.class);
	}

	@Override
	public <T> String encode(T object) {
		return this.codec.writeToString(object);
	}

	@Override
	public <T> void encode(T object, OutputStream outputStream) throws IOException {
		this.codec.writeTo(object, outputStream);
	}

	@Override
	public <T> T decode(String textValue, Class<T> type) throws IOException {
		return this.codec.readValue(type, textValue);
	}

	@Override
	public <T> T decode(InputStream inputStream, Class<T> type) throws IOException {
		return this.codec.readValue(type, inputStream);
	}

	static InstanceInfo updateIfNeeded(final InstanceInfo info) {<FILL_FUNCTION_BODY>}

	static class CloudJacksonCodec extends EurekaJacksonCodec {

		private static final Version VERSION = new Version(1, 1, 0, null, null, null);

		@SuppressWarnings("deprecation")
		CloudJacksonCodec() {
			super();

			ObjectMapper mapper = new ObjectMapper();
			mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);

			SimpleModule module = new SimpleModule("eureka1.x", VERSION);
			module.addSerializer(DataCenterInfo.class, new DataCenterInfoSerializer());
			module.addSerializer(InstanceInfo.class, new CloudInstanceInfoSerializer());
			module.addSerializer(Application.class, new ApplicationSerializer());
			module.addSerializer(Applications.class,
					new ApplicationsSerializer(this.getVersionDeltaKey(), this.getAppHashCodeKey()));

			// TODO: Watch if this causes problems
			// module.addDeserializer(DataCenterInfo.class,
			// new DataCenterInfoDeserializer());
			module.addDeserializer(LeaseInfo.class, new LeaseInfoDeserializer());
			module.addDeserializer(InstanceInfo.class, new CloudInstanceInfoDeserializer(mapper));
			module.addDeserializer(Application.class, new ApplicationDeserializer(mapper));
			module.addDeserializer(Applications.class,
					new ApplicationsDeserializer(mapper, this.getVersionDeltaKey(), this.getAppHashCodeKey()));

			mapper.registerModule(module);

			HashMap<Class<?>, Supplier<ObjectReader>> readers = new HashMap<>();
			readers.put(InstanceInfo.class,
					() -> mapper.reader().withType(InstanceInfo.class).withRootName("instance"));
			readers.put(Application.class,
					() -> mapper.reader().withType(Application.class).withRootName("application"));
			readers.put(Applications.class,
					() -> mapper.reader().withType(Applications.class).withRootName("applications"));
			setField("objectReaderByClass", readers);

			HashMap<Class<?>, ObjectWriter> writers = new HashMap<>();
			writers.put(InstanceInfo.class, mapper.writer().withType(InstanceInfo.class).withRootName("instance"));
			writers.put(Application.class, mapper.writer().withType(Application.class).withRootName("application"));
			writers.put(Applications.class, mapper.writer().withType(Applications.class).withRootName("applications"));
			setField("objectWriterByClass", writers);

			setField("mapper", mapper);
		}

		void setField(String name, Object value) {
			Field field = ReflectionUtils.findField(EurekaJacksonCodec.class, name);
			ReflectionUtils.makeAccessible(field);
			ReflectionUtils.setField(field, this, value);
		}

	}

	static class CloudInstanceInfoSerializer extends InstanceInfoSerializer {

		@Override
		public void serialize(final InstanceInfo info, JsonGenerator jgen, SerializerProvider provider)
				throws IOException {

			InstanceInfo updated = updateIfNeeded(info);
			super.serialize(updated, jgen, provider);
		}

	}

	static class CloudInstanceInfoDeserializer extends InstanceInfoDeserializer {

		protected CloudInstanceInfoDeserializer(ObjectMapper mapper) {
			super(mapper);
		}

		@Override
		public InstanceInfo deserialize(JsonParser jp, DeserializationContext context) throws IOException {
			InstanceInfo info = super.deserialize(jp, context);
			InstanceInfo updated = updateIfNeeded(info);
			return updated;
		}

	}

}

		if (info.getInstanceId() == null && info.getMetadata() != null) {
			String instanceId = info.getMetadata().get("instanceId");
			if (StringUtils.hasText(instanceId)) {
				// backwards compatibility for Angel
				if (StringUtils.hasText(info.getHostName()) && !instanceId.startsWith(info.getHostName())) {
					instanceId = info.getHostName() + ":" + instanceId;
				}
				return new InstanceInfo.Builder(info).setInstanceId(instanceId).build();
			}
		}
		return info;
	
<methods>public void <init>() ,public java.lang.String codecName() ,public T decode(java.lang.String, Class<T>) throws java.io.IOException,public T decode(java.io.InputStream, Class<T>) throws java.io.IOException,public java.lang.String encode(T) throws java.io.IOException,public void encode(T, java.io.OutputStream) throws java.io.IOException,public boolean support(jakarta.ws.rs.core.MediaType) <variables>protected final com.netflix.discovery.converters.EurekaJacksonCodec codec