alexandroid/decompiled/jadx/sources/com/fasterxml/jackson/databind/cfg/ContextAttributes.java
KaKi87 a47fad5135 📦 Add decompiled Alexa 2.2.730155.0 (jadx, apktool, Hermes strings)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-07 00:04:16 +01:00

118 lines
4.2 KiB
Java

package com.fasterxml.jackson.databind.cfg;
import java.io.Serializable;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
/* loaded from: classes7.dex */
public abstract class ContextAttributes {
public static ContextAttributes getEmpty() {
return Impl.getEmpty();
}
public abstract Object getAttribute(Object obj);
public abstract ContextAttributes withPerCallAttribute(Object obj, Object obj2);
public abstract ContextAttributes withSharedAttribute(Object obj, Object obj2);
public abstract ContextAttributes withSharedAttributes(Map<?, ?> map);
public abstract ContextAttributes withoutSharedAttribute(Object obj);
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
public static class Impl extends ContextAttributes implements Serializable {
protected static final Impl EMPTY = new Impl(Collections.EMPTY_MAP);
protected static final Object NULL_SURROGATE = new Object();
private static final long serialVersionUID = 1;
protected transient Map<Object, Object> _nonShared;
protected final Map<?, ?> _shared;
public Impl(Map<?, ?> map) {
this._shared = map;
this._nonShared = null;
}
private Map<Object, Object> _copy(Map<?, ?> map) {
return new HashMap(map);
}
public static ContextAttributes getEmpty() {
return EMPTY;
}
@Override // com.fasterxml.jackson.databind.cfg.ContextAttributes
public Object getAttribute(Object obj) {
Object obj2;
Map<Object, Object> map = this._nonShared;
if (map == null || (obj2 = map.get(obj)) == null) {
return this._shared.get(obj);
}
if (obj2 == NULL_SURROGATE) {
return null;
}
return obj2;
}
public ContextAttributes nonSharedInstance(Object obj, Object obj2) {
HashMap hashMap = new HashMap();
if (obj2 == null) {
obj2 = NULL_SURROGATE;
}
hashMap.put(obj, obj2);
return new Impl(this._shared, hashMap);
}
@Override // com.fasterxml.jackson.databind.cfg.ContextAttributes
public ContextAttributes withPerCallAttribute(Object obj, Object obj2) {
if (obj2 == null) {
if (!this._shared.containsKey(obj)) {
Map<Object, Object> map = this._nonShared;
if (map != null && map.containsKey(obj)) {
this._nonShared.remove(obj);
}
return this;
}
obj2 = NULL_SURROGATE;
}
Map<Object, Object> map2 = this._nonShared;
if (map2 == null) {
return nonSharedInstance(obj, obj2);
}
map2.put(obj, obj2);
return this;
}
@Override // com.fasterxml.jackson.databind.cfg.ContextAttributes
public ContextAttributes withSharedAttribute(Object obj, Object obj2) {
Map<Object, Object> hashMap = this == EMPTY ? new HashMap<>(8) : _copy(this._shared);
hashMap.put(obj, obj2);
return new Impl(hashMap);
}
@Override // com.fasterxml.jackson.databind.cfg.ContextAttributes
public ContextAttributes withSharedAttributes(Map<?, ?> map) {
return new Impl(map);
}
@Override // com.fasterxml.jackson.databind.cfg.ContextAttributes
public ContextAttributes withoutSharedAttribute(Object obj) {
if (this._shared.isEmpty() || !this._shared.containsKey(obj)) {
return this;
}
if (this._shared.size() == 1) {
return EMPTY;
}
Map<Object, Object> _copy = _copy(this._shared);
_copy.remove(obj);
return new Impl(_copy);
}
public Impl(Map<?, ?> map, Map<Object, Object> map2) {
this._shared = map;
this._nonShared = map2;
}
}
}