1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package de.kaiserpfalzedv.services.dnb.client;
19
20 import java.io.IOException;
21 import java.lang.reflect.Type;
22 import java.util.List;
23
24 import org.springframework.stereotype.Service;
25
26 import de.kaiserpfalzedv.services.dnb.marcxml.MarcConverter;
27 import de.kaiserpfalzedv.services.dnb.model.Book;
28 import feign.FeignException;
29 import feign.Response;
30 import feign.codec.DecodeException;
31 import feign.codec.Decoder;
32 import jakarta.inject.Inject;
33 import lombok.RequiredArgsConstructor;
34
35
36
37
38
39
40
41 @Service
42 @RequiredArgsConstructor(onConstructor = @__(@Inject))
43 public class Marc21Decoder implements Decoder {
44
45 private final MarcConverter converter;
46
47 @Override
48 public Object decode(final Response response, final Type type) throws IOException, DecodeException, FeignException {
49 return this.converter.convert(response.body().asInputStream());
50 }
51 }