| java.lang.Object com.mchange.v2.coalesce.CoalescerFactory
CoalescerFactory | final public class CoalescerFactory (Code) | | |
Method Summary | |
public static Coalescer | createCoalescer() Creates a "Coalescer" that coalesces Objects according to their
equals() method. | public static Coalescer | createCoalescer(boolean weak, boolean synced) Creates a "Coalescer" that coalesces Objects according to their
equals() method. | public static Coalescer | createCoalescer(CoalesceChecker cc, boolean weak, boolean synced) Creates a "Coalescer" that coalesces Objects according to the
checkCoalesce() method of a "CoalesceChecker". |
createCoalescer | public static Coalescer createCoalescer()(Code) | | Creates a "Coalescer" that coalesces Objects according to their
equals() method. Given a set of n Objects among whom equals() would
return true, calling coalescer.coalesce() in any order on any sequence
of these Objects will always return a single "canonical" instance.
This method creates a weak, synchronized coalesecer, safe for use
by multiple Threads.
|
createCoalescer | public static Coalescer createCoalescer(boolean weak, boolean synced)(Code) | | Creates a "Coalescer" that coalesces Objects according to their
equals() method. Given a set of n Objects among whom equals() would
return true, calling coalescer.coalesce() in any order on any sequence
of these Objects will always return a single "canonical" instance.
Parameters: weak - if true, the Coalescer will use WeakReferences to holdits canonical instances, allowing them to be garbagecollected if they are nowhere in use. Parameters: synced - if true, access to the Coalescer will be automaticallysynchronized. if set to false, then users must manuallysynchronize access. |
createCoalescer | public static Coalescer createCoalescer(CoalesceChecker cc, boolean weak, boolean synced)(Code) | | Creates a "Coalescer" that coalesces Objects according to the
checkCoalesce() method of a "CoalesceChecker". Given a set of
n Objects among whom calling cc.checkCoalesce() on any pair would
return true, calling coalescer.coalesce() in any order on any sequence
of these Objects will always return a single "canonical" instance.
This allows one to define immutable value Objects whose equals()
method is a mere identity test -- one can use a Coalescer in a
factory method to ensure that no two instances with the same values
are made available to clients.
Parameters: cc - CoalesceChecker that will be used to determine whether twoobjects are equivalent and can be coalesced. [If cc is null, then twoobjects will be coalesced iff o1.equals( o2 ).] Parameters: weak - if true, the Coalescer will use WeakReferences to holdits canonical instances, allowing them to be garbagecollected if they are nowhere in use. Parameters: synced - if true, access to the Coalescer will be automaticallysynchronized. if set to false, then users must manuallysynchronize access. |
|
|