本文整理了Java中java.lang.reflect.Member.getModifiers()
方法的一些代码示例,展示了Member.getModifiers()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Member.getModifiers()
方法的具体详情如下:
包路径:java.lang.reflect.Member
类名称:Member
方法名:getModifiers
[英]Returns the modifiers for this member. The Modifier class should be used to decode the result.
[中]返回此成员的修饰符。应该使用修饰符类来解码结果。
代码示例来源:origin: google/guava
@Override
public final int getModifiers() {
return member.getModifiers();
}
代码示例来源:origin: prestodb/presto
public static boolean isConcrete(Member member)
{
int mod = member.getModifiers();
return (mod & (Modifier.INTERFACE | Modifier.ABSTRACT)) == 0;
}
代码示例来源:origin: redisson/redisson
public static boolean isConcrete(Member member)
{
int mod = member.getModifiers();
return (mod & (Modifier.INTERFACE | Modifier.ABSTRACT)) == 0;
}
代码示例来源:origin: prestodb/presto
@Override
public final int getModifiers() {
return member.getModifiers();
}
代码示例来源:origin: google/j2objc
@Override
public final int getModifiers() {
return member.getModifiers();
}
代码示例来源:origin: google/j2objc
public boolean evaluate(Object arg) {
return (((Member)arg).getModifiers() & rejectMask) == 0;
}
}
代码示例来源:origin: spring-projects/spring-framework
@Override
public boolean isCompilable() {
return (Modifier.isPublic(this.member.getModifiers()) &&
Modifier.isPublic(this.member.getDeclaringClass().getModifiers()));
}
代码示例来源:origin: redisson/redisson
/**
* Returns <code>true</code> if class member is public.
*/
public static boolean isPublic(Member member) {
return Modifier.isPublic(member.getModifiers());
}
代码示例来源:origin: hankcs/HanLP
private static void makeAccessible(AccessibleObject ao)
{
if (ao instanceof Member)
{
Member member = (Member) ao;
if (!Modifier.isPublic(member.getModifiers()))
{
ao.setAccessible(true);
}
}
}
代码示例来源:origin: JakeWharton/butterknife
private static <T extends AccessibleObject & Member> void validateMember(T object) {
int modifiers = object.getModifiers();
if ((modifiers & (PRIVATE | STATIC)) != 0) {
throw new IllegalStateException(object.getDeclaringClass().getName()
+ "."
+ object.getName()
+ " must not be private or static");
}
if ((modifiers & PUBLIC) == 0) {
object.setAccessible(true);
}
}
代码示例来源:origin: google/guava
/** Returns {@code true} if {@code member} is visible under {@code this} visibility. */
final boolean isVisible(Member member) {
return isVisible(member.getModifiers());
}
代码示例来源:origin: redisson/redisson
/**
* Returns <code>true</code> if class member is public and if its declaring class is also public.
*/
public static boolean isPublicPublic(Member member) {
if (Modifier.isPublic(member.getModifiers())) {
if (Modifier.isPublic(member.getDeclaringClass().getModifiers())) {
return true;
}
}
return false;
}
代码示例来源:origin: spring-projects/spring-framework
public static MethodInfo getMethodInfo(Member member) {
return getMethodInfo(member, member.getModifiers());
}
代码示例来源:origin: org.apache.commons/commons-lang3
/**
* Returns whether a {@link Member} is accessible.
* @param m Member to check
* @return {@code true} if <code>m</code> is accessible
*/
static boolean isAccessible(final Member m) {
return m != null && Modifier.isPublic(m.getModifiers()) && !m.isSynthetic();
}
代码示例来源:origin: commons-lang/commons-lang
/**
* Check a Member for basic accessibility.
* @param m Member to check
* @return true if <code>m</code> is accessible
*/
static boolean isAccessible(Member m) {
return m != null && Modifier.isPublic(m.getModifiers()) && !isSynthetic(m);
}
代码示例来源:origin: prestodb/presto
@Override
protected int getModifiers() {
return _base.getMember().getModifiers();
}
代码示例来源:origin: redisson/redisson
@Override
protected int getModifiers() {
return _base.getMember().getModifiers();
}
代码示例来源:origin: org.assertj/assertj-core
/**
* Returns whether a Member is accessible.
* @param m Member to check
* @return true if <code>m</code> is accessible
*/
static boolean isAccessible(Member m) {
return m != null && Modifier.isPublic(m.getModifiers()) && !m.isSynthetic();
}
代码示例来源:origin: google/j2objc
public boolean evaluate(Object arg) {
int mod = (arg instanceof Member) ? ((Member)arg).getModifiers() : ((Integer)arg).intValue();
if (Modifier.isPrivate(mod)) {
return false;
} else if (Modifier.isPublic(mod)) {
return true;
} else if (Modifier.isProtected(mod)) {
return protectedOk;
} else {
return pkg.equals(TypeUtils.getPackageName(Type.getType(((Member)arg).getDeclaringClass())));
}
}
}
代码示例来源:origin: spring-projects/spring-framework
@Override
public void generateCode(String propertyName, MethodVisitor mv, CodeFlow cf) {
boolean isStatic = Modifier.isStatic(this.member.getModifiers());
String descriptor = cf.lastDescriptor();
String classDesc = this.member.getDeclaringClass().getName().replace('.', '/');
if (!isStatic) {
if (descriptor == null) {
cf.loadTarget(mv);
}
if (descriptor == null || !classDesc.equals(descriptor.substring(1))) {
mv.visitTypeInsn(CHECKCAST, classDesc);
}
}
else {
if (descriptor != null) {
// A static field/method call will not consume what is on the stack,
// it needs to be popped off.
mv.visitInsn(POP);
}
}
if (this.member instanceof Method) {
mv.visitMethodInsn((isStatic ? INVOKESTATIC : INVOKEVIRTUAL), classDesc, this.member.getName(),
CodeFlow.createSignatureDescriptor((Method) this.member), false);
}
else {
mv.visitFieldInsn((isStatic ? GETSTATIC : GETFIELD), classDesc, this.member.getName(),
CodeFlow.toJvmDescriptor(((Field) this.member).getType()));
}
}
}
内容来源于网络,如有侵权,请联系作者删除!