Ejemplo n.º 1
0
  /**
   * @param rootClassName starting class
   * @param constant constant name
   * @return class name that defines given constant or null
   */
  public String getConstantClass(String rootClassName, String constant) {
    ClassInfo info = classes.get(rootClassName);
    if (info == null) {
      return null;
    }
    if (info.constants.contains(constant)) {
      return rootClassName;
    }
    for (String interfaceName : info.implementsInterfaces) {
      String definingClass = getConstantClass(interfaceName, constant);
      if (definingClass != null) {
        return definingClass;
      }
    }

    for (String className : info.extendsClasses) {
      String definingClass = getConstantClass(className, constant);
      if (definingClass != null) {
        return definingClass;
      }
    }

    for (String traitName : info.usesTraits) {
      String definingClass = getConstantClass(traitName, constant);
      if (definingClass != null) {
        return definingClass;
      }
    }
    return null;
  }
Ejemplo n.º 2
0
 @Override
 public DefKey resolve(DefKey source) {
   Def def = resolutions.get(source.getPath());
   if (def != null) {
     return def.defKey;
   }
   return null;
 }