示例#1
0
 @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;
 }
 @Override
 public void handle(EntityMetaData metaData, Annotation annotation, Field field) {
   if (ClassUtils.hasAnnotation(field, OneToMany.class)) {
     logger.debug(
         "Has OneToMany annotation as well. Leaving it to OneToManyAnnotationHandler to process");
     return;
   }
   Class<?> elementType = getElementType(field.getGenericType());
   AssociationMetaData associationMetaData =
       new AssociationMetaData(field.getName(), elementType, isEntity(elementType));
   metaData.addAssociation(associationMetaData);
 }
示例#3
0
 @Override
 protected List<Annotation> getApiResponseAnnotations() {
   EntityNodePath path = getResourcePath().getNodePath();
   EntityMetaData metaData = path.get(path.size() - 1).getEntityMetaData();
   return Lists.newArrayList(getOkResponseAnnotation(metaData.getEntityClass()));
 }