org.jvnet.hk2.config.Dom.getSymbolSpaceRoot()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(124)

本文整理了Java中org.jvnet.hk2.config.Dom.getSymbolSpaceRoot()方法的一些代码示例,展示了Dom.getSymbolSpaceRoot()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Dom.getSymbolSpaceRoot()方法的具体详情如下:
包路径:org.jvnet.hk2.config.Dom
类名称:Dom
方法名:getSymbolSpaceRoot

Dom.getSymbolSpaceRoot介绍

[英]Locates the DOM that serves as the symbol space root.
[中]

代码示例

代码示例来源:origin: javaee/glassfish

/**
   * Resolves a reference to the given type by the given id.
   */
  public final <T> T reference(Dom dom, String id, Class<T> type) {
    // TODO: this doesn't work in case where type is a subtype of indexed type.
    String name = type.getName();
    dom = dom.getSymbolSpaceRoot(name);
    return type.cast(dom.resolveReference(id,name).get());
  }
}

代码示例来源:origin: javaee/glassfish

protected Object convertLeafValue(Dom parent, Class<?> returnType, String v) {
  // let's look first the fast way.
  Object candidate = parent.getHabitat().getService(returnType, v);
  if (candidate!=null) {
    return returnType.cast(candidate);
  }
  parent = parent.getSymbolSpaceRoot(v);
  Dom dom = parent.resolveReference(v,returnType.getName());
  if (dom!=null) {
    return returnType.cast(dom.get());
  } else {
    throw new IllegalArgumentException("Cannot find an instance of " + returnType + " named " + v);
  }
}

代码示例来源:origin: javaee/glassfish

@Override
public Object get(Dom dom, Type returnType) {
  String id = dom.leafElement(xmlName);
  Class<?> type = Types.erasure(returnType);
  // let's look first the fast way.
  Object candidate = dom.getHabitat().getService(type, id);
  if (candidate!=null) {
    return type.cast(candidate);
  }
  dom = dom.getSymbolSpaceRoot(id);
  return type.cast(dom.resolveReference(id,type.getName()).get());
}

代码示例来源:origin: javaee/glassfish

@Override
public Object get(Dom dom, Type returnType) {
  String id = dom.attribute(xmlName);
  // since the id is supposed to be the element's key, if no key, no element.
  if (id==null) {
    return null;
  }
  Class<?> type = Types.erasure(returnType);
  
  // let's look first the fast way.
  Object candidate = dom.getHabitat().getService(type, id);
  if (candidate!=null) {
    return type.cast(candidate);
  }
  dom = dom.getSymbolSpaceRoot(id);
  return type.cast(dom.resolveReference(id,type.getName()).get());
}

代码示例来源:origin: com.sun.enterprise/config

/**
   * Resolves a reference to the given type by the given id.
   */
  public final <T> T reference(Dom dom, String id, Class<T> type) {
    // TODO: this doesn't work in case where type is a subtype of indexed type.
    String name = type.getName();
    dom = dom.getSymbolSpaceRoot(name);
    return type.cast(dom.resolveReference(id,name).get());
  }
}

代码示例来源:origin: eclipse-ee4j/glassfish

/**
   * Resolves a reference to the given type by the given id.
   */
  public final <T> T reference(Dom dom, String id, Class<T> type) {
    // TODO: this doesn't work in case where type is a subtype of indexed type.
    String name = type.getName();
    dom = dom.getSymbolSpaceRoot(name);
    return type.cast(dom.resolveReference(id,name).get());
  }
}

代码示例来源:origin: org.glassfish.hk2/hk2-config

/**
   * Resolves a reference to the given type by the given id.
   */
  public final <T> T reference(Dom dom, String id, Class<T> type) {
    // TODO: this doesn't work in case where type is a subtype of indexed type.
    String name = type.getName();
    dom = dom.getSymbolSpaceRoot(name);
    return type.cast(dom.resolveReference(id,name).get());
  }
}

代码示例来源:origin: org.glassfish.hk2/config

/**
   * Resolves a reference to the given type by the given id.
   */
  public final <T> T reference(Dom dom, String id, Class<T> type) {
    // TODO: this doesn't work in case where type is a subtype of indexed type.
    String name = type.getName();
    dom = dom.getSymbolSpaceRoot(name);
    return type.cast(dom.resolveReference(id,name).get());
  }
}

代码示例来源:origin: org.glassfish.hk2/config

protected Object convertLeafValue(Dom parent, Class<?> returnType, String v) {
  // let's look first the fast way.
  Object candidate = parent.getHabitat().getComponent(returnType, v);
  if (candidate!=null) {
    return returnType.cast(candidate);
  }
  parent = parent.getSymbolSpaceRoot(v);
  Dom dom = parent==null?null:parent.resolveReference(v,returnType.getName());
  if (dom!=null) {
    return returnType.cast(dom.get());
  } else {
    throw new IllegalArgumentException("Cannot find an instance of " + returnType + " named " + v);
  }
}

代码示例来源:origin: org.glassfish.hk2/hk2-config

protected Object convertLeafValue(Dom parent, Class<?> returnType, String v) {
  // let's look first the fast way.
  Object candidate = parent.getHabitat().getService(returnType, v);
  if (candidate!=null) {
    return returnType.cast(candidate);
  }
  parent = parent.getSymbolSpaceRoot(v);
  Dom dom = parent==null?null:parent.resolveReference(v,returnType.getName());
  if (dom!=null) {
    return returnType.cast(dom.get());
  } else {
    throw new IllegalArgumentException("Cannot find an instance of " + returnType + " named " + v);
  }
}

代码示例来源:origin: eclipse-ee4j/glassfish

protected Object convertLeafValue(Dom parent, Class<?> returnType, String v) {
  // let's look first the fast way.
  Object candidate = parent.getHabitat().getService(returnType, v);
  if (candidate!=null) {
    return returnType.cast(candidate);
  }
  parent = parent.getSymbolSpaceRoot(v);
  Dom dom = parent.resolveReference(v,returnType.getName());
  if (dom!=null) {
    return returnType.cast(dom.get());
  } else {
    throw new IllegalArgumentException("Cannot find an instance of " + returnType + " named " + v);
  }
}

代码示例来源:origin: org.glassfish.hk2/hk2-config

@Override
public Object get(Dom dom, Type returnType) {
  String id = dom.leafElement(xmlName);
  Class<?> type = Types.erasure(returnType);
  // let's look first the fast way.
  Object candidate = dom.getHabitat().getService(type, id);
  if (candidate!=null) {
    return type.cast(candidate);
  }
  dom = dom.getSymbolSpaceRoot(id);
  return type.cast(dom.resolveReference(id,type.getName()).get());
}

代码示例来源:origin: org.glassfish.hk2/config

@Override
public Object get(Dom dom, Type returnType) {
  String id = dom.leafElement(xmlName);
  Class<?> type = Types.erasure(returnType);
  // let's look first the fast way.
  Object candidate = dom.getHabitat().getComponent(type, id);
  if (candidate!=null) {
    return type.cast(candidate);
  }
  dom = dom.getSymbolSpaceRoot(id);
  return type.cast(dom.resolveReference(id,type.getName()).get());
}

代码示例来源:origin: com.sun.enterprise/config

@Override
public Object get(Dom dom, Type returnType) {
  String id = dom.leafElement(xmlName);
  Class<?> type = Types.erasure(returnType);
  // let's look first the fast way.
  Object candidate = dom.getHabitat().getComponent(type, id);
  if (candidate!=null) {
    return type.cast(candidate);
  }
  dom = dom.getSymbolSpaceRoot(id);
  return type.cast(dom.resolveReference(id,type.getName()).get());
}

代码示例来源:origin: eclipse-ee4j/glassfish

@Override
public Object get(Dom dom, Type returnType) {
  String id = dom.leafElement(xmlName);
  Class<?> type = Types.erasure(returnType);
  // let's look first the fast way.
  Object candidate = dom.getHabitat().getService(type, id);
  if (candidate!=null) {
    return type.cast(candidate);
  }
  dom = dom.getSymbolSpaceRoot(id);
  return type.cast(dom.resolveReference(id,type.getName()).get());
}

代码示例来源:origin: org.glassfish.hk2/config

@Override
public Object get(Dom dom, Type returnType) {
  String id = dom.attribute(xmlName);
  // since the id is supposed to be the element's key, if no key, no element.
  if (id==null) {
    return null;
  }
  Class<?> type = Types.erasure(returnType);
  
  // let's look first the fast way.
  Object candidate = dom.getHabitat().getComponent(type, id);
  if (candidate!=null) {
    return type.cast(candidate);
  }
  dom = dom.getSymbolSpaceRoot(id);
  return type.cast(dom.resolveReference(id,type.getName()).get());
}

代码示例来源:origin: com.sun.enterprise/config

@Override
public Object get(Dom dom, Type returnType) {
  String id = dom.attribute(xmlName);
  // since the id is supposed to be the element's key, if no key, no element.
  if (id==null) {
    return null;
  }
  Class<?> type = Types.erasure(returnType);
  
  // let's look first the fast way.
  Object candidate = dom.getHabitat().getComponent(type, id);
  if (candidate!=null) {
    return type.cast(candidate);
  }
  dom = dom.getSymbolSpaceRoot(id);
  return type.cast(dom.resolveReference(id,type.getName()).get());
}

代码示例来源:origin: org.glassfish.hk2/hk2-config

@Override
public Object get(Dom dom, Type returnType) {
  String id = dom.attribute(xmlName);
  // since the id is supposed to be the element's key, if no key, no element.
  if (id==null) {
    return null;
  }
  Class<?> type = Types.erasure(returnType);
  
  // let's look first the fast way.
  Object candidate = dom.getHabitat().getService(type, id);
  if (candidate!=null) {
    return type.cast(candidate);
  }
  dom = dom.getSymbolSpaceRoot(id);
  return type.cast(dom.resolveReference(id,type.getName()).get());
}

代码示例来源:origin: eclipse-ee4j/glassfish

@Override
public Object get(Dom dom, Type returnType) {
  String id = dom.attribute(xmlName);
  // since the id is supposed to be the element's key, if no key, no element.
  if (id==null) {
    return null;
  }
  Class<?> type = Types.erasure(returnType);
  
  // let's look first the fast way.
  Object candidate = dom.getHabitat().getService(type, id);
  if (candidate!=null) {
    return type.cast(candidate);
  }
  dom = dom.getSymbolSpaceRoot(id);
  return type.cast(dom.resolveReference(id,type.getName()).get());
}

相关文章