com.univocity.parsers.common
Class Results<R extends Result>

java.lang.Object
  extended by com.univocity.parsers.common.Results<R>
All Implemented Interfaces:
Map<String,R>

public final class Results<R extends Result>
extends Object
implements Map<String,R>

A map of "Entity Name" to Result returned from parsing with EntityParserInterface.parse(com.univocity.api.io.ReaderProvider)

Author:
uniVocity Software Pty Ltd - dev@univocity.com

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
Results()
           
 
Method Summary
 void clear()
           
 boolean containsKey(Object entityName)
           
 boolean containsValue(Object entityName)
           
 Set<Map.Entry<String,R>> entrySet()
           
 R get(Object entityName)
           
 boolean isEmpty()
           
 R join(String masterEntity, String entityToLink, String... otherEntitiesToLink)
          Joins the results of the entity entityToLink to the results of the entity masterEntity, producing a new result whose records will have all values of the masterEntity plus all values of the entityToLink.
 Set<String> keySet()
           
 void link(String masterEntity, String entityToLink, String... otherEntitiesToLink)
          Links the results of the entity entityToLink to the results of the entity masterEntity, so that each record from masterEntity will have the corresponding records from entityToLink available when ResultRecord.getLinkedEntityData() is called.
 R put(String entityName, Object result)
          Puts the result into the map, associated with entityName
 R put(String entityName, R result)
           
 void putAll(Map<? extends String,? extends R> m)
           
 R remove(Object entityName)
           
 int size()
           
 Collection<R> values()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

Results

public Results()
Method Detail

join

public final R join(String masterEntity,
                    String entityToLink,
                    String... otherEntitiesToLink)
Joins the results of the entity entityToLink to the results of the entity masterEntity, producing a new result whose records will have all values of the masterEntity plus all values of the entityToLink. Field names in common between the master entity and each entity are used to determine which records to join. If the entityToLink has multiple records that match with the masterEntity, the result will be the cartesian product, i.e. if entityToLink has rows [x,u,v] and [x,y,z and masterEntity has row [x,a,b], the result will have two rows: [x,a,b,u,v] and [x,a,b,y,z].

Parameters:
masterEntity - the name of the entity to join all other specified entities to.
entityToLink - the name of the entity to join to the masterEntity
otherEntitiesToLink - optional, other entities to join to the masterEntity
Returns:
the result of joining the entityToLink, and otherEntitiesToLink to masterEntity

link

public final void link(String masterEntity,
                       String entityToLink,
                       String... otherEntitiesToLink)
Links the results of the entity entityToLink to the results of the entity masterEntity, so that each record from masterEntity will have the corresponding records from entityToLink available when ResultRecord.getLinkedEntityData() is called. Field names in common between the master entity and each entity are used to determine which records to link.

Parameters:
masterEntity - the name of the entity to link all other specified entities to.
entityToLink - the name of the entity to link to the masterEntity
otherEntitiesToLink - optional, other entities to link to the masterEntity

put

public final R put(String entityName,
                   Object result)
Puts the result into the map, associated with entityName

Parameters:
entityName - the name of the entity associated with the result
result - an object that is cast to <R>
Returns:
the previous result associated with entityName

put

public final R put(String entityName,
                   R result)
Specified by:
put in interface Map<String,R extends Result>

get

public final R get(Object entityName)
Specified by:
get in interface Map<String,R extends Result>

remove

public final R remove(Object entityName)
Specified by:
remove in interface Map<String,R extends Result>

containsValue

public final boolean containsValue(Object entityName)
Specified by:
containsValue in interface Map<String,R extends Result>

containsKey

public final boolean containsKey(Object entityName)
Specified by:
containsKey in interface Map<String,R extends Result>

keySet

public Set<String> keySet()
Specified by:
keySet in interface Map<String,R extends Result>

entrySet

public final Set<Map.Entry<String,R>> entrySet()
Specified by:
entrySet in interface Map<String,R extends Result>

values

public final Collection<R> values()
Specified by:
values in interface Map<String,R extends Result>

size

public int size()
Specified by:
size in interface Map<String,R extends Result>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Map<String,R extends Result>

putAll

public void putAll(Map<? extends String,? extends R> m)
Specified by:
putAll in interface Map<String,R extends Result>

clear

public void clear()
Specified by:
clear in interface Map<String,R extends Result>


Copyright © 2018 uniVocity Software Pty Ltd. All rights reserved.