本文整理匯總了Java中org.eclipse.jdt.core.dom.Modifier.isTransient方法的典型用法代碼示例。如果您正苦於以下問題:Java Modifier.isTransient方法的具體用法?Java Modifier.isTransient怎麽用?Java Modifier.isTransient使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jdt.core.dom.Modifier
的用法示例。
在下文中一共展示了Modifier.isTransient方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: canAddFinal
import org.eclipse.jdt.core.dom.Modifier; //導入方法依賴的package包/類
private static boolean canAddFinal(IBinding binding, ASTNode declNode) {
if (!(binding instanceof IVariableBinding)) return false;
IVariableBinding varbinding = (IVariableBinding) binding;
int modifiers = varbinding.getModifiers();
if (Modifier.isFinal(modifiers)
|| Modifier.isVolatile(modifiers)
|| Modifier.isTransient(modifiers)) return false;
ASTNode parent = ASTNodes.getParent(declNode, VariableDeclarationExpression.class);
if (parent != null && ((VariableDeclarationExpression) parent).fragments().size() > 1)
return false;
if (varbinding.isField() && !Modifier.isPrivate(modifiers)) return false;
if (varbinding.isParameter()) {
ASTNode varDecl = declNode.getParent();
if (varDecl instanceof MethodDeclaration) {
MethodDeclaration declaration = (MethodDeclaration) varDecl;
if (declaration.getBody() == null) return false;
}
}
return true;
}
示例2: getAdornmentFlags
import org.eclipse.jdt.core.dom.Modifier; //導入方法依賴的package包/類
private static int getAdornmentFlags(IBinding binding) {
int adornments = 0;
final int modifiers = binding.getModifiers();
if (Modifier.isAbstract(modifiers)) adornments |= JavaElementImageDescriptor.ABSTRACT;
if (Modifier.isFinal(modifiers)) adornments |= JavaElementImageDescriptor.FINAL;
if (Modifier.isStatic(modifiers)) adornments |= JavaElementImageDescriptor.STATIC;
if (binding.isDeprecated()) adornments |= JavaElementImageDescriptor.DEPRECATED;
if (binding instanceof IMethodBinding) {
if (((IMethodBinding) binding).isConstructor())
adornments |= JavaElementImageDescriptor.CONSTRUCTOR;
if (Modifier.isSynchronized(modifiers)) adornments |= JavaElementImageDescriptor.SYNCHRONIZED;
if (Modifier.isNative(modifiers)) adornments |= JavaElementImageDescriptor.NATIVE;
ITypeBinding type = ((IMethodBinding) binding).getDeclaringClass();
if (type.isInterface() && !Modifier.isAbstract(modifiers) && !Modifier.isStatic(modifiers))
adornments |= JavaElementImageDescriptor.DEFAULT_METHOD;
if (((IMethodBinding) binding).getDefaultValue() != null)
adornments |= JavaElementImageDescriptor.ANNOTATION_DEFAULT;
}
if (binding instanceof IVariableBinding && ((IVariableBinding) binding).isField()) {
if (Modifier.isTransient(modifiers)) adornments |= JavaElementImageDescriptor.TRANSIENT;
if (Modifier.isVolatile(modifiers)) adornments |= JavaElementImageDescriptor.VOLATILE;
}
return adornments;
}
示例3: printModifiers
import org.eclipse.jdt.core.dom.Modifier; //導入方法依賴的package包/類
private void printModifiers(int modifiers) {
if (Modifier.isPublic(modifiers)) {
sb.print("public ");
}
if (Modifier.isProtected(modifiers)) {
sb.print("protected ");
}
if (Modifier.isPrivate(modifiers)) {
sb.print("private ");
}
if (Modifier.isStatic(modifiers)) {
sb.print("static ");
}
if (Modifier.isAbstract(modifiers)) {
sb.print("abstract ");
}
if (Modifier.isFinal(modifiers)) {
sb.print("final ");
}
if (Modifier.isSynchronized(modifiers)) {
sb.print("synchronized ");
}
if (Modifier.isVolatile(modifiers)) {
sb.print("volatile ");
}
if (Modifier.isNative(modifiers)) {
sb.print("native ");
}
if (Modifier.isStrictfp(modifiers)) {
sb.print("strictfp ");
}
if (Modifier.isTransient(modifiers)) {
sb.print("transient ");
}
if ((modifiers & BindingUtil.ACC_SYNTHETIC) > 0) {
sb.print("synthetic ");
}
}
示例4: extractBasicModifiersFromBinding
import org.eclipse.jdt.core.dom.Modifier; //導入方法依賴的package包/類
private void extractBasicModifiersFromBinding(int modifiers, NamedEntity entity) {
Boolean publicModifier = Modifier.isPublic(modifiers);
Boolean protectedModifier = Modifier.isProtected(modifiers);
Boolean privateModifier = Modifier.isPrivate(modifiers);
if (publicModifier )
entity.addModifiers("public");
if (protectedModifier)
entity.addModifiers("protected");
if (privateModifier)
entity.addModifiers("private");
if (!(publicModifier || protectedModifier || privateModifier))
entity.addModifiers("package");
if (Modifier.isFinal(modifiers))
entity.addModifiers("final");
if (Modifier.isAbstract(modifiers))
entity.addModifiers("abstract");
if (Modifier.isNative(modifiers))
entity.addModifiers("native");
if (Modifier.isSynchronized(modifiers))
entity.addModifiers("synchronized");
if (Modifier.isTransient(modifiers))
entity.addModifiers("transient");
if (Modifier.isVolatile(modifiers))
entity.addModifiers("volatile");
/* We do not extract the static modifier here because we want to set the hasClassScope property
and we do that specifically only for attributes and methods */
}