本文整理匯總了Java中org.eclipse.jdt.core.dom.Modifier.NONE屬性的典型用法代碼示例。如果您正苦於以下問題:Java Modifier.NONE屬性的具體用法?Java Modifier.NONE怎麽用?Java Modifier.NONE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.eclipse.jdt.core.dom.Modifier
的用法示例。
在下文中一共展示了Modifier.NONE屬性的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: handleFragments
private boolean handleFragments(List<VariableDeclarationFragment> list, ASTNode declaration) {
List<VariableDeclarationFragment> toChange = new ArrayList<VariableDeclarationFragment>();
for (Iterator<VariableDeclarationFragment> iter = list.iterator(); iter.hasNext(); ) {
VariableDeclarationFragment fragment = iter.next();
SimpleName name = fragment.getName();
IBinding resolveBinding = name.resolveBinding();
if (canAddFinal(resolveBinding, declaration)) {
IVariableBinding varbinding = (IVariableBinding) resolveBinding;
if (varbinding.isField()) {
if (fieldCanBeFinal(fragment, varbinding)) toChange.add(fragment);
} else {
if (!fWrittenVariables.containsKey(resolveBinding)) toChange.add(fragment);
}
}
}
if (toChange.size() == 0) return false;
ModifierChangeOperation op =
new ModifierChangeOperation(declaration, toChange, Modifier.FINAL, Modifier.NONE);
fResult.add(op);
return false;
}
示例2: isHigherVisibility
/**
* Compares two visibilities.
*
* @param newVisibility the 'new' visibility
* @param oldVisibility the 'old' visibility
* @return <code>true</code> iff the 'new' visibility is strictly higher than the old visibility
* @see Modifier#PUBLIC
* @see Modifier#PROTECTED
* @see Modifier#NONE
* @see Modifier#PRIVATE
*/
public static boolean isHigherVisibility(int newVisibility, int oldVisibility) {
assertVisibility(oldVisibility);
assertVisibility(newVisibility);
switch (oldVisibility) {
case Modifier.PRIVATE:
return newVisibility == Modifier.NONE
|| newVisibility == Modifier.PUBLIC
|| newVisibility == Modifier.PROTECTED;
case Modifier.NONE:
return newVisibility == Modifier.PUBLIC || newVisibility == Modifier.PROTECTED;
case Modifier.PROTECTED:
return newVisibility == Modifier.PUBLIC;
case Modifier.PUBLIC:
return false;
default:
Assert.isTrue(false);
return false;
}
}
示例3: isHigherVisibility
/**
* Compares two visibilities.
*
* @param newVisibility the 'new' visibility
* @param oldVisibility the 'old' visibility
* @return <code>true</code> iff the 'new' visibility is strictly higher than the old visibility
* @see org.eclipse.jdt.core.dom.Modifier#PUBLIC
* @see org.eclipse.jdt.core.dom.Modifier#PROTECTED
* @see org.eclipse.jdt.core.dom.Modifier#NONE
* @see org.eclipse.jdt.core.dom.Modifier#PRIVATE
*/
public static boolean isHigherVisibility(int newVisibility, int oldVisibility) {
assertVisibility(oldVisibility);
assertVisibility(newVisibility);
switch (oldVisibility) {
case Modifier.PRIVATE:
return newVisibility == Modifier.NONE
|| newVisibility == Modifier.PUBLIC
|| newVisibility == Modifier.PROTECTED;
case Modifier.NONE:
return newVisibility == Modifier.PUBLIC || newVisibility == Modifier.PROTECTED;
case Modifier.PROTECTED:
return newVisibility == Modifier.PUBLIC;
case Modifier.PUBLIC:
return false;
default:
Assert.isTrue(false);
return false;
}
}
示例4: getVisibilityCode
public static int getVisibilityCode(IMember member) throws JavaModelException {
if (isPublic(member)) return Modifier.PUBLIC;
else if (isProtected(member)) return Modifier.PROTECTED;
else if (isPackageVisible(member)) return Modifier.NONE;
else if (isPrivate(member)) return Modifier.PRIVATE;
Assert.isTrue(false);
return VISIBILITY_CODE_INVALID;
}
示例5: createAddFinalOperation
private static ModifierChangeOperation createAddFinalOperation(SimpleName name, ASTNode decl) {
if (decl == null) return null;
IBinding binding = name.resolveBinding();
if (!canAddFinal(binding, decl)) return null;
if (decl instanceof SingleVariableDeclaration) {
return new ModifierChangeOperation(
decl, new ArrayList<VariableDeclarationFragment>(), Modifier.FINAL, Modifier.NONE);
} else if (decl instanceof VariableDeclarationExpression) {
return new ModifierChangeOperation(
decl, new ArrayList<VariableDeclarationFragment>(), Modifier.FINAL, Modifier.NONE);
} else if (decl instanceof VariableDeclarationFragment) {
VariableDeclarationFragment frag = (VariableDeclarationFragment) decl;
decl = decl.getParent();
if (decl instanceof FieldDeclaration || decl instanceof VariableDeclarationStatement) {
List<VariableDeclarationFragment> list = new ArrayList<VariableDeclarationFragment>();
list.add(frag);
return new ModifierChangeOperation(decl, list, Modifier.FINAL, Modifier.NONE);
} else if (decl instanceof VariableDeclarationExpression) {
return new ModifierChangeOperation(
decl, new ArrayList<VariableDeclarationFragment>(), Modifier.FINAL, Modifier.NONE);
}
}
return null;
}
示例6: isVisibilityModifier
/**
* Is the specified modifier a visibility modifier?
*
* @param modifier the keyword to test
* @return <code>true</code> if it is a visibility modifier, <code>false</code> otherwise
*/
private static boolean isVisibilityModifier(final int modifier) {
return modifier == Modifier.NONE
|| modifier == Modifier.PUBLIC
|| modifier == Modifier.PROTECTED
|| modifier == Modifier.PRIVATE;
}
示例7: getAccessModifier
private static int getAccessModifier(AbstractTypeDeclaration subclass) {
int modifiers = subclass.getModifiers();
if (Modifier.isPublic(modifiers)) return Modifier.PUBLIC;
else if (Modifier.isProtected(modifiers)) return Modifier.PROTECTED;
else if (Modifier.isPrivate(modifiers)) return Modifier.PRIVATE;
else return Modifier.NONE;
}
示例8: getAvailableVisibilities
public int[] getAvailableVisibilities() {
if (isLocalInnerType()) {
return new int[] {Modifier.NONE};
} else {
return new int[] {Modifier.PUBLIC, Modifier.PROTECTED, Modifier.NONE, Modifier.PRIVATE};
}
}
示例9: getAvailableVisibilities
public int[] getAvailableVisibilities() throws JavaModelException {
if (fTopMethod.getDeclaringType().isInterface()) return new int[] {Modifier.PUBLIC};
else if (fTopMethod.getDeclaringType().isEnum() && fTopMethod.isConstructor())
return new int[] {Modifier.NONE, Modifier.PRIVATE};
else return new int[] {Modifier.PUBLIC, Modifier.PROTECTED, Modifier.NONE, Modifier.PRIVATE};
}
示例10: initializeDefaults
private void initializeDefaults() {
fVisibility = isLocalInnerType() ? Modifier.NONE : Modifier.PRIVATE;
fDeclareStatic = mustInnerClassBeStatic();
}
示例11: getAvailableVisibilities
public int[] getAvailableVisibilities() {
return new int[] {Modifier.PUBLIC, Modifier.PROTECTED, Modifier.NONE, Modifier.PRIVATE};
}