Classwo***ng工具箱: 分析泛型数据结构 - 编程入门网
作者 佚名技术
来源 NET编程
浏览
发布时间 2012-06-14
ized type with type substitutions. * * @param sig signature including all type substitutions * @param types actual types used for instance (values may be * <code>null</code> if no substitution defined) * @param tdir type directory * @return substituted type description */ public TypeDescription getParameterized(String sig, TypeDescription[] types) { return new ParameterizedClassDescription(sig, types); } /** * Visitor for generating the description information for a generic class. */ public class DescriptionBuilderVisitor extends EmptyVisitor { private final TypeDirectory m_typeDirectory; private ArrayList<FieldDescription> m_fields; private ArrayList<String> m_typeParameters; private ArrayList<TypeDescription> m_upperBounds; private DescriptionBuilderVisitor(TypeDirectory dir) { m_typeDirectory = dir; m_fields = new ArrayList<FieldDescription>(); m_typeParameters = new ArrayList<String>(); m_upperBounds = new ArrayList<TypeDescription>(); } public void visit(int version, int access, String name, String sig, String sname, String[] inames) { if (sig != null) { new SignatureReader(sig).accept(new ClassSignatureVisitor()); } super.visit(version, access, name, sig, sname, inames); } public FieldVisitor visitField(int access, String name, String desc, String sig, Object value) { TypeDescription type = null; if (sig == null) { type = m_typeDirectory.getTypeInstance(desc); } m_fields.add(new FieldDescription(name, sig, type)); return super.visitField(access, name, desc, sig, value); } private FieldDescription[] getFields() { return m_fields.toArray(new FieldDescription[m_fields.size()]); } private String[] getTypeParameters() { return m_typeParameters.toArray(new String[m_typeParameters.size()]); } private TypeDescription[] getUpperBounds() { return m_upperBounds.toArray(new TypeDescription[m_upperBounds.size ()]); } private class ClassSignatureVisitor extends EmptySignatureVisitor { private boolean m_isBounded; public void visitFormalTypeParameter(String name) { m_typeParameters.add(name); m_upperBounds.add(m_typeDirectory.getTypeInstance ("Ljava/lang/Object;")); } public SignatureVisitor visitClassBound() { return new |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
关于Classwo***ng工具箱: 分析泛型数据结构 - 编程入门网的所有评论