本文整理汇总了Java中javax.lang.model.element.Modifier.ABSTRACT属性的典型用法代码示例。如果您正苦于以下问题:Java Modifier.ABSTRACT属性的具体用法?Java Modifier.ABSTRACT怎么用?Java Modifier.ABSTRACT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.lang.model.element.Modifier
的用法示例。
在下文中一共展示了Modifier.ABSTRACT属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getModifier
/**
* Returns the {@link Modifier} for the given token kind, or {@code
* null}.
*/
private static Modifier getModifier(TokenKind kind) {
if (kind == null) {
return null;
}
switch (kind) {
case PUBLIC:
return Modifier.PUBLIC;
case PROTECTED:
return Modifier.PROTECTED;
case PRIVATE:
return Modifier.PRIVATE;
case ABSTRACT:
return Modifier.ABSTRACT;
case STATIC:
return Modifier.STATIC;
// TODO: 22-Jul-17 unsupported lambdas expr
// case DEFAULT:
// return Modifier.DEFAULT;
case FINAL:
return Modifier.FINAL;
case TRANSIENT:
return Modifier.TRANSIENT;
case VOLATILE:
return Modifier.VOLATILE;
case SYNCHRONIZED:
return Modifier.SYNCHRONIZED;
case NATIVE:
return Modifier.NATIVE;
case STRICTFP:
return Modifier.STRICTFP;
default:
return null;
}
}
示例2: isAbstract
public boolean isAbstract() {
for (Modifier modifier : type.getModifiers()) {
if (modifier == Modifier.ABSTRACT) {
return true;
}
}
return false;
}
示例3: isAbstract
private static boolean isAbstract(ExecutableElement element) {
for (Modifier modifier : element.getModifiers()) {
if (modifier == Modifier.ABSTRACT) {
return true;
}
}
return false;
}
示例4: getClassHeader
private StringBuilder getClassHeader(TypeElement cdoc) {
StringBuilder sb = new StringBuilder();
sb.append("<pre>"); //NOI18N
cdoc.getAnnotationMirrors().forEach((annotationDesc) -> {
appendAnnotation(sb, annotationDesc, true);
});
for (Modifier modifier : cdoc.getModifiers()) {
switch(cdoc.getKind()) {
case ENUM:
if (modifier == Modifier.FINAL)
continue;
break;
case INTERFACE:
case ANNOTATION_TYPE:
if (modifier == Modifier.ABSTRACT)
continue;
break;
}
sb.append(modifier).append(' '); //NOI18N
}
switch (cdoc.getKind()) {
case ANNOTATION_TYPE:
sb.append("@interface "); //NOI18N
break;
case ENUM:
sb.append("enum "); //NOI18N
break;
case INTERFACE:
sb.append("interface "); //NOI18N
break;
default:
sb.append("class "); //NOI18N
}
sb.append("<b>").append(cdoc.getSimpleName()); //NOI18N
List<? extends TypeParameterElement> typeParams = cdoc.getTypeParameters();
if (!typeParams.isEmpty()) {
sb.append("<"); //NOI18N
for (Iterator<? extends TypeParameterElement> it = typeParams.iterator(); it.hasNext();) {
TypeParameterElement typeParam = it.next();
appendType(sb, typeParam.asType(), false, true, false);
if (it.hasNext())
sb.append(","); //NOI18N
}
sb.append(">"); //NOI18N
}
sb.append("</b>"); //NOi18N
if (cdoc.getKind() != ElementKind.ANNOTATION_TYPE) {
TypeMirror supercls = cdoc.getSuperclass();
if (supercls != null && supercls.getKind() != TypeKind.NONE) {
sb.append("<br>extends "); //NOI18N
appendType(sb, supercls, false, false, false);
}
List<? extends TypeMirror> ifaces = cdoc.getInterfaces();
if (!ifaces.isEmpty()) {
sb.append(cdoc.getKind().isInterface() ? "<br>extends " : "<br>implements "); //NOI18N
for (Iterator<? extends TypeMirror> it = ifaces.iterator(); it.hasNext();) {
TypeMirror iface = it.next();
appendType(sb, iface, false, false, false);
if (it.hasNext())
sb.append(", "); //NOI18N
}
}
}
sb.append("</pre>"); //NOI18N
return sb;
}