PROX-364: implements Deserizlizer

This commit is contained in:
avcherkasov 2019-11-05 15:03:12 +03:00
parent e018fa1882
commit 1023782315
2 changed files with 13 additions and 29 deletions

View File

@ -2,17 +2,21 @@ package com.rbkmoney.adapter.cashreg.spring.boot.starter.state.deserializer;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.rbkmoney.adapter.cashreg.spring.boot.starter.model.AdapterState;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import org.springframework.stereotype.Component;
import java.io.IOException;
@Getter
@Setter
@Component
public class AdapterDeserializer extends StateDeserializer<AdapterState> {
@AllArgsConstructor
public class AdapterDeserializer implements Deserializer<AdapterState> {
public AdapterDeserializer(ObjectMapper mapper) {
super(mapper);
}
private final ObjectMapper mapper;
public AdapterState read(byte[] data) {
if (data == null) {
@ -25,4 +29,9 @@ public class AdapterDeserializer extends StateDeserializer<AdapterState> {
}
}
@Override
public AdapterState read(String data) {
throw new RuntimeException("Not supported");
}
}

View File

@ -1,25 +0,0 @@
package com.rbkmoney.adapter.cashreg.spring.boot.starter.state.deserializer;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
public abstract class StateDeserializer<T> implements Deserializer<T> {
protected final ObjectMapper mapper;
@Override
public T read(byte[] data) {
throw new RuntimeException("Not supported");
}
@Override
public T read(String data) {
throw new RuntimeException("Not supported");
}
}