简体   繁体   English

多线文本的Java注释实用程序

[英]Java annotation utility for multiline text

WRT Any Future Plans for Multiline Java String . WRT 多线Java字符串的任何未来计划

How difficult is it to write a utility that does the following? 编写执行以下操作的实用程序有多难?

@AllYouCanEatText(return="query")
private String getQuery(String empid, String[] columns) {
  String query;
  /*
  SELECT ${columns}
  FROM Employees
  WHERE empid = ${empid}
  ;
  */
  return query;
};

Of course, before I jump in front of the barrel, I should have asked - Is such a utility already available? 当然,在我跳到枪管前,我应该问 - 这样的实用工具是否已经可用? If so, where? 如果是的话,在哪里?

The issue at hand is actually - how do I read the comments section in reflection during compile time. 实际上的问题实际上是 - 如何在编译期间阅读反射中的注释部分。 As an indication of my (dismal) level of familiarity with Reflection and annotation processing - the last time I used reflection was run-time to read methods. 作为我对反射和注释处理的熟悉程度的一个指示 - 我最后一次使用反射是运行时读取方法。 Is compile-time reflection possible? 编译时反射是否可行?

Is anyone interested in sharing a google code project with me to do this? 有兴趣与我分享谷歌代码项目吗? May be there is already an apache project afoot? 可能已经有一个apache项目正在进行中?

我刚才遇到过这个问题,从未使用过它,但我认为它正是你要找的东西http://www.adrianwalker.org/2011/12/java-multiline-string.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM