本文整理汇总了Java中com.sun.codemodel.JAnnotatable.annotate方法的典型用法代码示例。如果您正苦于以下问题:Java JAnnotatable.annotate方法的具体用法?Java JAnnotatable.annotate怎么用?Java JAnnotatable.annotate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.codemodel.JAnnotatable
的用法示例。
在下文中一共展示了JAnnotatable.annotate方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: annotate
import com.sun.codemodel.JAnnotatable; //导入方法依赖的package包/类
/**
* Annotate the field according to the recipes given as {@link CPropertyInfo}.
*/
protected void annotate( JAnnotatable field ) {
assert(field!=null);
if (prop instanceof CAttributePropertyInfo) {
annotateAttribute(field);
} else if (prop instanceof CElementPropertyInfo) {
annotateElement(field);
} else if (prop instanceof CValuePropertyInfo) {
field.annotate(XmlValue.class);
} else if (prop instanceof CReferencePropertyInfo) {
annotateReference(field);
}
outline.parent().generateAdapterIfNecessary(prop,field);
}
示例2: setDeprecatedAnnotationAndJavadoc
import com.sun.codemodel.JAnnotatable; //导入方法依赖的package包/类
private void setDeprecatedAnnotationAndJavadoc(Object deprecatedProp,
JAnnotatable annotatable,
JDocCommentable commentable)
{
if (Boolean.TRUE.equals(deprecatedProp) && annotatable != null)
{
annotatable.annotate(Deprecated.class);
}
else if (deprecatedProp instanceof String)
{
if (commentable != null)
{
String deprecatedReason = (String)deprecatedProp;
commentable.javadoc().addDeprecated().append(deprecatedReason);
}
if (annotatable != null)
{
annotatable.annotate(Deprecated.class);
}
}
}
示例3: annotate
import com.sun.codemodel.JAnnotatable; //导入方法依赖的package包/类
public void annotate(JCodeModel codeModel, JAnnotatable annotatable,
XAnnotation<?> xannotation) {
final JClass annotationClass = codeModel.ref(xannotation
.getAnnotationClass());
JAnnotationUse annotationUse = null;
for (JAnnotationUse annotation : annotatable.annotations()) {
if (annotationClass.equals(annotation.getAnnotationClass())) {
annotationUse = annotation;
}
}
if (annotationUse == null) {
annotationUse = annotatable.annotate(annotationClass);
}
final XAnnotationFieldVisitor<?> visitor = createAnnotationFieldVisitor(
codeModel, annotationUse);
for (XAnnotationField<?> field : xannotation.getFieldsList()) {
field.accept(visitor);
}
}
示例4: addHttpMethodAnnotation
import com.sun.codemodel.JAnnotatable; //导入方法依赖的package包/类
/**
* <p>addHttpMethodAnnotation.</p>
*
* @param httpMethod a {@link java.lang.String} object.
* @param annotatable a {@link com.sun.codemodel.JAnnotatable} object.
* @return a {@link org.raml.jaxrs.codegen.core.Context} object.
* @throws java.lang.Exception if any.
*/
@SuppressWarnings("unchecked")
public Context addHttpMethodAnnotation(final String httpMethod, final JAnnotatable annotatable)
throws Exception
{
final Object annotationClass = httpMethodAnnotations.get(httpMethod.toUpperCase());
if (annotationClass == null)
{
final JDefinedClass annotationClazz = createCustomHttpMethodAnnotation(httpMethod);
annotatable.annotate(annotationClazz);
}
else if (annotationClass instanceof JClass)
{
annotatable.annotate((JClass) annotationClass);
}
else if (annotationClass instanceof Class)
{
annotatable.annotate((Class<? extends Annotation>) annotationClass);
}
else
{
throw new IllegalStateException("Found annotation: " + annotationClass + " for HTTP method: "
+ httpMethod);
}
return this;
}
示例5: processConfig
import com.sun.codemodel.JAnnotatable; //导入方法依赖的package包/类
protected void processConfig(AnnotationGenerationInfo annotationGenerationInfo, ISimpleFacet si,
PropertyCustomizerParameters cp) {
JAnnotatable annotable = cp.getter;
JAnnotationUse use = null;
for (JAnnotationUse u : annotable.annotations()) {
if (u.getAnnotationClass().fullName().equals(annotationGenerationInfo.annotationClassName)) {
use = u;
break;
}
}
if (use == null) {
use = annotable.annotate(writer.getModel().ref(annotationGenerationInfo.annotationClassName));
}
writer.addParam(use, si.value(), annotationGenerationInfo.annotationMemberName);
}
示例6: addHttpMethodAnnotation
import com.sun.codemodel.JAnnotatable; //导入方法依赖的package包/类
private void addHttpMethodAnnotation(final String httpMethod, final JAnnotatable annotatable) {
Class<? extends Annotation> annotationClass = httpMethodAnnotations
.get(httpMethod.toUpperCase());
if (annotationClass == null) {
throw new IllegalArgumentException("unsupported HTTP method: " + httpMethod);
}
annotatable.annotate(annotationClass);
}
示例7: annotate
import com.sun.codemodel.JAnnotatable; //导入方法依赖的package包/类
protected void annotate(JAnnotatable annotatable) {
annotatable.annotate(XmlAnyAttribute.class);
}
示例8: annotate
import com.sun.codemodel.JAnnotatable; //导入方法依赖的package包/类
@Override
protected void annotate(JAnnotatable field) {
field.annotate(XmlTransient.class);
}
示例9: addAnnotation
import com.sun.codemodel.JAnnotatable; //导入方法依赖的package包/类
/**
* Add annotation to the annotatable.
*
* @param jAnnotatable
* the annotatable.
* @param annotation
* the annotation class.
*/
private void addAnnotation(final JAnnotatable jAnnotatable,
final Class<? extends Annotation> annotation) {
jAnnotatable.annotate(annotation);
}