public synchronized JstType getType(String fullName) { if (fullName == null) { return null; } JstType type = m_refTypes.get(fullName); if (type != null) { return type; } type = m_types.get(fullName); if (type != null) { return type; } for (JstType t : m_temp) { if (fullName.equals(t.getName())) { addType(fullName, t); m_temp.remove(t); return t; } } // TODO remove this causes issues with user defined types and lib types for (IJstLib lib : m_lib.values()) { type = lib.getType(fullName, true); if (type != null) { return type; } } return null; }
public synchronized JstRefType getRefType(String fullName) { JstRefType refType = m_refTypes.get(fullName); if (refType != null) { return refType; } IJstType jstType; for (IJstLib lib : m_lib.values()) { jstType = lib.getType(fullName, true); if (jstType != null && jstType instanceof JstRefType) { return (JstRefType) jstType; } } return null; }
// // API // public synchronized void addLib(IJstLib lib) { if (lib == null) { return; } for (JstType jst : lib.getAllTypes(true)) { addType(jst, true); } }
public void printTypes(PrintStream p) { p.println("ref types in cache"); for (IJstType t : m_refTypes.values()) { p.println(t.getName()); } p.println("types in cache"); for (IJstType t : m_types.values()) { p.println(t.getName()); } p.println("types in temp"); for (IJstType t : m_temp) { p.println(t.getName()); } p.println("type in lib"); for (IJstLib lib : m_lib.values()) { for (JstType t : lib.getAllTypes(true)) { p.println(t.getName()); } } }