Class Record

  • All Implemented Interfaces:
    java.io.Serializable

    public class Record
    extends java.lang.Object
    implements java.io.Serializable
    Record
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected Record​(ModelRecord modelRecord)
      Creates new Record
      protected Record​(ModelRecord modelRecord, java.util.Map<java.lang.String,​java.lang.Object> fields)
      Creates new Record from existing Map
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addChildRecord​(Record record)
      Add child record.
      static Record createDelimitedRecord​(java.lang.String line, int lineNum, ModelRecord modelRecord, char delimiter, java.lang.String textDelimiter)  
      static Record createRecord​(java.lang.String line, int lineNum, ModelRecord modelRecord)  
      static Record createRecord​(ModelRecord modelRecord)
      Creates new Record
      static Record createRecord​(ModelRecord modelRecord, java.util.Map<java.lang.String,​java.lang.Object> fields)
      Creates new Record from existing fields Map
      java.lang.Object get​(java.lang.String name)
      Get object.
      java.util.List<Record> getChildRecords()
      Gets child records.
      java.sql.Date getDate​(java.lang.String name)
      Gets date.
      java.lang.Double getDouble​(java.lang.String name)
      Gets double.
      java.lang.String getFixedString​(java.lang.String name)
      Gets fixed string.
      java.lang.Float getFloat​(java.lang.String name)
      Gets float.
      java.lang.Integer getInteger​(java.lang.String name)
      Gets integer.
      java.lang.Long getLong​(java.lang.String name)
      Gets long.
      ModelRecord getModelRecord()
      Gets model record.
      Record getParentRecord()
      Gets parent record.
      java.lang.String getRecordName()
      Gets record name.
      java.lang.String getString​(java.lang.String name)
      Gets string.
      java.lang.String getStringAndEmpty​(java.lang.String name)
      Gets string and empty.
      java.sql.Time getTime​(java.lang.String name)
      Gets time.
      java.sql.Timestamp getTimestamp​(java.lang.String name)
      Gets timestamp.
      void set​(java.lang.String name, java.lang.Object value)
      Sets the named field to the passed value, even if the value is null
      void set​(java.lang.String name, java.lang.Object value, boolean setIfNull)
      Sets the named field to the passed value.
      void setString​(java.lang.String name, java.lang.String value)
      Sets the named field to the passed value, converting the value from a String to the current type using Type.valueOf()
      java.lang.String writeLineString​(ModelDataFile modelDataFile)
      Write line string string.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Record

        protected Record​(ModelRecord modelRecord)
        Creates new Record
      • Record

        protected Record​(ModelRecord modelRecord,
                         java.util.Map<java.lang.String,​java.lang.Object> fields)
        Creates new Record from existing Map
    • Method Detail

      • getRecordName

        public java.lang.String getRecordName()
        Gets record name.
        Returns:
        the record name
      • getModelRecord

        public ModelRecord getModelRecord()
        Gets model record.
        Returns:
        the model record
      • get

        public java.lang.Object get​(java.lang.String name)
        Get object.
        Parameters:
        name - the name
        Returns:
        the object
      • getString

        public java.lang.String getString​(java.lang.String name)
        Gets string.
        Parameters:
        name - the name
        Returns:
        the string
      • getStringAndEmpty

        public java.lang.String getStringAndEmpty​(java.lang.String name)
        Gets string and empty.
        Parameters:
        name - the name
        Returns:
        the string and empty
      • getTimestamp

        public java.sql.Timestamp getTimestamp​(java.lang.String name)
        Gets timestamp.
        Parameters:
        name - the name
        Returns:
        the timestamp
      • getTime

        public java.sql.Time getTime​(java.lang.String name)
        Gets time.
        Parameters:
        name - the name
        Returns:
        the time
      • getDate

        public java.sql.Date getDate​(java.lang.String name)
        Gets date.
        Parameters:
        name - the name
        Returns:
        the date
      • getInteger

        public java.lang.Integer getInteger​(java.lang.String name)
        Gets integer.
        Parameters:
        name - the name
        Returns:
        the integer
      • getLong

        public java.lang.Long getLong​(java.lang.String name)
        Gets long.
        Parameters:
        name - the name
        Returns:
        the long
      • getFloat

        public java.lang.Float getFloat​(java.lang.String name)
        Gets float.
        Parameters:
        name - the name
        Returns:
        the float
      • getDouble

        public java.lang.Double getDouble​(java.lang.String name)
        Gets double.
        Parameters:
        name - the name
        Returns:
        the double
      • set

        public void set​(java.lang.String name,
                        java.lang.Object value)
        Sets the named field to the passed value, even if the value is null
        Parameters:
        name - The field name to set
        value - The value to set
      • set

        public void set​(java.lang.String name,
                        java.lang.Object value,
                        boolean setIfNull)
        Sets the named field to the passed value. If value is null, it is only set if the setIfNull parameter is true.
        Parameters:
        name - The field name to set
        value - The value to set
        setIfNull - Specifies whether or not to set the value if it is null
      • setString

        public void setString​(java.lang.String name,
                              java.lang.String value)
                       throws java.text.ParseException
        Sets the named field to the passed value, converting the value from a String to the current type using Type.valueOf()
        Parameters:
        name - The field name to set
        value - The String value to convert and set
        Throws:
        java.text.ParseException
      • getFixedString

        public java.lang.String getFixedString​(java.lang.String name)
        Gets fixed string.
        Parameters:
        name - the name
        Returns:
        the fixed string
      • writeLineString

        public java.lang.String writeLineString​(ModelDataFile modelDataFile)
                                         throws DataFileException
        Write line string string.
        Parameters:
        modelDataFile - the model data file
        Returns:
        the string
        Throws:
        DataFileException - the data file exception
      • getParentRecord

        public Record getParentRecord()
        Gets parent record.
        Returns:
        the parent record
      • getChildRecords

        public java.util.List<Record> getChildRecords()
        Gets child records.
        Returns:
        the child records
      • addChildRecord

        public void addChildRecord​(Record record)
        Add child record.
        Parameters:
        record - the record
      • createRecord

        public static Record createRecord​(ModelRecord modelRecord)
                                   throws DataFileException
        Creates new Record
        Parameters:
        modelRecord -
        Returns:
        return the Record Object created
        Throws:
        DataFileException - Exception thown for various errors, generally has a nested exception
      • createRecord

        public static Record createRecord​(ModelRecord modelRecord,
                                          java.util.Map<java.lang.String,​java.lang.Object> fields)
                                   throws DataFileException
        Creates new Record from existing fields Map
        Parameters:
        modelRecord -
        fields -
        Returns:
        return the Record Object created
        Throws:
        DataFileException - Exception thown for various errors, generally has a nested exception
      • createRecord

        public static Record createRecord​(java.lang.String line,
                                          int lineNum,
                                          ModelRecord modelRecord)
                                   throws DataFileException
        Parameters:
        line -
        lineNum -
        modelRecord -
        Returns:
        return the Record Object created
        Throws:
        DataFileException - Exception thown for various errors, generally has a nested exception
      • createDelimitedRecord

        public static Record createDelimitedRecord​(java.lang.String line,
                                                   int lineNum,
                                                   ModelRecord modelRecord,
                                                   char delimiter,
                                                   java.lang.String textDelimiter)
                                            throws DataFileException
        Parameters:
        line -
        lineNum -
        modelRecord -
        delimiter -
        Returns:
        return a Record Object
        Throws:
        DataFileException - Exception thown for various errors, generally has a nested exception