groovy.util.AntBuilder.buildAttributes()方法的使用及代码示例

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

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

AntBuilder.buildAttributes介绍

[英]Builds an Attributes from a Map
[中]从映射生成属性

代码示例

代码示例来源:origin: apache/groovy

protected Object createNode(final Object name, final Map attributes) {
  final Attributes attrs = buildAttributes(attributes);
  String tagName = name.toString();
  String ns = "";
  if (name instanceof QName) {
    QName q = (QName) name;
    tagName = q.getLocalPart();
    ns = q.getNamespaceURI();
  }
  // import can be used only as top level element
  if ("import".equals(name)) {
    antXmlContext.setCurrentTarget(implicitTarget);
  } else if ("target".equals(name) && !insideTask) {
    return onStartTarget(attrs, tagName, ns);
  } else if ("defineTarget".equals(name) && !insideTask) {
    return onDefineTarget(attrs, "target", ns);
  }
  try {
    antElementHandler.onStartElement(ns, tagName, tagName, attrs, antXmlContext);
  }
  catch (final SAXParseException e) {
    log.log(Level.SEVERE, "Caught: " + e, e);
  }
  insideTask = true;
  final RuntimeConfigurable wrapper = antXmlContext.getWrapperStack().lastElement();
  return wrapper.getProxy();
}

代码示例来源:origin: org.codehaus.groovy/groovy-all-minimal

protected Object createNode(final Object name, final Map attributes) {
  final Attributes attrs = buildAttributes(attributes);
  String tagName = name.toString();
  String ns = "";
  if (name instanceof QName) {
    QName q = (QName)name;
    tagName = q.getLocalPart();
    ns = q.getNamespaceURI();
  }
  // import can be used only as top level element
  if ("import".equals(name)) {
    antXmlContext.setCurrentTarget(implicitTarget);
  }
  else if ("target".equals(name)) {
    return onStartTarget(attrs, tagName, ns);
  }
  try
  {
    antElementHandler.onStartElement(ns, tagName, tagName, attrs, antXmlContext);
  }
  catch (final SAXParseException e)
  {
    log.log(Level.SEVERE, "Caught: " + e, e);
  }
  
  final RuntimeConfigurable wrapper = (RuntimeConfigurable) antXmlContext.getWrapperStack().lastElement();
  return wrapper.getProxy();
}

代码示例来源:origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm

protected Object createNode(final Object name, final Map attributes) {
  final Attributes attrs = buildAttributes(attributes);
  String tagName = name.toString();
  String ns = "";
  if (name instanceof QName) {
    QName q = (QName) name;
    tagName = q.getLocalPart();
    ns = q.getNamespaceURI();
  }
  // import can be used only as top level element
  if ("import".equals(name)) {
    antXmlContext.setCurrentTarget(implicitTarget);
  } else if ("target".equals(name) && !insideTask) {
    return onStartTarget(attrs, tagName, ns);
  }
  try {
    antElementHandler.onStartElement(ns, tagName, tagName, attrs, antXmlContext);
  }
  catch (final SAXParseException e) {
    log.log(Level.SEVERE, "Caught: " + e, e);
  }
  insideTask = true;
  final RuntimeConfigurable wrapper = (RuntimeConfigurable) antXmlContext.getWrapperStack().lastElement();
  return wrapper.getProxy();
}

代码示例来源:origin: org.kohsuke.droovy/groovy

protected Object createNode(final Object name, final Map attributes) {
  final Attributes attrs = buildAttributes(attributes);
  String tagName = name.toString();
  String ns = "";
  if (name instanceof QName) {
    QName q = (QName)name;
    tagName = q.getLocalPart();
    ns = q.getNamespaceURI();
  }
  // import can be used only as top level element
  if ("import".equals(name)) {
    antXmlContext.setCurrentTarget(implicitTarget);
  }
  else if ("target".equals(name)) {
    return onStartTarget(attrs, tagName, ns);
  }
  try
  {
    antElementHandler.onStartElement(ns, tagName, tagName, attrs, antXmlContext);
  }
  catch (final SAXParseException e)
  {
    log.log(Level.SEVERE, "Caught: " + e, e);
  }
  
  final RuntimeConfigurable wrapper = (RuntimeConfigurable) antXmlContext.getWrapperStack().lastElement();
  return wrapper.getProxy();
}

代码示例来源:origin: org.codehaus.groovy/groovy-jdk14

protected Object createNode(final Object name, final Map attributes) {
  final Attributes attrs = buildAttributes(attributes);
  String tagName = name.toString();
  String ns = "";
  if (name instanceof QName) {
    QName q = (QName)name;
    tagName = q.getLocalPart();
    ns = q.getNamespaceURI();
  }
  // import can be used only as top level element
  if ("import".equals(name)) {
    antXmlContext.setCurrentTarget(implicitTarget);
  }
  else if ("target".equals(name)) {
    return onStartTarget(attrs, tagName, ns);
  }
  try
  {
    antElementHandler.onStartElement(ns, tagName, tagName, attrs, antXmlContext);
  }
  catch (final SAXParseException e)
  {
    log.log(Level.SEVERE, "Caught: " + e, e);
  }
  
  final RuntimeConfigurable wrapper = (RuntimeConfigurable) antXmlContext.getWrapperStack().lastElement();
  return wrapper.getProxy();
}

代码示例来源:origin: org.codehaus.groovy/groovy-ant

protected Object createNode(final Object name, final Map attributes) {
  final Attributes attrs = buildAttributes(attributes);
  String tagName = name.toString();
  String ns = "";
  if (name instanceof QName) {
    QName q = (QName) name;
    tagName = q.getLocalPart();
    ns = q.getNamespaceURI();
  }
  // import can be used only as top level element
  if ("import".equals(name)) {
    antXmlContext.setCurrentTarget(implicitTarget);
  } else if ("target".equals(name) && !insideTask) {
    return onStartTarget(attrs, tagName, ns);
  } else if ("defineTarget".equals(name) && !insideTask) {
    return onDefineTarget(attrs, "target", ns);
  }
  try {
    antElementHandler.onStartElement(ns, tagName, tagName, attrs, antXmlContext);
  }
  catch (final SAXParseException e) {
    log.log(Level.SEVERE, "Caught: " + e, e);
  }
  insideTask = true;
  final RuntimeConfigurable wrapper = antXmlContext.getWrapperStack().lastElement();
  return wrapper.getProxy();
}

相关文章