Java Code Examples for java.lang.reflect.Member#getModifiers()
The following examples show how to use
java.lang.reflect.Member#getModifiers() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultMemberAccess.java From anyline with Apache License 2.0 | 6 votes |
@SuppressWarnings("rawtypes") public boolean isAccessible(Map context, Object target, Member member, String propertyName) { int modifiers = member.getModifiers(); boolean result = Modifier.isPublic(modifiers); if (!result) { if (Modifier.isPrivate(modifiers)) { result = getAllowPrivateAccess(); } else { if (Modifier.isProtected(modifiers)) { result = getAllowProtectedAccess(); } else { result = getAllowPackageProtectedAccess(); } } } return result; }
Example 2
Source File: OgnlMemberAccess.java From Milkomeda with MIT License | 6 votes |
@Override public boolean isAccessible(Map context, Object target, Member member, String propertyName) { int modifiers = member.getModifiers(); boolean result = Modifier.isPublic(modifiers); if (!result) { if (Modifier.isPrivate(modifiers)) { result = isAllowPrivateAccess(); } else { if (Modifier.isProtected(modifiers)) { result = isAllowProtectedAccess(); } else { result = isAllowPackageProtectedAccess(); } } } return result; }
Example 3
Source File: DefaultMemberAccess.java From hasor with Apache License 2.0 | 6 votes |
/** Returns true if the given member is accessible or can be made accessible by this object. */ public boolean isAccessible(Map context, Object target, Member member, String propertyName) { int modifiers = member.getModifiers(); boolean result = Modifier.isPublic(modifiers); if (!result) { if (Modifier.isPrivate(modifiers)) { result = getAllowPrivateAccess(); } else { if (Modifier.isProtected(modifiers)) { result = getAllowProtectedAccess(); } else { result = getAllowPackageProtectedAccess(); } } } return result; }
Example 4
Source File: BytecodeGen.java From businessworks with Apache License 2.0 | 6 votes |
public static Visibility forMember(Member member) { if ((member.getModifiers() & (Modifier.PROTECTED | Modifier.PUBLIC)) == 0) { return SAME_PACKAGE; } Class[] parameterTypes; if (member instanceof Constructor) { parameterTypes = ((Constructor) member).getParameterTypes(); } else { Method method = (Method) member; if (forType(method.getReturnType()) == SAME_PACKAGE) { return SAME_PACKAGE; } parameterTypes = method.getParameterTypes(); } for (Class<?> type : parameterTypes) { if (forType(type) == SAME_PACKAGE) { return SAME_PACKAGE; } } return PUBLIC; }
Example 5
Source File: DefaultMemberAccess.java From framework with Apache License 2.0 | 6 votes |
/** * Description: Returns true if the given member is accessible or can be made accessible by this object.<br> * * @author 王伟<br> * @taskId <br> * @param context * @param target * @param member * @param propertyName * @return <br> */ public boolean isAccessible(final Map context, final Object target, final Member member, final String propertyName) { int modifiers = member.getModifiers(); boolean result = Modifier.isPublic(modifiers); if (!result) { if (Modifier.isPrivate(modifiers)) { result = getAllowPrivateAccess(); } else { if (Modifier.isProtected(modifiers)) { result = getAllowProtectedAccess(); } else { result = getAllowPackageProtectedAccess(); } } } return result; }
Example 6
Source File: SchedulerProviderLookup.java From tascalate-async-await with BSD 2-Clause "Simplified" License | 6 votes |
final protected boolean isVisibleTo(Class<?> subClass, Member member) { Class<?> declaringClass = member.getDeclaringClass(); if (!declaringClass.isAssignableFrom(subClass)) { return false; } int modifiers = member.getModifiers(); if (0 != (modifiers & (Modifier.PUBLIC | Modifier.PROTECTED))) { return true; } else { if (0 != (modifiers & Modifier.PRIVATE)) { return subClass == declaringClass; } else { return subClass.getPackage().equals(declaringClass.getPackage()); } } }
Example 7
Source File: MoreTypes.java From crate with Apache License 2.0 | 5 votes |
private MemberImpl(Member member) { this.declaringClass = member.getDeclaringClass(); this.name = member.getName(); this.modifiers = member.getModifiers(); this.synthetic = member.isSynthetic(); this.memberType = memberType(member); this.memberKey = memberKey(member); }
Example 8
Source File: DefaultMemberAccess.java From docx4j-template with Apache License 2.0 | 5 votes |
/** * Returns true if the given member is accessible or can be made accessible by this object. */ @Override public boolean isAccessible(Map context, Object target, Member member, String propertyName) { int modifiers = member.getModifiers(); if (Modifier.isPublic(modifiers)) { return true; } else if (Modifier.isPrivate(modifiers)) { return this.allowPrivateAccess; } else if (Modifier.isProtected(modifiers)) { return this.allowProtectedAccess; } else { return this.allowPackageProtectedAccess; } }
Example 9
Source File: ReflectionUtils.java From oval with Eclipse Public License 2.0 | 4 votes |
public static boolean isStatic(final Member member) { return (member.getModifiers() & Modifier.STATIC) != 0; }
Example 10
Source File: ReflectionUtils.java From oval with Eclipse Public License 2.0 | 4 votes |
public static boolean isPublic(final Member member) { return (member.getModifiers() & Modifier.PUBLIC) != 0; }
Example 11
Source File: ReflectionUtils.java From oval with Eclipse Public License 2.0 | 4 votes |
public static boolean isPrivate(final Member member) { return (member.getModifiers() & Modifier.PRIVATE) != 0; }
Example 12
Source File: ReflectionUtils.java From oval with Eclipse Public License 2.0 | 4 votes |
public static boolean isFinal(final Member member) { return (member.getModifiers() & Modifier.FINAL) != 0; }
Example 13
Source File: ReflectionPredicates.java From raistlic-lib-commons-core with Apache License 2.0 | 4 votes |
@Override public boolean test(Member member) { int modifiers = member.getModifiers(); return Modifier.isPublic(modifiers) || Modifier.isProtected(modifiers); }
Example 14
Source File: BeanUtil.java From jackson-modules-base with Apache License 2.0 | 4 votes |
protected static boolean isConcrete(Member member) { int mod = member.getModifiers(); return (mod & (Modifier.INTERFACE | Modifier.ABSTRACT)) == 0; }
Example 15
Source File: BeanUtils.java From gflogger with Apache License 2.0 | 4 votes |
private static boolean isStatic( final Member m ) { return ( m.getModifiers() & Modifier.STATIC ) != 0; }
Example 16
Source File: ReflectionPredicates.java From raistlic-lib-commons-core with Apache License 2.0 | 4 votes |
@Override public boolean test(Member member) { int modifiers = member.getModifiers(); return Modifier.isPrivate(modifiers) || (modifiers & (Modifier.PUBLIC | Modifier.PROTECTED | Modifier.PRIVATE)) == 0; }
Example 17
Source File: Members.java From ProjectAres with GNU Affero General Public License v3.0 | 4 votes |
public static boolean isInheritable(Member member) { return (member.getModifiers() & NON_INHERITABLE_MODIFIERS) == 0; }
Example 18
Source File: Members.java From ProjectAres with GNU Affero General Public License v3.0 | 4 votes |
public static boolean isPackagePrivate(Member member) { return (member.getModifiers() & ACCESS_MODIFIERS) == 0; }
Example 19
Source File: ReflectionHelper.java From ForgeHax with MIT License | 4 votes |
public static boolean isFinal(Member instance) { return (instance.getModifiers() & Modifier.FINAL) != 0; }
Example 20
Source File: ReflectionHelper.java From ForgeHax with MIT License | 4 votes |
public static boolean isStatic(Member instance) { return (instance.getModifiers() & Modifier.STATIC) != 0; }