本文整理了Java中org.eclipse.jdt.core.Flags.isDefaultMethod()
方法的一些代码示例,展示了Flags.isDefaultMethod()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Flags.isDefaultMethod()
方法的具体详情如下:
包路径:org.eclipse.jdt.core.Flags
类名称:Flags
方法名:isDefaultMethod
[英]Returns whether the given integer has the AccDefaultMethod
bit set. Note that this flag represents the usage of the 'default' keyword on a method and should not be confused with the 'package' access visibility (which used to be called 'default access').
[中]返回给定整数是否设置了AccDefaultMethod
位。请注意,此标志表示“default”关键字在方法上的用法,不应与“package”访问可见性(过去称为“default access”)混淆。
代码示例来源:origin: eclipse/eclipse.jdt.ls
public static boolean isDefaultMethod(IMethod method) throws JavaModelException {
return Flags.isDefaultMethod(method.getFlags());
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core.manipulation
public static boolean isDefaultMethod(IMethod method) throws JavaModelException {
return Flags.isDefaultMethod(method.getFlags());
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
public static boolean isDefaultMethod(IMethod method) throws JavaModelException {
return Flags.isDefaultMethod(method.getFlags());
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
private int appendMethodDeclaration(StringBuilder cuString, String[] types, int parameterCount) throws JavaModelException {
int flags= fMethod.getFlags();
if (Flags.isStatic(flags)) {
cuString.append("static "); //$NON-NLS-1$
} else if (Flags.isDefaultMethod(flags)) {
cuString.append("default "); //$NON-NLS-1$
}
ITypeParameter[] methodTypeParameters= fMethod.getTypeParameters();
if (methodTypeParameters.length != 0) {
cuString.append('<');
for (int i= 0; i < methodTypeParameters.length; i++) {
ITypeParameter typeParameter= methodTypeParameters[i];
if (i > 0)
cuString.append(',');
cuString.append(typeParameter.getElementName());
}
cuString.append("> "); //$NON-NLS-1$
}
cuString.append(types[parameterCount]).append(' ');
int offsetBeforeMethodName= cuString.length();
cuString.append(METHOD_NAME).append('(');
for (int i= 0; i < parameterCount; i++) {
if (i > 0)
cuString.append(',');
cuString.append(types[i]).append(" p").append(i); //$NON-NLS-1$
}
cuString.append(");"); //$NON-NLS-1$
return offsetBeforeMethodName;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
private int appendMethodDeclaration(StringBuffer cuString, String[] types, int parameterCount) throws JavaModelException {
int flags= fMethod.getFlags();
if (Flags.isStatic(flags)) {
cuString.append("static "); //$NON-NLS-1$
} else if (Flags.isDefaultMethod(flags)) {
cuString.append("default "); //$NON-NLS-1$
}
ITypeParameter[] methodTypeParameters= fMethod.getTypeParameters();
if (methodTypeParameters.length != 0) {
cuString.append('<');
for (int i= 0; i < methodTypeParameters.length; i++) {
ITypeParameter typeParameter= methodTypeParameters[i];
if (i > 0)
cuString.append(',');
cuString.append(typeParameter.getElementName());
}
cuString.append("> "); //$NON-NLS-1$
}
cuString.append(types[parameterCount]).append(' ');
int offsetBeforeMethodName= cuString.length();
cuString.append(METHOD_NAME).append('(');
for (int i= 0; i < parameterCount; i++) {
if (i > 0)
cuString.append(',');
cuString.append(types[i]).append(" p").append(i); //$NON-NLS-1$
}
cuString.append(");"); //$NON-NLS-1$
return offsetBeforeMethodName;
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
public String getNewMethodSignature() throws JavaModelException{
StringBuilder buff= new StringBuilder();
buff.append(getVisibilityString(fVisibility));
int flags= getMethod().getFlags();
if (Flags.isStatic(flags)) {
buff.append("static "); //$NON-NLS-1$
} else if (Flags.isDefaultMethod(flags)) {
buff.append("default "); //$NON-NLS-1$
}
if (! getMethod().isConstructor())
buff.append(getReturnTypeString())
.append(' ');
buff.append(getMethodName())
.append(Signature.C_PARAM_START)
.append(getMethodParameters())
.append(Signature.C_PARAM_END);
buff.append(getMethodThrows());
return BasicElementLabels.getJavaCodeString(buff.toString());
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
public String getNewMethodSignature() throws JavaModelException{
StringBuffer buff= new StringBuffer();
buff.append(getVisibilityString(fVisibility));
int flags= getMethod().getFlags();
if (Flags.isStatic(flags)) {
buff.append("static "); //$NON-NLS-1$
} else if (Flags.isDefaultMethod(flags)) {
buff.append("default "); //$NON-NLS-1$
}
if (! getMethod().isConstructor())
buff.append(getReturnTypeString())
.append(' ');
buff.append(getMethodName())
.append(Signature.C_PARAM_START)
.append(getMethodParameters())
.append(Signature.C_PARAM_END);
buff.append(getMethodThrows());
return BasicElementLabels.getJavaCodeString(buff.toString());
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
public String getOldMethodSignature() throws JavaModelException{
StringBuilder buff= new StringBuilder();
int flags= getMethod().getFlags();
buff.append(getVisibilityString(flags));
if (Flags.isStatic(flags)) {
buff.append("static "); //$NON-NLS-1$
} else if (Flags.isDefaultMethod(flags)) {
buff.append("default "); //$NON-NLS-1$
}
if (! getMethod().isConstructor())
buff.append(fReturnTypeInfo.getOldTypeName())
.append(' ');
buff.append(JavaElementLabels.getElementLabel(fMethod.getParent(), JavaElementLabels.ALL_FULLY_QUALIFIED));
buff.append('.');
buff.append(fMethod.getElementName())
.append(Signature.C_PARAM_START)
.append(getOldMethodParameters())
.append(Signature.C_PARAM_END);
buff.append(getOldMethodThrows());
return BasicElementLabels.getJavaCodeString(buff.toString());
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
public String getOldMethodSignature() throws JavaModelException{
StringBuffer buff= new StringBuffer();
int flags= getMethod().getFlags();
buff.append(getVisibilityString(flags));
if (Flags.isStatic(flags)) {
buff.append("static "); //$NON-NLS-1$
} else if (Flags.isDefaultMethod(flags)) {
buff.append("default "); //$NON-NLS-1$
}
if (! getMethod().isConstructor())
buff.append(fReturnTypeInfo.getOldTypeName())
.append(' ');
buff.append(JavaElementLabels.getElementLabel(fMethod.getParent(), JavaElementLabels.ALL_FULLY_QUALIFIED));
buff.append('.');
buff.append(fMethod.getElementName())
.append(Signature.C_PARAM_START)
.append(getOldMethodParameters())
.append(Signature.C_PARAM_END);
buff.append(getOldMethodThrows());
return BasicElementLabels.getJavaCodeString(buff.toString());
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core
if (isAbstract(flags))
sb.append("abstract "); //$NON-NLS-1$
if (isDefaultMethod(flags))
sb.append("default "); //$NON-NLS-1$
if (isStatic(flags))
代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion
if (isAbstract(flags))
sb.append("abstract "); //$NON-NLS-1$
if (isDefaultMethod(flags))
sb.append("default "); //$NON-NLS-1$
if (isStatic(flags))
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
public static boolean isAbstract(IMember member) throws JavaModelException{
int flags= member.getFlags();
if (!member.isBinary() && isInterfaceOrAnnotationMethod(member)) {
return !Flags.isStatic(flags) && !Flags.isDefaultMethod(flags);
}
return Flags.isAbstract(flags);
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core.manipulation
public static boolean isAbstract(IMember member) throws JavaModelException{
int flags= member.getFlags();
if (!member.isBinary() && isInterfaceOrAnnotationMethod(member)) {
return !Flags.isPrivate(flags) && !Flags.isStatic(flags) && !Flags.isDefaultMethod(flags);
}
return Flags.isAbstract(flags);
}
代码示例来源:origin: eclipse/eclipse.jdt.ls
public static boolean isAbstract(IMember member) throws JavaModelException{
int flags= member.getFlags();
if (!member.isBinary() && isInterfaceOrAnnotationMethod(member)) {
return !Flags.isPrivate(flags) && !Flags.isStatic(flags) && !Flags.isDefaultMethod(flags);
}
return Flags.isAbstract(flags);
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
if (fMethod.getDeclaringType().isAnnotation())
status.merge(RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.MoveInstanceMethodProcessor_no_annotation, JavaStatusContext.create(fMethod)));
else if (fMethod.getDeclaringType().isInterface() && !Flags.isDefaultMethod(flags))
status.merge(RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.MoveInstanceMethodProcessor_no_interface, JavaStatusContext.create(fMethod)));
monitor.worked(1);
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
if (fMethod.getDeclaringType().isAnnotation())
status.merge(RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.MoveInstanceMethodProcessor_no_annotation, JavaStatusContext.create(fMethod)));
else if (fMethod.getDeclaringType().isInterface() && !Flags.isDefaultMethod(flags))
status.merge(RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.MoveInstanceMethodProcessor_no_interface, JavaStatusContext.create(fMethod)));
monitor.worked(1);
代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.api.tools
TypeDeclaration type = (TypeDeclaration) parent;
if (type.isInterface()) {
if (Flags.isDefaultMethod(node.getModifiers())) {
restrictions |= RestrictionModifiers.NO_OVERRIDE;
代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.api.tools
TypeDeclaration type = (TypeDeclaration) parent;
if (type.isInterface()) {
if (Flags.isDefaultMethod(node.getModifiers())) {
restrictions |= RestrictionModifiers.NO_OVERRIDE;
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
if (Flags.isDefaultMethod(flags))
adornments|= JavaElementImageDescriptor.DEFAULT_METHOD;
else if (Flags.isAbstract(flags))
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
if (Flags.isNative(modifiers))
flags|= JavaElementImageDescriptor.NATIVE;
if (Flags.isDefaultMethod(modifiers))
flags|= JavaElementImageDescriptor.DEFAULT_METHOD;
if (Flags.isAnnnotationDefault(modifiers))
内容来源于网络,如有侵权,请联系作者删除!