modifiers在JAVA中_Java Modifier.classModifiers方法代碼示例
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方法代碼示例相关推荐
- java中elements_Java Element.elements方法代碼示例
本文整理匯總了Java中org.dom4j.Element.elements方法的典型用法代碼示例.如果您正苦於以下問題:Java Element.elements方法的具體用法?Java Eleme ...
- java中prtintln_Java Element.attributeValue方法代碼示例
本文整理匯總了Java中org.dom4j.Element.attributeValue方法的典型用法代碼示例.如果您正苦於以下問題:Java Element.attributeValue方法的具體用 ...
- java中getbest_Java Highlighter.getBestFragment方法代碼示例
本文整理匯總了Java中org.apache.lucene.search.highlight.Highlighter.getBestFragment方法的典型用法代碼示例.如果您正苦於以下問題:Jav ...
- java中reject方法作用_Java BindingResult.rejectValue方法代碼示例
本文整理匯總了Java中org.springframework.validation.BindingResult.rejectValue方法的典型用法代碼示例.如果您正苦於以下問題:Java Bind ...
- java touch创建文件_Java FileUtils.touch方法代碼示例
本文整理匯總了Java中org.apache.commons.io.FileUtils.touch方法的典型用法代碼示例.如果您正苦於以下問題:Java FileUtils.touch方法的具體用法? ...
- java使用drawtext重叠_Java Graphics.drawText方法代碼示例
本文整理匯總了Java中org.eclipse.draw2d.Graphics.drawText方法的典型用法代碼示例.如果您正苦於以下問題:Java Graphics.drawText方法的具體用法 ...
- java getitem方法_Java Datasource.getItem方法代碼示例
本文整理匯總了Java中com.haulmont.cuba.gui.data.Datasource.getItem方法的典型用法代碼示例.如果您正苦於以下問題:Java Datasource.getI ...
- java fileitem 识别图片大小_Java FileItem.getSize方法代碼示例
本文整理匯總了Java中org.apache.commons.fileupload.FileItem.getSize方法的典型用法代碼示例.如果您正苦於以下問題:Java FileItem.getSi ...
- java nio keyiterator.remove()_Java SelectionKey.isValid方法代碼示例
本文整理匯總了Java中java.nio.channels.SelectionKey.isValid方法的典型用法代碼示例.如果您正苦於以下問題:Java SelectionKey.isValid方法 ...
最新文章
- python os模块安装_二十七、深入浅出Python中的 os模块
- 多浏览器下,CSS截断功能。
- “公益AI之星”挑战赛-新冠疫情相似句对判定大赛
- 解决Macbook网络连接成功但是图标一直显示正在查找网络问题
- axis1 创建service服务端 , axis1 客户端
- 广义平稳随机过程定义_广义平稳随机过程介绍.ppt
- 工业自动化控制软件SCADA数据模型的使用方法实例
- 五笔字根表口诀的通俗易懂讲解
- 百度文库文档下载操作流程
- win10系统联想电脑亮度自动调节怎么办?
- c#/.net操作word插入表格实例
- 如何学IT?零基础入门自学Java编程系列:java简介跟计算机常识
- 休眠后电脑马上自动唤醒解决
- 认定科技型中小企业,这些好处一定要知道
- 在非登录页面提示用户还未登录
- 基于微信小程序的贵小团系统设计与实现-计算机毕业设计源码+LW文档
- 提高linux经验的15个小技巧
- 什么才是真正的双线机房?如何辨别真假双线机房?
- python笔迹识别_关于机器视觉笔迹识别和Arduino控制机器人的设计
- JavaScript 混淆样例