快速业务通道

Classworking工具箱: 分析泛型数据结构 - 编程入门网

作者 佚名技术 来源 NET编程 浏览 发布时间 2012-06-14
TypeDescription getType() {      return m_type;    } } public abstract class TypeDescription {    public static final FieldDescription[] EMPTY_FIELD_ARRAY = {};    private final String m_descriptor;    protected TypeDescription(String dtor) {      m_descriptor = dtor;    }    public boolean isArray() {      return false;    }    public TypeDescription getArrayItemType() {      throw new IllegalStateException("Not an array");    }    public boolean isPrimitive() {      return false;    }    public FieldDescription[] getFields() {      return EMPTY_FIELD_ARRAY;    }    public String getDescriptor() {      return m_descriptor;    }    public boolean equals(Object obj) {      if (obj == this) {        return true;      } else if (obj instanceof TypeDescription) {        return m_descriptor.equals(((TypeDescription)obj).m_descriptor);      } else {        return false;      }    }    public int hashCode() {      return m_descriptor.hashCode();    }    public abstract String toString(); }

TypeDescription 类只是个抽象基类,其中定义了处理三种类型的方法:原生类型、数组和类实例。 这个基类以类型描述符的形式包含了一个值。我用于这个类的类型描述符大致符合 JVM 规范定义的类型 描述符的形式,但是有些扩展,添加了泛型具体 “版本” 的实际参数类型列表。这个扩展允许把 Ljava/util/Map<Ljava/lang/String;Ljava/lang/String;>; 这种形式的描述符作为类型系统的一 部分。

Classworking垢醤?: 蛍裂刑侏方象潤更(2)

扮寂:2011-10-16 IBM Dennis Sosnoski

怏岶方象潤更

怏岶方象潤更佚連議諒籾曳燕幣佚連議諒籾待裏鹸墫匯乂。怏岶佚連議児云諒籾壓噐方象潤更将械頁 弓拷議?匯倖窃嶄辛嬬嗤匯倖忖粁?宸倖忖粁哈喘宸倖窃議匯倖糞箭?賜宀万哈喘議匯倖窃辛嬬岷俊賜寂 俊仇哈喘指欺圻栖議窃。侭參?峪?岷俊婢蝕潤更?辛嬬氏侘撹涙?議弓拷儉桟。

厘聞喘朕村室宝栖侃尖宸嶽弓拷哈喘。壓孀欺窃哈喘扮?殊臥朕炎?臥心宸倖窃參念頁倦厮将心欺狛 。泌惚頁?椎担朕村祥卦指?嗤議宙峰。泌惚短嗤?夸朕村幹秀仟議宙峰糞箭?旺羨軸委宙峰耶紗欺朕村 ?封崛壓宙峰議頼屁聾准辛喘岻念祥耶紗?。賠汽 2 ?幣阻宸倖 TypeDirectory 窃議児云旗鷹??壓壙 扮音砿万?參朔氏耶紗侃尖刑侏議匯乂聾准?

賠汽 2. TypeDirectory 窃

public class TypeDirectory {    /** Source for binary class representations. */    private final BinaryClassLoader m_loader;    /** Field list for all arrays. */    private final FieldDescription[] m_arrayFields;    /** Map from descriptor or signature to type for all non-generic  types,     * including generics with substitutions. */    private HashMap<String,TypeDescription> m_typeMap =      new HashMap<String,TypeDescription>();    ...    /**     * Constructor. Initializes the type directory with descriptions of     * primitive types.     *     * @param loader binary class loader     */    public TypeDirectory(BinaryClassLoader loa

凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号