javassist.bytecode.annotation.Annotation.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(169)

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

Annotation.<init>介绍

[英]Constructs an annotation including no members. A member can be later added to the created annotation by addMemberValue().
[中]构造不包含成员的注释。成员可以稍后通过addMemberValue()添加到创建的批注中。

代码示例

代码示例来源:origin: redisson/redisson

int annotation(int pos, int type, int numPairs) throws Exception {
  currentAnno = new Annotation(type, pool);
  return super.annotation(pos, type, numPairs);
}

代码示例来源:origin: org.javassist/javassist

@Override
int annotation(int pos, int type, int numPairs) throws Exception {
  currentAnno = new Annotation(type, pool);
  return super.annotation(pos, type, numPairs);
}

代码示例来源:origin: xtuhcy/gecco

@Override
public DynamicField request() {
  Annotation annot = new Annotation(Request.class.getName(), cpool);
  attr.addAnnotation(annot);
  return this;
}

代码示例来源:origin: xtuhcy/gecco

@Override
public DynamicField text(boolean own) {
  Annotation annot = new Annotation(Text.class.getName(), cpool);
  annot.addMemberValue("own", new BooleanMemberValue(own, cpool));
  attr.addAnnotation(annot);
  return this;
}

代码示例来源:origin: xtuhcy/gecco

@Override
public DynamicField ajax(String url) {
  Annotation annot = new Annotation(Ajax.class.getName(), cpool);
  annot.addMemberValue("url", new StringMemberValue(url, cpool));
  attr.addAnnotation(annot);
  return this;
}

代码示例来源:origin: xtuhcy/gecco

@Override
public DynamicField jsonpath(String value) {
  Annotation annot = new Annotation(JSONPath.class.getName(), cpool);
  annot.addMemberValue("value", new StringMemberValue(value, cpool));
  attr.addAnnotation(annot);
  return this;
}

代码示例来源:origin: xtuhcy/gecco

@Override
public DynamicField renderName(String value) {
  Annotation renderName = new Annotation(FieldRenderName.class.getName(), cpool);
  renderName.addMemberValue("value", new StringMemberValue(value, cpool));
  attr.addAnnotation(renderName);
  return this;
}

代码示例来源:origin: xtuhcy/gecco

@Override
public DynamicField requestParameter(String param) {
  Annotation annot = new Annotation(RequestParameter.class.getName(), cpool);
  annot.addMemberValue("value", new StringMemberValue(param, cpool));
  attr.addAnnotation(annot);
  return this;
}

代码示例来源:origin: xtuhcy/gecco

@Override
public DynamicField csspath(String cssPath) {
  Annotation annot = new Annotation(HtmlField.class.getName(), cpool);
  annot.addMemberValue("cssPath", new StringMemberValue(cssPath, cpool));
  attr.addAnnotation(annot);
  return this;
}

代码示例来源:origin: xtuhcy/gecco

@Override
public DynamicField html(boolean outer) {
  Annotation annot = new Annotation(Html.class.getName(), cpool);
  annot.addMemberValue("outer", new BooleanMemberValue(outer, cpool));
  attr.addAnnotation(annot);
  return this;
}

代码示例来源:origin: xtuhcy/gecco

@Override
public DynamicField attr(String value) {
  Annotation annot = new Annotation(Attr.class.getName(), cpool);
  annot.addMemberValue("value", new StringMemberValue(value, cpool));
  attr.addAnnotation(annot);
  return this;
}

代码示例来源:origin: apache/incubator-dubbo

for (Annotation annotation : annotations) {
  if (annotation.annotationType().isAnnotationPresent(Constraint.class)) {
    javassist.bytecode.annotation.Annotation ja = new javassist.bytecode.annotation.Annotation(
        classFile.getConstPool(), pool.getCtClass(annotation.annotationType().getName()));
    Method[] members = annotation.annotationType().getMethods();

代码示例来源:origin: apache/incubator-dubbo

for (Annotation annotation : annotations) {
  if (annotation.annotationType().isAnnotationPresent(Constraint.class)) {
    javassist.bytecode.annotation.Annotation ja = new javassist.bytecode.annotation.Annotation(
        classFile.getConstPool(), pool.getCtClass(annotation.annotationType().getName()));
    Method[] members = annotation.annotationType().getMethods();

代码示例来源:origin: BroadleafCommerce/BroadleafCommerce

protected Annotation getEntityListeners(ConstPool constantPool, Annotation existingEntityListeners, Annotation templateEntityListeners) {
  Annotation listeners = new Annotation(EntityListeners.class.getName(), constantPool);
  ArrayMemberValue listenerArray = new ArrayMemberValue(constantPool);
  Set<MemberValue> listenerMemberValues = new HashSet<>();
  {
    ArrayMemberValue templateListenerValues = (ArrayMemberValue) templateEntityListeners.getMemberValue("value");
    listenerMemberValues.addAll(Arrays.asList(templateListenerValues.getValue()));
    logger.debug("Adding template values to new EntityListeners");
  }
  if (existingEntityListeners != null) {
    ArrayMemberValue oldListenerValues = (ArrayMemberValue) existingEntityListeners.getMemberValue("value");
    listenerMemberValues.addAll(Arrays.asList(oldListenerValues.getValue()));
    logger.debug("Adding previous values to new EntityListeners");
  }
  listenerArray.setValue(listenerMemberValues.toArray(new MemberValue[listenerMemberValues.size()]));
  listeners.addMemberValue("value", listenerArray);
  return listeners;
}

代码示例来源:origin: hibernate/hibernate-orm

private static void addAnnotations(FieldInfo fieldInfo, Class<?>[] annotations) {
  AnnotationsAttribute annotationsAttribute = (AnnotationsAttribute) fieldInfo.getAttribute( AnnotationsAttribute.visibleTag );
  if ( annotationsAttribute == null ) {
    annotationsAttribute = new AnnotationsAttribute( fieldInfo.getConstPool(), AnnotationsAttribute.visibleTag );
    fieldInfo.addAttribute( annotationsAttribute );
  }
  for (Class<?> annotation : annotations) {
    annotationsAttribute.addAnnotation( new Annotation( annotation.getName(), fieldInfo.getConstPool() ) );
  }
}

代码示例来源:origin: xtuhcy/gecco

@Override
public DynamicField jsvar(String var, String jsonpath) {
  Annotation annot = new Annotation(JSVar.class.getName(), cpool);
  annot.addMemberValue("var", new StringMemberValue(var, cpool));
  annot.addMemberValue("jsonpath", new StringMemberValue(jsonpath, cpool));
  attr.addAnnotation(annot);
  return this;
}

代码示例来源:origin: hs-web/hsweb-framework

@SneakyThrows
public Proxy<I> addField(String code, Class<? extends java.lang.annotation.Annotation> annotation, Map<String, Object> annotationProperties) {
  return handleException(() -> {
    CtField ctField = CtField.make(code, ctClass);
    if (null != annotation) {
      ConstPool constPool = ctClass.getClassFile().getConstPool();
      AnnotationsAttribute attributeInfo = new AnnotationsAttribute(constPool, AnnotationsAttribute.visibleTag);
      Annotation ann = new javassist.bytecode.annotation.Annotation(annotation.getName(), constPool);
      if (null != annotationProperties) {
        annotationProperties.forEach((key, value) -> {
          MemberValue memberValue = createMemberValue(value, constPool);
          if (memberValue != null) {
            ann.addMemberValue(key, memberValue);
          }
        });
      }
      attributeInfo.addAnnotation(ann);
      ctField.getFieldInfo().addAttribute(attributeInfo);
    }
    ctClass.addField(ctField);
  });
}

代码示例来源:origin: xtuhcy/gecco

@Override
public DynamicField href(boolean click, String... value) {
  Annotation annot = new Annotation(Href.class.getName(), cpool);
  annot.addMemberValue("click", new BooleanMemberValue(click, cpool));
  
  ArrayMemberValue arrayMemberValue = new ArrayMemberValue(cpool);
  MemberValue[] memberValues = new StringMemberValue[value.length];
  for(int i = 0; i < value.length; i++) {
    memberValues[i] = new StringMemberValue(value[i], cpool);
  }
  arrayMemberValue.setValue(memberValues);
  annot.addMemberValue("value", arrayMemberValue);
  
  attr.addAnnotation(annot);
  return this;
}

代码示例来源:origin: xtuhcy/gecco

@Override
public DynamicField image(String download, String... value) {
  Annotation annot = new Annotation(Image.class.getName(), cpool);
  annot.addMemberValue("download", new StringMemberValue(download, cpool));
  
  ArrayMemberValue arrayMemberValue = new ArrayMemberValue(cpool);
  MemberValue[] memberValues = new StringMemberValue[value.length];
  for(int i = 0; i < value.length; i++) {
    memberValues[i] = new StringMemberValue(value[i], cpool);
  }
  arrayMemberValue.setValue(memberValues);
  annot.addMemberValue("value", arrayMemberValue);
  
  attr.addAnnotation(annot);
  return this;
}

代码示例来源:origin: redisson/redisson

Annotation info = new Annotation(cp, type);
return new AnnotationMemberValue(info, cp);

相关文章