Package wt.fc
Class WTPair
- All Implemented Interfaces:
Serializable
Aggregates an ordered pair of WTReferences and handles them as a unique combination.
Two WTPair objects will test equal if their component WTReferences test equal.
A WTPair's hash code is a combination of its component WTReference hash codes,
which allows them to be added to collections and used as map keys.
Supported API: true
Extendable: false
Only the following WTReference implementations ares supported:
Supported API: true
Extendable: false
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class wt.util.Pair
Pair.UnorderedPair<T> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetKey1()Get first query key.getKey2()Get second query key.Get first Persistable (will inflate the reference).Get second Persistable (will inflate the reference).Get first reference.Get second reference.static WTKeyedMapmapWTPairs(Collection wtPairs, WTKeyedMap map, boolean firstKey) Populate a WTKeyedMap from a collection of WTPairs.voidsetObj1(WTReference ref1) Set first reference.voidsetObj2(WTReference ref2) Set second reference.voidSet first object.voidSet second object.voidSet both component objects.Methods inherited from class wt.util.Pair
equals, getAllObjs, getObj1, getObj2, isObj1Null, isObj2Null, setObjs, toString
-
Constructor Details
-
WTPair
public WTPair()Construct a default WTPair with null component objects.
Supported API: true -
WTPair
Construct a WTPair from component objects.
Supported API: true- Parameters:
obj1- First Persistable, ObjectReference, VersionReference, ObjectIdentifier or VersionForeignKey object.obj2- Second Persistable, ObjectReference, VersionReference, ObjectIdentifier or VersionForeignKey object.
-
WTPair
Construct a WTPair copy.
Supported API: true- Parameters:
wtPair- WTPair object to be copied.
-
-
Method Details
-
getReference1
Get first reference.
Supported API: true -
getReference2
Get second reference.
Supported API: true -
getPersistable1
Get first Persistable (will inflate the reference).
Supported API: true -
getPersistable2
Get second Persistable (will inflate the reference).
Supported API: true -
getKey1
Get first query key.
Supported API: true -
getKey2
Get second query key.
Supported API: true -
setWTObj1
Set first object.
Supported API: true- Parameters:
obj1- New first Persistable, ObjectReference, VersionReference, ObjectIdentifier or VersionForeignKey.
-
setWTObj2
Set second object.
Supported API: true- Parameters:
obj2- New second Persistable, ObjectReference, VersionReference, ObjectIdentifier or VersionForeignKey.
-
setWTObjs
Set both component objects.
Supported API: true- Parameters:
obj1- New first Persistable, ObjectReference, VersionReference, ObjectIdentifier or VersionForeignKey.obj2- New second Persistable, ObjectReference, VersionReference, ObjectIdentifier or VersionForeignKey.
-
setObj1
Set first reference.
Supported API: true- Overrides:
setObj1in classPair<WTReference,WTReference> - Parameters:
ref1- New first reference.
-
setObj2
Set second reference.
Supported API: true- Overrides:
setObj2in classPair<WTReference,WTReference> - Parameters:
ref1- New second reference.
-
mapWTPairs
Populate a WTKeyedMap from a collection of WTPairs.
Supported API: true- Parameters:
wtPairs- Collection of WTPair objects. Only WTPair objects with non-null first and second references will be added to the map. All others are skipped. All WTPairs in the collection should have consistent WTRefernce types for the keys and values, or a runtime exception will be thrown.map- WTKeyedMap or WTValeudMap to be populated with WTPairs. Pre-populated map contents will be retained. The map's keys will be either the first or second reference from the WTPair objects. The map's values will be a WTCollection of the other references. The type of WTCollection created will match the wtPairs type (i.e., a WTList if wtPairs is a List, otherwise a WTSet). A WTKeyedMap will be created if null is passed in.Note that if a WTValuedMap is passed in then the map's value will be a single WTReference rather than a WTCollection. If the same key is provided by multiple WTPair objects then the value returned in the map will be from the last WTPair encountered.
firstKey- True to assign the first reference as the map key and the second reference as the map value, or false for the opposite assignment.- Returns:
- The map that was passed in (or created) with the WTPair objects added.
-