本文整理了Java中javassist.bytecode.annotation.Annotation.addMemberValue()
方法的一些代码示例,展示了Annotation.addMemberValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Annotation.addMemberValue()
方法的具体详情如下:
包路径:javassist.bytecode.annotation.Annotation
类名称:Annotation
方法名:addMemberValue
[英]Adds a new member.
[中]添加新成员。
代码示例来源:origin: redisson/redisson
int memberValuePair(int pos, int nameIndex) throws Exception {
pos = super.memberValuePair(pos, nameIndex);
currentAnno.addMemberValue(nameIndex, currentMember);
return pos;
}
代码示例来源:origin: redisson/redisson
/**
* Adds a new member.
*
* @param nameIndex the index into the constant pool table.
* The entry at that index must be
* a <code>CONSTANT_Utf8_info</code> structure.
* structure representing the member name.
* @param value the member value.
*/
public void addMemberValue(int nameIndex, MemberValue value) {
Pair p = new Pair();
p.name = nameIndex;
p.value = value;
addMemberValue(p);
}
代码示例来源:origin: org.javassist/javassist
@Override
int memberValuePair(int pos, int nameIndex) throws Exception {
pos = super.memberValuePair(pos, nameIndex);
currentAnno.addMemberValue(nameIndex, currentMember);
return pos;
}
代码示例来源:origin: org.javassist/javassist
/**
* Adds a new member.
*
* @param nameIndex the index into the constant pool table.
* The entry at that index must be
* a <code>CONSTANT_Utf8_info</code> structure.
* structure representing the member name.
* @param value the member value.
*/
public void addMemberValue(int nameIndex, MemberValue value) {
Pair p = new Pair();
p.name = nameIndex;
p.value = value;
addMemberValue(p);
}
代码示例来源: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: 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 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: 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: apache/incubator-dubbo
MemberValue memberValue = createMemberValue(
classFile.getConstPool(), pool.get(member.getReturnType().getName()), value);
ja.addMemberValue(member.getName(), memberValue);
代码示例来源:origin: apache/incubator-dubbo
MemberValue memberValue = createMemberValue(
classFile.getConstPool(), pool.get(member.getReturnType().getName()), value);
ja.addMemberValue(member.getName(), memberValue);
代码示例来源: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: 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
/**
* Constructs an annotation that can be accessed through the interface
* represented by <code>clazz</code>. The values of the members are
* not specified.
*
* @param cp the constant pool table.
* @param clazz the interface.
* @throws NotFoundException when the clazz is not found
*/
public Annotation(ConstPool cp, CtClass clazz)
throws NotFoundException
{
// todo Enums are not supported right now.
this(cp.addUtf8Info(Descriptor.of(clazz.getName())), cp);
if (!clazz.isInterface())
throw new RuntimeException(
"Only interfaces are allowed for Annotation creation.");
CtMethod methods[] = clazz.getDeclaredMethods();
if (methods.length > 0) {
members = new LinkedHashMap();
}
for (int i = 0; i < methods.length; i++) {
CtClass returnType = methods[i].getReturnType();
addMemberValue(methods[i].getName(),
createMemberValue(cp, returnType));
}
}
代码示例来源: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);
});
}
内容来源于网络,如有侵权,请联系作者删除!