org.nutz.lang.segment.CharSegment Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nutz Show documentation
Show all versions of nutz Show documentation
Nutz, which is a collections of lightweight frameworks, each of them can be used independently
package org.nutz.lang.segment;
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.nutz.lang.Lang;
import org.nutz.lang.Mirror;
import org.nutz.lang.util.Context;
import org.nutz.lang.util.NutMap;
public class CharSegment implements Segment, Cloneable {
public CharSegment() {}
public CharSegment(String str) {
valueOf(str);
}
@SuppressWarnings("unchecked")
public Segment add(String key, Object v) {
if (!context.has(key)) {
context.set(key, v);
return this;
}
Object val = context.get(key);
if (val == null) {
context.set(key, v);
} else if (val instanceof Collection>) {
((Collection