Skip to content

Commit b718b70

Browse files
committed
Adding the missing javadocs.
1 parent 5e93367 commit b718b70

File tree

2 files changed

+54
-2
lines changed

2 files changed

+54
-2
lines changed

marklogic-client-api/src/main/java/com/marklogic/client/datamovement/JacksonCSVSplitter.java

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,36 @@ public class JacksonCSVSplitter implements Splitter<JacksonHandle> {
4444
private long count = 0;
4545
private ArrayNode headers = null;
4646

47+
/**
48+
* @return the CsvMapper for the current instance.
49+
*/
4750
public CsvMapper getCsvMapper() {
4851
return csvMapper;
4952
}
5053

54+
/**
55+
* Used to set the CsvSchema for the current instance.
56+
* @param schema is the CsvSchema passed in.
57+
* @return an instance of JacksonCSVSplitter with CsvSchema set to the parameter.
58+
*/
5159
public JacksonCSVSplitter withCsvSchema(CsvSchema schema) {
5260
this.csvSchema = schema;
5361
return this;
5462
}
5563

64+
/**
65+
* Used to set the CsvMapper for the current instance.
66+
* @param mapper is the CsvMapper passed in.
67+
* @return an instance of JacksonCSVSplitter with CsvMapper set to the parameter.
68+
*/
5669
public JacksonCSVSplitter withCsvMapper(CsvMapper mapper) {
5770
this.csvMapper = mapper;
5871
return this;
5972
}
6073

74+
/**
75+
* @return the CsvSchema for the current instance.
76+
*/
6177
public CsvSchema getCsvSchema() {
6278
return csvSchema;
6379
}
@@ -77,7 +93,7 @@ private CsvMapper configureCsvMapper() {
7793
return csvMapper;
7894
}
7995

80-
/*
96+
/**
8197
* Takes the input stream and converts it into a stream of JacksonHandle by setting the schema
8298
* and wrapping the JsonNode into JacksonHandle.
8399
* @param input the input stream passed in.
@@ -92,7 +108,7 @@ public Stream<JacksonHandle> split(InputStream input) throws Exception {
92108
return configureInput(configureObjReader().readValues(input));
93109
}
94110

95-
/*
111+
/**
96112
* Takes the input stream and converts it into a stream of JacksonHandle by setting the schema
97113
* and wrapping the JsonNode into JacksonHandle.
98114
* @param input the Reader stream passed in.
@@ -106,10 +122,17 @@ public Stream<JacksonHandle> split(Reader input) throws Exception {
106122
return configureInput(configureObjReader().readValues(input));
107123
}
108124

125+
/**
126+
* @return the number of JsonNodes found in the input stream.
127+
*/
109128
@Override
110129
public long getCount() {
111130
return this.count;
112131
}
132+
133+
/**
134+
* @return the headers found in the csv file.
135+
*/
113136
public ArrayNode getHeaders() {
114137
return this.headers;
115138
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,42 @@
1+
/*
2+
* Copyright 2019 MarkLogic Corporation
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package com.marklogic.client.datamovement;
218

319
import java.io.InputStream;
420
import java.util.stream.Stream;
521

622
import com.marklogic.client.io.marker.AbstractWriteHandle;
723

24+
/**
25+
* To facilitate CSV splitting, Splitter allows to implement the split method where the
26+
* incoming input stream is converted to a stream of another object, for example JacksonHandle
27+
* and gives an option to keep a record of the number of objects created using getCount method.
28+
*/
829
public interface Splitter<T extends AbstractWriteHandle> {
30+
/**
31+
* Converts the incoming input stream to a stream of object T.
32+
* @param input is the incoming input stream.
33+
* @return a stream of T.
34+
*/
935
Stream<T> split(InputStream input) throws Exception;
1036

37+
/**
38+
* @return the number of objects in the stream.
39+
*/
1140
long getCount();
1241

1342
}

0 commit comments

Comments
 (0)