1
1
/*
2
- * Copyright 2019 the original author or authors.
2
+ * Copyright 2019-2023 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
35
35
import org .springframework .core .io .Resource ;
36
36
import org .springframework .lang .Nullable ;
37
37
import org .springframework .util .Assert ;
38
+ import org .springframework .util .ClassUtils ;
38
39
39
40
/**
40
41
* An {@link ItemReader} that deserializes data from a {@link Resource} containing
41
42
* serialized Avro objects.
42
43
*
43
44
* @author David Turanski
44
45
* @author Mahmoud Ben Hassine
46
+ * @author Song JaeGeun
45
47
* @since 4.2
46
48
*/
47
49
public class AvroItemReader <T > extends AbstractItemCountingItemStreamItemReader <T > {
@@ -61,6 +63,8 @@ public class AvroItemReader<T> extends AbstractItemCountingItemStreamItemReader<
61
63
* @param clazz the data type to be deserialized.
62
64
*/
63
65
public AvroItemReader (Resource resource , Class <T > clazz ) {
66
+ setName (ClassUtils .getShortName (AvroItemReader .class ));
67
+
64
68
Assert .notNull (resource , "'resource' is required." );
65
69
Assert .notNull (clazz , "'class' is required." );
66
70
@@ -78,6 +82,8 @@ public AvroItemReader(Resource resource, Class<T> clazz) {
78
82
* @param schema the {@link Resource} containing the Avro schema.
79
83
*/
80
84
public AvroItemReader (Resource data , Resource schema ) {
85
+ setName (ClassUtils .getShortName (AvroItemReader .class ));
86
+
81
87
Assert .notNull (data , "'data' is required." );
82
88
Assert .state (data .exists (), "'data' " + data .getFilename () + " does not exist." );
83
89
Assert .notNull (schema , "'schema' is required" );
0 commit comments