Search in sources :

Example 1 with WrapEntry

use of com.pamirs.attach.plugin.caffeine.utils.WrapEntry in project LinkAgent by shulieTech.

the class EntrySetInterceptor method getResult0.

@Override
public Object getResult0(Advice advice) throws Throwable {
    Object returnObj = advice.getReturnObj();
    if (!(returnObj instanceof Set)) {
        return new Object[0];
    }
    Set<Map.Entry> returnSet = (Set<Entry>) returnObj;
    if (returnSet.size() == 0) {
        return new Object[0];
    }
    Set<Map.Entry> resultSet = new HashSet();
    for (Entry entry : returnSet) {
        if (Pradar.isClusterTest()) {
            if (entry.getKey() instanceof ClusterTestCacheWrapperKey) {
                resultSet.add(new WrapEntry(entry));
            }
        } else {
            if (!(entry.getKey() instanceof ClusterTestCacheWrapperKey)) {
                resultSet.add(entry);
            }
        }
    }
    return resultSet;
}
Also used : WrapEntry(com.pamirs.attach.plugin.caffeine.utils.WrapEntry) Entry(java.util.Map.Entry) HashSet(java.util.HashSet) Set(java.util.Set) ClusterTestCacheWrapperKey(com.pamirs.pradar.cache.ClusterTestCacheWrapperKey) WrapEntry(com.pamirs.attach.plugin.caffeine.utils.WrapEntry) HashSet(java.util.HashSet)

Aggregations

WrapEntry (com.pamirs.attach.plugin.caffeine.utils.WrapEntry)1 ClusterTestCacheWrapperKey (com.pamirs.pradar.cache.ClusterTestCacheWrapperKey)1 HashSet (java.util.HashSet)1 Entry (java.util.Map.Entry)1 Set (java.util.Set)1