public EurekaJacksonCodec(String versionDeltaKey, String appsHashCodeKey) { this.versionDeltaKey = versionDeltaKey; this.appHashCodeKey = appsHashCodeKey; this.mapper = new ObjectMapper(); this.mapper.setSerializationInclusion(Include.NON_NULL); SimpleModule module = new SimpleModule("eureka1.x", VERSION); module.addSerializer(DataCenterInfo.class, new DataCenterInfoSerializer()); module.addSerializer(InstanceInfo.class, new InstanceInfoSerializer()); module.addSerializer(Application.class, new ApplicationSerializer()); module.addSerializer(Applications.class, new ApplicationsSerializer(this.versionDeltaKey, this.appHashCodeKey)); module.addDeserializer(LeaseInfo.class, new LeaseInfoDeserializer()); module.addDeserializer(InstanceInfo.class, new InstanceInfoDeserializer(this.mapper)); module.addDeserializer(Application.class, new ApplicationDeserializer(this.mapper)); module.addDeserializer(Applications.class, new ApplicationsDeserializer(this.mapper, this.versionDeltaKey, this.appHashCodeKey)); this.mapper.registerModule(module); Map<Class<?>, Supplier<ObjectReader>> readers = new HashMap<>(); readers.put(InstanceInfo.class, ()->mapper.reader().forType(InstanceInfo.class).withRootName("instance")); readers.put(Application.class, ()->mapper.reader().forType(Application.class).withRootName("application")); readers.put(Applications.class, ()->mapper.reader().forType(Applications.class).withRootName("applications")); this.objectReaderByClass = readers; Map<Class<?>, ObjectWriter> writers = new HashMap<>(); writers.put(InstanceInfo.class, mapper.writer().forType(InstanceInfo.class).withRootName("instance")); writers.put(Application.class, mapper.writer().forType(Application.class).withRootName("application")); writers.put(Applications.class, mapper.writer().forType(Applications.class).withRootName("applications")); this.objectWriterByClass = writers; }
@SuppressWarnings("unchecked") protected THIS initReader(ObjectReader reader) { if (_activeView != null) { reader = reader.withView(_activeView); } if (_rootName != null) { reader = reader.withRootName(_rootName); } // Then deser features if (_deserEnable != null) { reader = reader.withFeatures(_deserEnable); } if (_deserDisable != null) { reader = reader.withoutFeatures(_deserDisable); } _reader = reader; return (THIS) this; }
public EurekaJacksonCodec(String versionDeltaKey, String appsHashCodeKey) { this.versionDeltaKey = versionDeltaKey; this.appHashCodeKey = appsHashCodeKey; this.mapper = new ObjectMapper(); this.mapper.setSerializationInclusion(Include.NON_NULL); SimpleModule module = new SimpleModule("eureka1.x", VERSION); module.addSerializer(DataCenterInfo.class, new DataCenterInfoSerializer()); module.addSerializer(InstanceInfo.class, new InstanceInfoSerializer()); module.addSerializer(Application.class, new ApplicationSerializer()); module.addSerializer(Applications.class, new ApplicationsSerializer(this.versionDeltaKey, this.appHashCodeKey)); module.addDeserializer(LeaseInfo.class, new LeaseInfoDeserializer()); module.addDeserializer(InstanceInfo.class, new InstanceInfoDeserializer(this.mapper)); module.addDeserializer(Application.class, new ApplicationDeserializer(this.mapper)); module.addDeserializer(Applications.class, new ApplicationsDeserializer(this.mapper, this.versionDeltaKey, this.appHashCodeKey)); this.mapper.registerModule(module); Map<Class<?>, Supplier<ObjectReader>> readers = new HashMap<>(); readers.put(InstanceInfo.class, ()->mapper.reader().forType(InstanceInfo.class).withRootName("instance")); readers.put(Application.class, ()->mapper.reader().forType(Application.class).withRootName("application")); readers.put(Applications.class, ()->mapper.reader().forType(Applications.class).withRootName("applications")); this.objectReaderByClass = readers; Map<Class<?>, ObjectWriter> writers = new HashMap<>(); writers.put(InstanceInfo.class, mapper.writer().forType(InstanceInfo.class).withRootName("instance")); writers.put(Application.class, mapper.writer().forType(Application.class).withRootName("application")); writers.put(Applications.class, mapper.writer().forType(Applications.class).withRootName("applications")); this.objectWriterByClass = writers; }
@SuppressWarnings("unchecked") protected THIS initReader(ObjectReader reader) { if (_activeView != null) { reader = reader.withView(_activeView); } if (_rootName != null) { reader = reader.withRootName(_rootName); } // Then deser features if (_deserEnable != null) { reader = reader.withFeatures(_deserEnable); } if (_deserDisable != null) { reader = reader.withoutFeatures(_deserDisable); } _reader = reader; return (THIS) this; }
@SuppressWarnings("unchecked") protected THIS initReader(ObjectReader reader) { if (_activeView != null) { reader = reader.withView(_activeView); } if (_rootName != null) { reader = reader.withRootName(_rootName); } // Then deser features if (_deserEnable != null) { reader = reader.withFeatures(_deserEnable); } if (_deserDisable != null) { reader = reader.withoutFeatures(_deserDisable); } _reader = reader; return (THIS) this; }
@SuppressWarnings("unchecked") protected THIS initReader(ObjectReader reader) { if (_activeView != null) { reader = reader.withView(_activeView); } if (_rootName != null) { reader = reader.withRootName(_rootName); } // Then deser features if (_deserEnable != null) { reader = reader.withFeatures(_deserEnable); } if (_deserDisable != null) { reader = reader.withoutFeatures(_deserDisable); } _reader = reader; return (THIS) this; }
@SuppressWarnings("unchecked") protected THIS initReader(ObjectReader reader) { if (_activeView != null) { reader = reader.withView(_activeView); } if (_rootName != null) { reader = reader.withRootName(_rootName); } // Then deser features if (_deserEnable != null) { reader = reader.withFeatures(_deserEnable); } if (_deserDisable != null) { reader = reader.withoutFeatures(_deserDisable); } _reader = reader; return (THIS) this; }
@SuppressWarnings("unchecked") protected THIS initReader(ObjectReader reader) { if (_activeView != null) { reader = reader.withView(_activeView); } if (_rootName != null) { reader = reader.withRootName(_rootName); } // Then deser features if (_deserEnable != null) { reader = reader.withFeatures(_deserEnable); } if (_deserDisable != null) { reader = reader.withoutFeatures(_deserDisable); } _reader = reader; return (THIS) this; }
.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);
.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);