📄 classnamespace.java
字号:
package gnu.kawa.lispexpr;import gnu.mapping.*;import java.io.*;import gnu.bytecode.ClassType;import gnu.kawa.functions.GetNamedPart;public class ClassNamespace extends Namespace implements Externalizable{ ClassType ctype; public ClassType getClassType () { return ctype; } public static ClassNamespace getInstance (String name, ClassType ctype) { synchronized (nsTable) { Object old = nsTable.get(name); if (old instanceof ClassNamespace) return (ClassNamespace) old; ClassNamespace ns = new ClassNamespace(ctype); nsTable.put(name, ns); return ns; } } public ClassNamespace () { } public ClassNamespace (ClassType ctype) { this.setName("class:"+ctype.getName()); this.ctype = ctype; } public Object get (String name) { try { return GetNamedPart.getTypePart(ctype, name); } catch (Throwable ex) { throw WrappedException.wrapIfNeeded(ex); } } public void writeExternal(ObjectOutput out) throws IOException { out.writeObject(ctype); } public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { ctype = (ClassType) in.readObject(); setName("class:"+ctype.getName()); } public Object readResolve() throws ObjectStreamException { String name = getName(); if (name != null) { Namespace ns = (Namespace) nsTable.get(name); if (ns instanceof ClassNamespace) return ns; nsTable.put(name, this); } return this; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -