void classMemberValue(int pos, int index) throws Exception { currentMember = new ClassMemberValue(index, pool); super.classMemberValue(pos, index); }
@Override void classMemberValue(int pos, int index) throws Exception { currentMember = new ClassMemberValue(index, pool); super.classMemberValue(pos, index); }
@SuppressWarnings("all") public static MemberValue createMemberValue(Object value, ConstPool constPool) { MemberValue memberValue = null; if (value instanceof Integer) { memberValue = new IntegerMemberValue(constPool, ((Integer) value)); } else if (value instanceof Boolean) { memberValue = new BooleanMemberValue((Boolean) value, constPool); } else if (value instanceof Long) { memberValue = new LongMemberValue((Long) value, constPool); } else if (value instanceof String) { memberValue = new StringMemberValue((String) value, constPool); } else if (value instanceof Class) { memberValue = new ClassMemberValue(((Class) value).getName(), constPool); } else if (value instanceof Object[]) { Object[] arr = ((Object[]) value); ArrayMemberValue arrayMemberValue = new ArrayMemberValue(new ClassMemberValue(arr[0].getClass().getName(), constPool), constPool); arrayMemberValue.setValue(Arrays.stream(arr) .map(o -> createMemberValue(o, constPool)) .toArray(MemberValue[]::new)); memberValue = arrayMemberValue; } return memberValue; }
return new DoubleMemberValue(cp); else if (type.getName().equals("java.lang.Class")) return new ClassMemberValue(cp); else if (type.getName().equals("java.lang.String")) return new StringMemberValue(cp);
annot.addMemberValue("cancelMethod", new StringMemberValue(ctMethod.getName(), constpool)); ClassMemberValue classMemberValue = new ClassMemberValue("org.mengyun.tcctransaction.dubbo.context.DubboTransactionContextEditor", constpool); annot.addMemberValue("transactionContextEditor", classMemberValue);
namedQuery.addMemberValue("query", queryString); ClassMemberValue resultClass = new ClassMemberValue(constantPool); resultClass.setValue(query.resultClass().getName()); namedQuery.addMemberValue("resultClass", resultClass);
return new DoubleMemberValue(cp); else if (type.getName().equals("java.lang.Class")) return new ClassMemberValue(cp); else if (type.getName().equals("java.lang.String")) return new StringMemberValue(cp);
public void visitClassMemberValue(ClassMemberValue classMemberValue) { value = new ClassMemberValue(cp); } }
public CtAnnotationBuilder addClassMember(String name, String value) { ClassMemberValue classValue = new ClassMemberValue(value, constPool); annotation.addMemberValue(name, classValue); return this; }
public void addClassParameter(String name, String value) { ClassMemberValue classValue = new ClassMemberValue(value, constPool); annotation.addMemberValue(name, classValue); }
void classMemberValue(int pos, int index) throws Exception { currentMember = new ClassMemberValue(index, pool); super.classMemberValue(pos, index); }
void classMemberValue(int pos, int index) throws Exception { currentMember = new ClassMemberValue(index, pool); super.classMemberValue(pos, index); }
void classMemberValue(int index) throws Exception { currentMember = new ClassMemberValue(index, pool); super.classMemberValue(index); }
protected ClassMemberValue createClassMemberValue(Class<?> type, ConstPool cp) { int idx = cp.addUtf8Info(descriptor(type)); return new ClassMemberValue(idx, cp); }
protected ClassMemberValue createClassMemberValue(Class<?> type, ConstPool cp) { int idx = cp.addUtf8Info(descriptor(type)); return new ClassMemberValue(idx, cp); }
private static AnnotationsAttribute addSimplifiedClassAnnotation(String originalClassName, AnnotationsAttribute annotations, ConstPool constPool) { if (annotations == null) { annotations = new AnnotationsAttribute(constPool, AnnotationsAttribute.visibleTag); } Annotation simplified = new Annotation(SimplifiedClass.class.getName(), constPool); simplified.addMemberValue("originalClass", new ClassMemberValue(originalClassName, constPool)); annotations.addAnnotation(simplified); return annotations; }
public static CtClass makeWrapperSubclass(CtClass container, CtClass target, String name) throws CannotCompileException { CtClass wrapperClass = container.makeNestedClass(name, true); wrapperClass.getClassFile().setMajorVersion(ClassFile.JAVA_7); Annotation annotation = new Annotation(Wrapper.class.getName(), wrapperClass.getClassFile().getConstPool()); annotation.addMemberValue("value", new ClassMemberValue(target.getName(), wrapperClass.getClassFile().getConstPool())); AnnotationUtil.annotate(wrapperClass, annotation); if (target.isInterface()) { wrapperClass.setInterfaces(new CtClass[] {target}); } else { wrapperClass.setSuperclass(target); } return wrapperClass; }
@Override protected Annotation getApiOperationAnnotation() { ConstPool constPool = getCtClass().getClassFile().getConstPool(); EntityNodePath path = getResourcePath().getNodePath(); EntityMetaData metaData = path.get(path.size() - 1).getEntityMetaData(); Annotation annotation = new Annotation(ApiOperation.class.getCanonicalName(), constPool); annotation.addMemberValue("value", new StringMemberValue("Create " + metaData.getName(), constPool)); annotation.addMemberValue("response", new ClassMemberValue(metaData.getEntityClass().getCanonicalName(), constPool)); annotation.addMemberValue("responseContainer", new StringMemberValue("List", constPool)); return annotation; }
@Override protected Annotation getApiOperationAnnotation() { ConstPool constPool = getCtClass().getClassFile().getConstPool(); EntityNodePath path = getResourcePath().getNodePath(); EntityMetaData metaData = path.get(path.size() - 1).getEntityMetaData(); Annotation annotation = new Annotation(ApiOperation.class.getCanonicalName(), constPool); annotation.addMemberValue("value", new StringMemberValue("Find " + getResourcePath().getNodePath().getName() + " by id", constPool)); annotation.addMemberValue("response", new ClassMemberValue(metaData.getEntityClass().getCanonicalName(), constPool)); return annotation; }
@Override protected Annotation getApiOperationAnnotation() { ConstPool constPool = getCtClass().getClassFile().getConstPool(); EntityNodePath path = getResourcePath().getNodePath(); EntityMetaData metaData = path.get(path.size() - 1).getEntityMetaData(); Annotation annotation = new Annotation(ApiOperation.class.getCanonicalName(), constPool); annotation.addMemberValue("value", new StringMemberValue("Search " + metaData.getName(), constPool)); annotation.addMemberValue("response", new ClassMemberValue(metaData.getEntityClass().getCanonicalName(), constPool)); annotation.addMemberValue("responseContainer", new StringMemberValue("List", constPool)); return annotation; }