Class SimpleJsonPathMetadataContributor

  • All Implemented Interfaces:
    MetadataContributor<String>

    public class SimpleJsonPathMetadataContributor
    extends Object
    implements MetadataContributor<String>
    A simple JsonPath Metadata processor that allow extract value from json object by configuring the path in the query variable via the bean. moreover this can also perform more compact extractions by configuring specific json processor in "metadataProcessor"
    Author:
    Mykhaylo Boychuk (mykhaylo.boychuk@4science.com)
    • Constructor Detail

      • SimpleJsonPathMetadataContributor

        public SimpleJsonPathMetadataContributor​(String query,
                                                 MetadataFieldConfig field)
        Initialize SimpleJsonPathMetadataContributor with a query, prefixToNamespaceMapping and MetadataFieldConfig
        Parameters:
        query - The JSonPath query
        field - the matadata field to map the result of the Json path query MetadataFieldConfig
      • SimpleJsonPathMetadataContributor

        public SimpleJsonPathMetadataContributor()
        Empty constructor for SimpleJsonPathMetadataContributor
    • Method Detail

      • getField

        public MetadataFieldConfig getField()
        Return the MetadataFieldConfig used while retrieving MetadatumDTO
        Returns:
        MetadataFieldConfig
      • setField

        public void setField​(MetadataFieldConfig field)
        Setting the MetadataFieldConfig
        Parameters:
        field - MetadataFieldConfig used while retrieving MetadatumDTO
      • getQuery

        public String getQuery()
        Return query used to create the JSonPath
        Returns:
        the query this instance is based on
      • setQuery

        public void setQuery​(String query)
        Return query used to create the JSonPath
      • setMetadataProcessor

        public void setMetadataProcessor​(JsonPathMetadataProcessor metadataProcessor)
        Used to process data got by jsonpath expression, like arrays to stringify, change date format or else If it is null, toString will be used.
        Parameters:
        metadataProcessor -
      • contributeMetadata

        public Collection<MetadatumDTO> contributeMetadata​(String fullJson)
        Retrieve the metadata associated with the given object. The toString() of the resulting object will be used.
        Specified by:
        contributeMetadata in interface MetadataContributor<String>
        Parameters:
        fullJson - A class to retrieve metadata from.
        Returns:
        a collection of import records. Only the identifier of the found records may be put in the record.