当前位置: 首页>>代码示例>>Java>>正文


Java ElementValuePair类代码示例

本文整理汇总了Java中com.sun.javadoc.AnnotationDesc.ElementValuePair的典型用法代码示例。如果您正苦于以下问题:Java ElementValuePair类的具体用法?Java ElementValuePair怎么用?Java ElementValuePair使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ElementValuePair类属于com.sun.javadoc.AnnotationDesc包,在下文中一共展示了ElementValuePair类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processAnnotations

import com.sun.javadoc.AnnotationDesc.ElementValuePair; //导入依赖的package包/类
protected void processAnnotations(AnnotationDesc annotation, APIParameter apiParameter) {
	if (annotation.annotationType().qualifiedName().startsWith("org.springframework.web.bind.annotation.")) {
		for (ElementValuePair pair : annotation.elementValues()) {
			if (pair.element().name().equals("value") || pair.element().name().equals("name")) {
				if (pair.value() != null) {
					apiParameter.setName(pair.value().toString().replace("\"", ""));
				}
			}
			if (pair.element().name().equals("required")) {
				if (pair.value().value().equals(true)) {
					apiParameter.setParameterOccurs(ParameterOccurs.REQUIRED);
				} else {
					apiParameter.setParameterOccurs(ParameterOccurs.OPTIONAL);
				}
			}
		}
	}
}
 
开发者ID:WinRoad-NET,项目名称:wrdocletbase,代码行数:19,代码来源:AbstractDocBuilder.java

示例2: parseRequestMapping

import com.sun.javadoc.AnnotationDesc.ElementValuePair; //导入依赖的package包/类
@Override
protected RequestMapping parseRequestMapping(MethodDoc method) {
	RequestMapping mapping = new RequestMapping();
	mapping.setContainerName(method.containingClass().simpleTypeName());
	AnnotationDesc[] annotations = method.annotations();
	String url = method.toString().replaceFirst(
			method.containingClass().qualifiedName() + ".", "");
	for (int i = 0; i < annotations.length; i++) {
		if (annotations[i].annotationType().name().equals("WebMethod")) {
			for (ElementValuePair p : annotations[i].elementValues()) {
				if (p.element().name().equals("operationName")) {
					url = url.replace(method.name(), p.value().value()
							.toString().replace("\"", ""));
				}
			}
		}
	}
	mapping.setUrl(url);
	mapping.setTooltip(method.containingClass().simpleTypeName());
	mapping.setContainerName(method.containingClass().simpleTypeName());
	return mapping;
}
 
开发者ID:WinRoad-NET,项目名称:wrdocletbase,代码行数:23,代码来源:SOAPDocBuilder.java

示例3: getFieldValidatorDesc

import com.sun.javadoc.AnnotationDesc.ElementValuePair; //导入依赖的package包/类
protected String getFieldValidatorDesc(FieldDoc fieldDoc) {
	StringBuilder strBuilder = new StringBuilder();
	for (AnnotationDesc annotationDesc : fieldDoc.annotations()) {
		if (annotationDesc.annotationType().qualifiedTypeName().startsWith("org.hibernate.validator.constraints")
				|| annotationDesc.annotationType().qualifiedTypeName().startsWith("javax.validation.constraints")
				|| annotationDesc.annotationType().qualifiedTypeName().startsWith("lombok.NonNull")) {
			strBuilder.append("@");
			strBuilder.append(annotationDesc.annotationType().name());
			if (annotationDesc.elementValues().length > 0) {
				strBuilder.append("(");
				boolean isFirstElement = true;
				for (AnnotationDesc.ElementValuePair elementValuePair : annotationDesc.elementValues()) {
					if (!isFirstElement) {
						strBuilder.append(",");
					}
					strBuilder.append(elementValuePair.element().name());
					strBuilder.append("=");
					strBuilder.append(
							net.winroad.wrdoclet.utils.Util.decodeUnicode(elementValuePair.value().toString()));
					isFirstElement = false;
				}
				strBuilder.append(")");
			}
			strBuilder.append(" ");
		}
	}
	return strBuilder.toString();
}
 
开发者ID:WinRoad-NET,项目名称:wrdocletbase,代码行数:29,代码来源:AbstractDocBuilder.java

示例4: getOutputParam

import com.sun.javadoc.AnnotationDesc.ElementValuePair; //导入依赖的package包/类
@Override
protected APIParameter getOutputParam(MethodDoc method) {
	APIParameter apiParameter = null;
	if (method.returnType() != null) {
		apiParameter = new APIParameter();
		AnnotationDesc[] annotations = method.annotations();
		boolean isResNameCustomized = false;
		for (int i = 0; i < annotations.length; i++) {
			if (annotations[i].annotationType().name().equals("WebResult")) {
				for (ElementValuePair p : annotations[i].elementValues()) {
					if (p.element().name().equals("name")) {
						apiParameter.setName(p.value().value().toString());
						isResNameCustomized = true;
					}
				}
			}
		}
		if (!isResNameCustomized) {
			apiParameter.setName("return");
		}
		apiParameter.setParameterOccurs(ParameterOccurs.REQUIRED);
		apiParameter.setType(this.getTypeName(method.returnType(), false));
		for (Tag tag : method.tags("return")) {
			apiParameter.setDescription(tag.text());
		}
		HashSet<String> processingClasses = new HashSet<String>();
		apiParameter.setFields(this.getFields(method.returnType(),
				ParameterType.Response, processingClasses));
		apiParameter.setHistory(this.getModificationHistory(method
				.returnType()));
	}
	return apiParameter;
}
 
开发者ID:WinRoad-NET,项目名称:wrdocletbase,代码行数:34,代码来源:SOAPDocBuilder.java

示例5: getAnnotationValue

import com.sun.javadoc.AnnotationDesc.ElementValuePair; //导入依赖的package包/类
public static Object getAnnotationValue(final AnnotationDesc annotation, final String name) {
	for (final ElementValuePair elementValuePair : annotation.elementValues()) {
		if (elementValuePair.element().name().equals(name)) {
			return elementValuePair.value().value();
		}
	}
	return null;
}
 
开发者ID:azuki-framework,项目名称:azuki-doclet-jaxrs,代码行数:9,代码来源:DocletUtility.java

示例6: toAnnotationNode

import com.sun.javadoc.AnnotationDesc.ElementValuePair; //导入依赖的package包/类
/**
 *
 * @return an "annotation" XML node for the annotation.
 */
private static XMLNode toAnnotationNode(AnnotationDesc annotation) {
  if (annotation == null) return null;
  XMLNode node = new XMLNode("annotation");
  node.attribute("name", annotation.annotationType().name());
  for (ElementValuePair pair : annotation.elementValues()) {
    node.child(toPairNode(pair));
  }
  return node;
}
 
开发者ID:pageseeder,项目名称:xmldoclet,代码行数:14,代码来源:XMLDoclet.java

示例7: toPairNode

import com.sun.javadoc.AnnotationDesc.ElementValuePair; //导入依赖的package包/类
/**
 *
 * @return an "element" XML node for the element value pair.
 */
private static XMLNode toPairNode(ElementValuePair pair) {
  if (pair == null) return null;
  XMLNode node = new XMLNode("element");
  AnnotationTypeElementDoc element = pair.element();
  node.attribute("name", element.name());
  node.child(toComment(element));
  node.child(toAnnotationValueNode(pair.value()));
  return node;
}
 
开发者ID:pageseeder,项目名称:xmldoclet,代码行数:14,代码来源:XMLDoclet.java

示例8: getAnnotationDescValue

import com.sun.javadoc.AnnotationDesc.ElementValuePair; //导入依赖的package包/类
public static Object getAnnotationDescValue(AnnotationDesc annotationDesc, String name) {
	for (ElementValuePair elementValuePair : annotationDesc.elementValues()) {
		if (elementValuePair.element().name().equals(name)) {
			return elementValuePair.value().value();
		}
	};
	return null;
}
 
开发者ID:linkeer8802,项目名称:api-resolver,代码行数:9,代码来源:DocletUtil.java

示例9: getValue

import com.sun.javadoc.AnnotationDesc.ElementValuePair; //导入依赖的package包/类
/**
 * Get annotation value.
 * 
 * @returns the value or <code>null</code> if key was not found.
 */
private String getValue(AnnotationDesc annotation, String key) {
	for (ElementValuePair pair : annotation.elementValues()) {
		if (pair.element().name().equals(key)) {
			// double call to value is correct as this returns the actual
			// value object.
			return pair.value().value().toString();
		}
	}
	return null;
}
 
开发者ID:vimaier,项目名称:conqat,代码行数:16,代码来源:ConQATTaglet.java

示例10: getAnnotationValueString

import com.sun.javadoc.AnnotationDesc.ElementValuePair; //导入依赖的package包/类
/**
 * Method to return the String annotation value, that belongs to some key
 *
 * @param annotation
 * @param key
 * @return the value, that belongs to the key or null, if no such exists
 */
public static String getAnnotationValueString(AnnotationDesc annotation, String key) {
    ElementValuePair[] evp = annotation.elementValues();

    for (ElementValuePair e : evp) {
        if (e.element().toString().equals(key)) {
            return e.value().toString().substring(1, e.value().toString().length() - 1);
        }
    }

    return null;
}
 
开发者ID:arahusky,项目名称:performance_javadoc,代码行数:19,代码来源:AnnotationParser.java

示例11: getAnnotationValueDouble

import com.sun.javadoc.AnnotationDesc.ElementValuePair; //导入依赖的package包/类
/**
 * Method to return the Double annotation value, that belongs to some key
 *
 * @param annotation
 * @param key
 * @return the value, that belongs to the key or null, if no such exists
 */
public static double getAnnotationValueDouble(AnnotationDesc annotation, String key) throws NumberFormatException {
    ElementValuePair[] evp = annotation.elementValues();

    for (ElementValuePair e : evp) {
        if (e.element().toString().equals(key)) {
            return Double.parseDouble(e.value().toString());
        }
    }

    //to indicate, that nothing was found
    return Double.MIN_VALUE;
}
 
开发者ID:arahusky,项目名称:performance_javadoc,代码行数:20,代码来源:AnnotationParser.java

示例12: getAnnotationValueBoolean

import com.sun.javadoc.AnnotationDesc.ElementValuePair; //导入依赖的package包/类
/**
 * Method to return the boolean annotation value, that belongs to some key
 *
 * @param annotation
 * @param key
 * @return the value, that belongs to the key or null, if no such exists
 */
public static boolean getAnnotationValueBoolean(AnnotationDesc annotation, String key) throws NumberFormatException {
    ElementValuePair[] evp = annotation.elementValues();

    for (ElementValuePair e : evp) {
        if (e.element().toString().equals(key)) {
            return Boolean.parseBoolean(e.value().toString());
        }
    }

    //default value of axis is true
    return true;
}
 
开发者ID:arahusky,项目名称:performance_javadoc,代码行数:20,代码来源:AnnotationParser.java

示例13: toPairNode

import com.sun.javadoc.AnnotationDesc.ElementValuePair; //导入依赖的package包/类
/**
 *
 * @return an "element" XML node for the element value pair.
 */
private static XMLNode toPairNode(ElementValuePair pair) {
  if (pair == null) return null;
  XMLNode node = new XMLNode("element");
  AnnotationTypeElementDoc element = pair.element();
  node.attribute("name", element.name());
  node.child(toShortComment(element));
  node.child(toComment(element));
  node.child(toAnnotationValueNode(pair.value()));
  return node;
}
 
开发者ID:bazooka,项目名称:bazooka-wo-xmldoclet,代码行数:15,代码来源:XMLDoclet.java

示例14: renderDocsFor

import com.sun.javadoc.AnnotationDesc.ElementValuePair; //导入依赖的package包/类
void renderDocsFor(Crawl crawl, Configurable c, File outDir)
throws IOException {
  Element e;
  {
    Element.Builder eb = Element.newBuilder();
    eb.setClassName(c.configurableClass.qualifiedName());
    String commentText = c.configurableClass.commentText();
    if (!Strings.isNullOrEmpty(commentText)) {
      eb.setCommentHtml(commentToHtml(commentText));
    }
    eb.setIsEnum(c.configurableClass.isEnum());
    eb.setIsMojo(c.isMojo);
    if (c.isMojo) {
      String goal = null;
      Optional<AnnotationDesc> mojoAnnot = annotationNamed(
          c.configurableClass, MOJO_ANNOTATION_NAME);
      if (mojoAnnot.isPresent()) {
        for (ElementValuePair p : mojoAnnot.get().elementValues()) {
          if ("name".equals(p.element().name())) {
            goal = (String) p.value().value();
          }
        }
      }
      if (goal != null) {
        eb.setGoal(goal);
      }
    }
    eb.addAllTagName(c.tagNames);
    // Present in lexicographic order.
    for (String paramName : Sets.newTreeSet(c.params.keySet())) {
      ParameterInfo pi = c.params.get(paramName);
      Parameter.Builder pb = Parameter.newBuilder();
      pb.setName(pi.name);
      if (pi.field.isPresent()) {
        FieldDoc fd = pi.field.get();
        pb.setField(fd.containingClass().qualifiedName() + "#" + fd.name());

      }
      if (pi.setter.isPresent()) {
        MethodDoc s = pi.setter.get();
        pb.setMethod(
            s.containingClass().qualifiedName()
            + "#" + s.name() + s.flatSignature());
      }
      pb.setSourcePosition(pi.source().position().toString());
      Type t = pi.getType();
      pb.setType(t.simpleTypeName());
      Optional<Configurable> tc = crawl.foundConfigurable(pi.source(), t);
      if (tc.isPresent()) {
        pb.setTypeUrl(urlFor(tc.get()));
      }
      String pCommentText = pi.getCommentText();
      if (!Strings.isNullOrEmpty(pCommentText)) {
        pb.setCommentHtml(commentToHtml(pCommentText));
      }
      eb.addParam(pb);
    }
    e = eb.build();
  }


  ImmutableMap<String, Object> data =
      ImmutableMap.<String, Object>of("e", e);
  SoySauce.Renderer renderer = soySauce
      .renderTemplate("com.google.closure.doclet.soy.Configurable")
      .setData(data)
      ;

  Continuation<String> renderedHtml = renderer.render();
  while (!renderedHtml.result().isDone()) {
    renderedHtml = renderedHtml.continueRender();
  }

  File outFile = new File(outDir.toURI().resolve(urlFor(c)));

  CharSink dest = Files.asCharSink(outFile, Charsets.UTF_8);
  try (Writer out = dest.openBufferedStream()) {
    out.write(renderedHtml.get());
  }
}
 
开发者ID:mikesamuel,项目名称:closure-maven-plugin,代码行数:81,代码来源:PluginConfigDoclet.java


注:本文中的com.sun.javadoc.AnnotationDesc.ElementValuePair类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。