Class ImportedObject

java.lang.Object
io.jmix.dataimport.extractor.data.ImportedObject
All Implemented Interfaces:
RawValuesSource

public class ImportedObject extends Object implements RawValuesSource
Represents an object in JSON or XML with the following info:
  • Data field name: for JSON - field name, for XML - tag name
  • Raw values map: for JSON - raw values of JSON object fields by field names, for XML: values of child tags by tag names

JSON example:
The "customer" object represents ImportedObject with data field name = "customer" and two raw values: "name" and "email".
 [
   {
     "orderNumber": "#001",
     "orderDate": "12/07/2021",
     "orderAmount": 100,
     "customer": {
       "name": "Shelby Robinson",
       "email": "robinson@mail.com"
     }
   }
 ]
 

XML example:
The "customer" tag represents ImportedObject with data field name = "customer" and two raw values: "name" and "email".

 <orders>
     <order>
         <number>#001</number>
         <amount>50.5</amount>
         <date>12/02/2021 12:00</date>
         <customer>
             <name>Parker Leighton</name>
             <email>leighton@mail.com</email>
         </customer>
     </order>
 </orders>
 
  • Field Details

  • Constructor Details

    • ImportedObject

      public ImportedObject()
  • Method Details

    • getRawValues

      public Map<String,Object> getRawValues()
      Specified by:
      getRawValues in interface RawValuesSource
      Returns:
      map that contains raw values by data field names
    • setRawValues

      public void setRawValues(Map<String,Object> rawValues)
      Description copied from interface: RawValuesSource
      Sets a map containing raw values of data fields.
      Specified by:
      setRawValues in interface RawValuesSource
      Parameters:
      rawValues - map with raw values
    • getDataFieldName

      public String getDataFieldName()
    • setDataFieldName

      public void setDataFieldName(String dataFieldName)
    • addRawValue

      public RawValuesSource addRawValue(String dataFieldName, @Nullable Object value)
      Description copied from interface: RawValuesSource
      Adds a raw value of specified data field
      Specified by:
      addRawValue in interface RawValuesSource
      Parameters:
      dataFieldName - data field name
      value - raw value
      Returns:
      current instance of raw values source
    • getRawValue

      @Nullable public Object getRawValue(String dataFieldName)
      Description copied from interface: RawValuesSource
      Gets a raw value of the specified data field
      Specified by:
      getRawValue in interface RawValuesSource
      Parameters:
      dataFieldName - data field name
      Returns:
      extracted raw value
    • toString

      public String toString()
      Overrides:
      toString in class Object