import java.lang.reflect.Modifier; //導入方法依賴的package包/類

/**

* Returns a string describing this {@code Class}, including

* information about modifiers and type parameters.

*

* The string is formatted as a list of type modifiers, if any,

* followed by the kind of type (empty string for primitive types

* and {@code class}, {@code enum}, {@code interface}, or

* @{@code interface}, as appropriate), followed

* by the type's name, followed by an angle-bracketed

* comma-separated list of the type's type parameters, if any.

*

* A space is used to separate modifiers from one another and to

* separate any modifiers from the kind of type. The modifiers

* occur in canonical order. If there are no type parameters, the

* type parameter list is elided.

*

*

Note that since information about the runtime representation

* of a type is being generated, modifiers not present on the

* originating source code or illegal on the originating source

* code may be present.

*

* @return a string describing this {@code Class}, including

* information about modifiers and type parameters

*

* @since 1.8

*/

public String toGenericString() {

if (isPrimitive()) {

return toString();

} else {

StringBuilder sb = new StringBuilder();

// Class modifiers are a superset of interface modifiers

int modifiers = getModifiers() & Modifier.classModifiers();

if (modifiers != 0) {

sb.append(Modifier.toString(modifiers));

sb.append(' ');

}

if (isAnnotation()) {

sb.append('@');

}

if (isInterface()) { // Note: all annotation types are interfaces

sb.append("interface");

} else {

if (isEnum())

sb.append("enum");

else

sb.append("class");

}

sb.append(' ');

sb.append(getName());

TypeVariable>[] typeparms = getTypeParameters();

if (typeparms.length > 0) {

boolean first = true;

sb.append('

for(TypeVariable> typeparm: typeparms) {

if (!first)

sb.append(',');

sb.append(typeparm.getTypeName());

first = false;

}

sb.append('>');

}

return sb.toString();

}

}

modifiers在JAVA中_Java Modifier.classModifiers方法代碼示例相关推荐

  1. java中elements_Java Element.elements方法代碼示例

    本文整理匯總了Java中org.dom4j.Element.elements方法的典型用法代碼示例.如果您正苦於以下問題:Java Element.elements方法的具體用法?Java Eleme ...

  2. java中prtintln_Java Element.attributeValue方法代碼示例

    本文整理匯總了Java中org.dom4j.Element.attributeValue方法的典型用法代碼示例.如果您正苦於以下問題:Java Element.attributeValue方法的具體用 ...

  3. java中getbest_Java Highlighter.getBestFragment方法代碼示例

    本文整理匯總了Java中org.apache.lucene.search.highlight.Highlighter.getBestFragment方法的典型用法代碼示例.如果您正苦於以下問題:Jav ...

  4. java中reject方法作用_Java BindingResult.rejectValue方法代碼示例

    本文整理匯總了Java中org.springframework.validation.BindingResult.rejectValue方法的典型用法代碼示例.如果您正苦於以下問題:Java Bind ...

  5. java touch创建文件_Java FileUtils.touch方法代碼示例

    本文整理匯總了Java中org.apache.commons.io.FileUtils.touch方法的典型用法代碼示例.如果您正苦於以下問題:Java FileUtils.touch方法的具體用法? ...

  6. java使用drawtext重叠_Java Graphics.drawText方法代碼示例

    本文整理匯總了Java中org.eclipse.draw2d.Graphics.drawText方法的典型用法代碼示例.如果您正苦於以下問題:Java Graphics.drawText方法的具體用法 ...

  7. java getitem方法_Java Datasource.getItem方法代碼示例

    本文整理匯總了Java中com.haulmont.cuba.gui.data.Datasource.getItem方法的典型用法代碼示例.如果您正苦於以下問題:Java Datasource.getI ...

  8. java fileitem 识别图片大小_Java FileItem.getSize方法代碼示例

    本文整理匯總了Java中org.apache.commons.fileupload.FileItem.getSize方法的典型用法代碼示例.如果您正苦於以下問題:Java FileItem.getSi ...

  9. java nio keyiterator.remove()_Java SelectionKey.isValid方法代碼示例

    本文整理匯總了Java中java.nio.channels.SelectionKey.isValid方法的典型用法代碼示例.如果您正苦於以下問題:Java SelectionKey.isValid方法 ...

最新文章

  1. python os模块安装_二十七、深入浅出Python中的 os模块
  2. 多浏览器下,CSS截断功能。
  3. “公益AI之星”挑战赛-新冠疫情相似句对判定大赛
  4. 解决Macbook网络连接成功但是图标一直显示正在查找网络问题
  5. axis1 创建service服务端 , axis1 客户端
  6. 广义平稳随机过程定义_广义平稳随机过程介绍.ppt
  7. 工业自动化控制软件SCADA数据模型的使用方法实例
  8. 五笔字根表口诀的通俗易懂讲解
  9. 百度文库文档下载操作流程
  10. win10系统联想电脑亮度自动调节怎么办?
  11. c#/.net操作word插入表格实例
  12. 如何学IT?零基础入门自学Java编程系列:java简介跟计算机常识
  13. 休眠后电脑马上自动唤醒解决
  14. 认定科技型中小企业,这些好处一定要知道
  15. 在非登录页面提示用户还未登录
  16. 基于微信小程序的贵小团系统设计与实现-计算机毕业设计源码+LW文档
  17. 提高linux经验的15个小技巧
  18. 什么才是真正的双线机房?如何辨别真假双线机房?
  19. python笔迹识别_关于机器视觉笔迹识别和Arduino控制机器人的设计
  20. JavaScript 混淆样例

热门文章

  1. VUE 动态绑定class
  2. 03-NSPredicate谓词
  3. 喷涂机器人保养应该注意的七个事项
  4. 【Python3爬虫】常见反爬虫措施及解决办法(二)...
  5. oracle读书笔记之Oracle 11g R2 DBA操作指南(前三章)
  6. Nutch插件开发及发布流程
  7. Exchange 2013与OWA13集成
  8. Android实现程序前后台切换效果
  9. StoneAge Dict 技术方案的可行性[1]
  10. 分析部署无线局域网的关键要素