super(out);
this.value = value;
}
private void visitStyledValue(Template[] styledTextTemplates) {
Template template;
// 纯文本
if (value instanceof TextValue) {
template = styledTextTemplates[0];
context().put("value", value.getText());
template.accept(this);
}
// raw data
else if (value instanceof RawValue) {
template = styledTextTemplates[1];
context().put("packageName", ((RawValue) value).getRawType().getPackage().getName());
context().put("className", ClassUtil.getSimpleClassName(((RawValue) value).getRawType()));
context().put("value", ((RawValue) value).getRawToString());
template.accept(this);
}
// class name
else if (value instanceof ClassValue) {
template = styledTextTemplates[2];
context().put("packageName", ((ClassValue) value).getPackageName());
context().put("className", ((ClassValue) value).getSimpleName());
template.accept(this);
}
// anchor
else if (value instanceof AnchorValue) {
template = styledTextTemplates[3];
int i = 0;
for (String name : ((AnchorValue) value).getNames()) {
context().put("anchorName", toId(name));
context().put("anchorNameDisplay", name);
this.withSep = i++ > 0;
template.accept(this);
}
}
// ref to anchor
else if (value instanceof RefValue) {
template = styledTextTemplates[4];
int i = 0;
for (String name : ((RefValue) value).getNames()) {
context().put("refName", toId(name));
context().put("refNameDisplay", name);
this.withSep = i++ > 0;
template.accept(this);
}
}
// unknown value
else {