Esempio n. 1
0
  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;
  }
Esempio n. 2
0
 //
 // API
 //
 public synchronized void addLib(IJstLib lib) {
   if (lib == null) {
     return;
   }
   for (JstType jst : lib.getAllTypes(true)) {
     addType(jst, true);
   }
 }
Esempio n. 3
0
 public synchronized JstType getType(String fullName, boolean create) {
   JstType jstType = getType(fullName);
   if (jstType != null) {
     return jstType;
   }
   if (create) {
     jstType = new JstType(fullName);
     addType(jstType);
     return jstType;
   }
   return null;
 }
Esempio n. 4
0
 /**
  * Add given type to cache. However, if type with same name already exists and rtnExisting is
  * true, do not add but return the existing type.
  *
  * @param type JstType the type to add to cache
  * @param rtnExisting boolean
  * @return JstType
  */
 public synchronized JstType addType(JstType type, boolean rtnExisting) {
   if (type == null) {
     return null;
   }
   if (rtnExisting) {
     JstType existing = getType(type.getName());
     if (existing != null) {
       return existing;
     }
   }
   addType(type.getName(), type);
   return type;
 }
Esempio n. 5
0
 /**
  * Add given type to cache. It may override type with same name in the cache.
  *
  * @param type JstType
  * @return boolean
  */
 public synchronized boolean addType(JstType type) {
   if (!type.getAlias().equals(type.getName())) {
     addType(type.getAlias(), type);
   }
   return addType(type.getName(), type);
 }