Example usage for org.apache.commons.collections.set MapBackedSet decorate

List of usage examples for org.apache.commons.collections.set MapBackedSet decorate

Introduction

In this page you can find the example usage for org.apache.commons.collections.set MapBackedSet decorate.

Prototype

public static Set decorate(Map map, Object dummyValue) 

Source Link

Document

Factory method to create a set from a map.

Usage

From source file:org.apache.openjpa.kernel.AbstractBrokerFactory.java

private Set<Broker> newBrokerSet() {
    BrokerValue bv;/*from w w  w.j a  v  a  2 s.  c  o  m*/
    if (_conf instanceof OpenJPAConfigurationImpl)
        bv = ((OpenJPAConfigurationImpl) _conf).brokerPlugin;
    else
        bv = (BrokerValue) _conf.getValue(BrokerValue.KEY);

    if (FinalizingBrokerImpl.class.isAssignableFrom(bv.getTemplateBrokerType(_conf))) {
        return MapBackedSet.decorate(new ConcurrentHashMap(), new Object() {
        });
    } else {
        return new ConcurrentReferenceHashSet<Broker>(ConcurrentReferenceHashSet.WEAK);
    }
}

From source file:org.apache.openjpa.lib.util.concurrent.ConcurrentReferenceHashSet.java

/**
 * Construct a set with the given reference type.
 *///from w  w  w.jav  a2s.co m
public ConcurrentReferenceHashSet(int refType) {
    if (refType == HARD)
        _set = MapBackedSet.decorate(new ConcurrentHashMap(), DUMMY_VAL);
    else {
        int mapRefType = (refType == WEAK) ? ConcurrentReferenceHashMap.WEAK : ConcurrentReferenceHashMap.SOFT;
        _set = MapBackedSet.decorate(
                new ConcurrentReferenceHashMap(mapRefType, ConcurrentReferenceHashMap.HARD), DUMMY_VAL);
    }
}

From source file:org.apache.openjpa.lib.util.ReferenceHashSet.java

/**
 * Construct a set with the given reference type.
 *///from  w  ww  .j  a  v a 2s .  c  o  m
public ReferenceHashSet(int refType) {
    if (refType == HARD)
        _set = new HashSet();
    else {
        int mapRefType = (refType == WEAK) ? org.apache.commons.collections.map.ReferenceMap.WEAK
                : org.apache.commons.collections.map.ReferenceMap.SOFT;
        _set = MapBackedSet.decorate(new org.apache.commons.collections.map.ReferenceMap(mapRefType,
                org.apache.commons.collections.map.ReferenceMap.HARD), DUMMY_VAL);
    }
}