Package org.miaixz.bus.office.csv
Class CsvRow
- All Implemented Interfaces:
Iterable<String>,Collection<String>,List<String>,SequencedCollection<String>,org.miaixz.bus.core.lang.Wrapper<List<String>>,org.miaixz.bus.core.Provider
CSV中一行的表示
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Field Summary
Fields inherited from class org.miaixz.bus.core.lang.wrapper.SimpleWrapper
raw -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsAll(Collection<?> c) get(int index) 获取标题对应的字段内容获取标题与字段值对应的Maplong获取原始行号,多行情况下为首行行号。<T> T一行数据转换为Bean对象,忽略转换错误toString()Methods inherited from class org.miaixz.bus.core.center.list.ListWrapper
add, add, addAll, addAll, clear, contains, equals, forEach, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, parallelStream, remove, remove, removeAll, removeIf, replaceAll, retainAll, set, size, sort, spliterator, stream, subList, toArray, toArrayMethods inherited from class org.miaixz.bus.core.lang.wrapper.SimpleWrapper
getRawMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
toArrayMethods inherited from interface java.util.List
addFirst, addLast, getFirst, getLast, removeFirst, removeLast, reversedMethods inherited from interface org.miaixz.bus.core.lang.Wrapper
type
-
Constructor Details
-
CsvRow
构造- Parameters:
originalLineNumber- 对应文件中的第几行headerMap- 标题Mapfields- 数据列表
-
-
Method Details
-
getOriginalLineNumber
public long getOriginalLineNumber()获取原始行号,多行情况下为首行行号。忽略注释行- Returns:
- the original line number 行号
-
getByName
获取标题对应的字段内容- Parameters:
name- 标题名- Returns:
- 字段值,null表示无此字段值
- Throws:
IllegalStateException- CSV文件无标题行抛出此异常
-
getFieldMap
获取标题与字段值对应的Map- Returns:
- 标题与字段值对应的Map
- Throws:
IllegalStateException- CSV文件无标题行抛出此异常
-
toBean
一行数据转换为Bean对象,忽略转换错误- Type Parameters:
T- Bean类型- Parameters:
clazz- bean类- Returns:
- the object
-
containsAll
- Specified by:
containsAllin interfaceCollection<String>- Specified by:
containsAllin interfaceList<String>- Overrides:
containsAllin classorg.miaixz.bus.core.center.list.ListWrapper<String>
-
get
-
toString
-