what-the-bank/sources/org/simpleframework/xml/strategy/VisitorStrategy.java

41 lines
1.3 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package org.simpleframework.xml.strategy;
import java.util.Map;
import org.simpleframework.xml.stream.InputNode;
import org.simpleframework.xml.stream.NodeMap;
import org.simpleframework.xml.stream.OutputNode;
/* loaded from: classes6.dex */
public class VisitorStrategy implements Strategy {
private final Strategy strategy;
private final Visitor visitor;
public VisitorStrategy(Visitor visitor) {
this(visitor, new TreeStrategy());
}
public VisitorStrategy(Visitor visitor, Strategy strategy) {
this.strategy = strategy;
this.visitor = visitor;
}
@Override // org.simpleframework.xml.strategy.Strategy
public Value read(Type type, NodeMap<InputNode> nodeMap, Map map) throws Exception {
Visitor visitor = this.visitor;
if (visitor != null) {
visitor.read(type, nodeMap);
}
return this.strategy.read(type, nodeMap, map);
}
@Override // org.simpleframework.xml.strategy.Strategy
public boolean write(Type type, Object obj, NodeMap<OutputNode> nodeMap, Map map) throws Exception {
boolean write = this.strategy.write(type, obj, nodeMap, map);
Visitor visitor = this.visitor;
if (visitor != null) {
visitor.write(type, nodeMap);
}
return write;
}
}