org.granite.util.XMap.getOne()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(81)

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

XMap.getOne介绍

[英]Returns a new XMap instance with the first element that matches the supplied XPath expression or null if this XMap root element is null, or if XPath evaluation result is null, or this result is not an Element. Returned XMap contains original child element of the root element of this XMap so modifications made to the child element affect this XMap instance as well.
[中]返回一个新的XMap实例,其中第一个元素与提供的XPath表达式匹配,如果此XMap根元素为null,或者如果XPath求值结果为null,或者此结果不是元素,则返回null。返回的XMap包含此XMap根元素的原始子元素,因此对子元素所做的修改也会影响此XMap实例。

代码示例

代码示例来源:origin: org.graniteds/granite-server

public static Channel forElement(XMap element) {
    String id = element.get("@id");
    String className = element.get("@class");

    XMap endPointElt = element.getOne("endpoint");
    if (endPointElt == null)
      throw new RuntimeException("Excepting a 'endpoint' element in 'channel-definition': " + id);
    EndPoint endPoint = EndPoint.forElement(endPointElt);

    XMap properties = new XMap(element.getOne("properties"));

    return new Channel(id, className, endPoint, properties);
  }
}

代码示例来源:origin: org.graniteds/granite-server

private void loadCustomInstantiators(XMap element, boolean custom) {
  XMap instantiators = element.getOne("instantiators");
  if (instantiators != null) {
    for (XMap instantiator : instantiators.getAll("instantiator"))
      this.instantiators.put(instantiator.get("@type"), instantiator.get("."));
  }
}

代码示例来源:origin: org.graniteds/granite-client

public static Channel forElement(XMap element) {
    String id = element.get("@id");
    String className = element.get("@class");

    XMap endPointElt = element.getOne("endpoint");
    if (endPointElt == null)
      throw new RuntimeException("Excepting a 'endpoint' element in 'channel-definition': " + id);
    EndPoint endPoint = EndPoint.forElement(endPointElt);

    XMap properties = new XMap(element.getOne("properties"));

    return new Channel(id, className, endPoint, properties);
  }
}

代码示例来源:origin: org.graniteds/granite-client-java

private void loadCustomInstantiators(XMap element, boolean custom) {
  XMap instantiators = element.getOne("instantiators");
  if (instantiators != null) {
    for (XMap instantiator : instantiators.getAll("instantiator"))
      this.instantiators.put(instantiator.get("@type"), instantiator.get("."));
  }
}

代码示例来源:origin: org.graniteds/granite-client-javafx

private void loadCustomInstantiators(XMap element, boolean custom) {
  XMap instantiators = element.getOne("instantiators");
  if (instantiators != null) {
    for (XMap instantiator : instantiators.getAll("instantiator"))
      this.instantiators.put(instantiator.get("@type"), instantiator.get("."));
  }
}

代码示例来源:origin: org.graniteds/granite-client

private void loadCustomInstantiators(XMap element, boolean custom) {
  XMap instantiators = element.getOne("instantiators");
  if (instantiators != null) {
    for (XMap instantiator : instantiators.getAll("instantiator"))
      this.instantiators.put(instantiator.get("@type"), instantiator.get("."));
  }
}

代码示例来源:origin: org.graniteds/granite-server

private void loadCustomMethodMatcher(XMap element, boolean custom) {
  XMap methodMatcher = element.getOne("method-matcher");
  if (methodMatcher != null) {
    String type = methodMatcher.get("@type");
    try {
      this.methodMatcher = (MethodMatcher)TypeUtil.newInstance(type);
    } catch (Exception e) {
      throw new GraniteConfigException("Could not construct method matcher: " + type, e);
    }
  }
}

代码示例来源:origin: org.graniteds/granite-server

private void loadCustomClassGetter(XMap element, boolean custom) {
  XMap classGetter = element.getOne("class-getter");
  if (classGetter != null) {
    String type = classGetter.get("@type");
    try {
      this.classGetter = (ClassGetter)TypeUtil.newInstance(type);
      classGetterSet = true;
    } catch (Exception e) {
      throw new GraniteConfigException("Could not instantiate ClassGetter: " + type, e);
    }
  }
}

代码示例来源:origin: org.graniteds/granite-client

private void loadCustomClassGetter(XMap element, boolean custom) {
  XMap classGetter = element.getOne("class-getter");
  if (classGetter != null) {
    String type = classGetter.get("@type");
    try {
      this.classGetter = (ClassGetter)TypeUtil.newInstance(type);
      classGetterSet = true;
    } catch (Exception e) {
      throw new GraniteConfigException("Could not instantiate ClassGetter: " + type, e);
    }
  }
}

代码示例来源:origin: org.graniteds/granite-client-javafx

private void loadCustomClassGetter(XMap element, boolean custom) {
  XMap classGetter = element.getOne("class-getter");
  if (classGetter != null) {
    String type = classGetter.get("@type");
    try {
      this.classGetter = (ClassGetter)TypeUtil.newInstance(type);
      classGetterSet = true;
    } catch (Exception e) {
      throw new GraniteConfigException("Could not instantiate ClassGetter: " + type, e);
    }
  }
}

代码示例来源:origin: org.graniteds/granite-server

private void loadCustomInvocationListener(XMap element, boolean custom) {
  XMap invocationListener = element.getOne("invocation-listener");
  if (invocationListener != null) {
    String type = invocationListener.get("@type");
    try {
      this.invocationListener = (ServiceInvocationListener)TypeUtil.newInstance(type);
    } catch (Exception e) {
      throw new GraniteConfigException("Could not instantiate ServiceInvocationListener: " + type, e);
    }
  }
}

代码示例来源:origin: org.graniteds/granite-client

private void loadCustomAMF3MessageInterceptor(XMap element, boolean custom) {
  XMap interceptor = element.getOne("amf3-message-interceptor");
  if (interceptor != null) {
    String type = interceptor.get("@type");
    try {
      amf3MessageInterceptor = (AMF3MessageInterceptor)TypeUtil.newInstance(type);
    } catch (Exception e) {
      throw new GraniteConfigException("Could not construct amf3 message interceptor: " + type, e);
    }
  }
}

代码示例来源:origin: org.graniteds/granite-client

private void loadCustomInvocationListener(XMap element, boolean custom) {
  XMap invocationListener = element.getOne("invocation-listener");
  if (invocationListener != null) {
    String type = invocationListener.get("@type");
    try {
      this.invocationListener = (ServiceInvocationListener)TypeUtil.newInstance(type);
    } catch (Exception e) {
      throw new GraniteConfigException("Could not instantiate ServiceInvocationListener: " + type, e);
    }
  }
}

代码示例来源:origin: org.graniteds/granite-client

private void loadCustomMessageSelector(XMap element, boolean custom) {
  XMap selector = element.getOne("message-selector");
  if (selector != null) {
    String type = selector.get("@type");
    try {
      messageSelectorConstructor = TypeUtil.getConstructor(type, new Class<?>[]{ String.class });
    } catch (Exception e) {
      throw new GraniteConfigException("Could not construct message selector: " + type, e);
    }
  }
}

代码示例来源:origin: org.graniteds/granite-client-java

private void loadCustomClassGetter(XMap element, boolean custom) {
  XMap classGetter = element.getOne("class-getter");
  if (classGetter != null) {
    String type = classGetter.get("@type");
    try {
      this.classGetter = (ClassGetter)TypeUtil.newInstance(type);
      classGetterSet = true;
    } catch (Exception e) {
      throw new GraniteConfigException("Could not instantiate ClassGetter: " + type, e);
    }
  }
}

代码示例来源:origin: org.graniteds/granite-client

private void loadCustomDistributedDataFactory(XMap element, boolean custom) {
  XMap distributedDataFactory = element.getOne("distributed-data-factory");
  if (distributedDataFactory != null) {
    String type = distributedDataFactory.get("@type");
    try {
      this.distributedDataFactory = (DistributedDataFactory)TypeUtil.newInstance(type);
    } catch (Exception e) {
      throw new GraniteConfigException("Could not construct build distributed data factory: " + type, e);
    }
  }
}

代码示例来源:origin: org.graniteds/granite-client

private void loadCustomMethodMatcher(XMap element, boolean custom) {
  XMap methodMatcher = element.getOne("method-matcher");
  if (methodMatcher != null) {
    String type = methodMatcher.get("@type");
    try {
      this.methodMatcher = (MethodMatcher)TypeUtil.newInstance(type);
    } catch (Exception e) {
      throw new GraniteConfigException("Could not construct method matcher: " + type, e);
    }
  }
}

代码示例来源:origin: org.graniteds/granite-client

public static Factory forElement(XMap element) {
    String id = element.get("@id");
    String className = element.get("@class");
    XMap properties = new XMap(element.getOne("properties"));

    return new Factory(id, className, properties);
  }
}

代码示例来源:origin: org.graniteds/granite-server

public static Adapter forElement(XMap element) {
    String id = element.get("@id");
    String className = element.get("@class");
    XMap properties = new XMap(element.getOne("properties"));

    return new Adapter(id, className, properties);
  }
}

代码示例来源:origin: org.graniteds/granite-client

public static Adapter forElement(XMap element) {
    String id = element.get("@id");
    String className = element.get("@class");
    XMap properties = new XMap(element.getOne("properties"));

    return new Adapter(id, className, properties);
  }
}

相关文章