Class AbstractCsvMapper<T>

  • Direct Known Subclasses:
    CsvMapper, CsvMapper2

    public abstract class AbstractCsvMapper<T>
    extends Object
    Dynamic CSV parser generator. Adapts the underlying implementation according to the first (header) line.

    Uses ASM to build the parsers.

    Thread-safe.
    • Field Detail

      • VAR_INTERMEDIATE_OBJECT

        public static final int VAR_INTERMEDIATE_OBJECT
        See Also:
        Constant Field Values
      • superClassInternalName

        protected static final String superClassInternalName
      • csvStaticInitializer

        protected static final String csvStaticInitializer
      • ignoredSeperateQuoteAndEscapeCharacterColumnName

        protected static final String ignoredSeperateQuoteAndEscapeCharacterColumnName
      • ignoredIdenticalQuoteAndEscapeCharacterColumnName

        protected static final String ignoredIdenticalQuoteAndEscapeCharacterColumnName
      • divider

        protected int divider
      • quoteCharacter

        protected int quoteCharacter
      • escapeCharacter

        protected int escapeCharacter
      • mappedClass

        protected Class<T> mappedClass
      • mappedClassInternalName

        protected String mappedClassInternalName
      • skipEmptyLines

        protected final boolean skipEmptyLines
      • skipComments

        protected final boolean skipComments
      • skippableFieldsWithoutLinebreaks

        protected final boolean skippableFieldsWithoutLinebreaks
      • bufferLength

        protected final int bufferLength
      • currentOffsetIndex

        protected static final int currentOffsetIndex
        Note: Stack variable types are fixed throughout the application, as below. The range index is dual purpose as end index for trimming quoted content.
        See Also:
        Constant Field Values
      • biConsumer

        protected final boolean biConsumer
      • triConsumer

        protected final boolean triConsumer
    • Constructor Detail

      • AbstractCsvMapper

        public AbstractCsvMapper​(Class<T> cls,
                                 char divider,
                                 char quoteCharacter,
                                 char escapeCharacter,
                                 List<AbstractColumn> columns,
                                 boolean skipEmptyLines,
                                 boolean skipComments,
                                 boolean skippableFieldsWithoutLinebreaks,
                                 ClassLoader classLoader,
                                 int bufferLength)
    • Method Detail

      • getInternalName

        public static String getInternalName​(Class<?> cls)
      • getInternalName

        public static String getInternalName​(String className)
      • getDivider

        protected int getDivider()
      • write

        protected String write​(org.objectweb.asm.ClassWriter classWriter,
                               List<String> csvFileFieldNames,
                               boolean carriageReturns)
      • addMethod

        protected void addMethod​(org.objectweb.asm.ClassWriter classWriter,
                                 String subClassInternalName,
                                 AbstractColumn[] mapping,
                                 boolean carriageReturns,
                                 boolean inline,
                                 int lastIndex,
                                 int firstIndex)
      • writeTriConsumerVariable

        protected abstract void writeTriConsumerVariable​(String subClassInternalName,
                                                         org.objectweb.asm.MethodVisitor mv)
      • addConstructors

        protected void addConstructors​(org.objectweb.asm.ClassWriter classWriter,
                                       String subClassInternalName)
      • writeSkipComments

        protected void writeSkipComments​(org.objectweb.asm.MethodVisitor mv,
                                         String subClassInternalName)
      • skipToLinebreak

        protected void skipToLinebreak​(org.objectweb.asm.MethodVisitor mv)
      • skipColumns

        protected void skipColumns​(org.objectweb.asm.MethodVisitor mv,
                                   int count)
      • writeSkipEmptyOrCommentedLines

        protected void writeSkipEmptyOrCommentedLines​(org.objectweb.asm.MethodVisitor mv,
                                                      String subClassInternalName,
                                                      boolean carriageReturns)
      • writeSkipEmptyLines

        protected void writeSkipEmptyLines​(org.objectweb.asm.MethodVisitor mv,
                                           String subClassInternalName,
                                           boolean carriageReturns)
      • addStatics

        protected void addStatics​(org.objectweb.asm.ClassWriter classWriter,
                                  AbstractColumn[] columns,
                                  String classInternalName,
                                  String className)
      • addConstructors

        protected void addConstructors​(org.objectweb.asm.ClassWriter classWriter,
                                       String subClassInternalName,
                                       String intermediateInternalName)
      • writeReaderWithBufferConstructor

        protected void writeReaderWithBufferConstructor​(org.objectweb.asm.ClassWriter classWriter,
                                                        String subClassInternalName,
                                                        String intermediateInternalName)
      • writeReaderConstructor

        protected void writeReaderConstructor​(org.objectweb.asm.ClassWriter classWriter,
                                              String subClassInternalName,
                                              String intermediateInternalName)
      • saveCurrentOffset

        protected void saveCurrentOffset​(org.objectweb.asm.MethodVisitor mv,
                                         String superClassInternalName,
                                         int currentOffsetIndex)