001 package org.junit.runners.model; 002 003 import java.lang.reflect.Modifier; 004 import java.util.List; 005 006 /** 007 * Parent class for {@link FrameworkField} and {@link FrameworkMethod} 008 * 009 * @since 4.7 010 */ 011 public abstract class FrameworkMember<T extends FrameworkMember<T>> implements 012 Annotatable { 013 abstract boolean isShadowedBy(T otherMember); 014 015 boolean isShadowedBy(List<T> members) { 016 for (T each : members) { 017 if (isShadowedBy(each)) { 018 return true; 019 } 020 } 021 return false; 022 } 023 024 protected abstract int getModifiers(); 025 026 /** 027 * Returns true if this member is static, false if not. 028 */ 029 public boolean isStatic() { 030 return Modifier.isStatic(getModifiers()); 031 } 032 033 /** 034 * Returns true if this member is public, false if not. 035 */ 036 public boolean isPublic() { 037 return Modifier.isPublic(getModifiers()); 038 } 039 040 public abstract String getName(); 041 042 public abstract Class<?> getType(); 043 044 public abstract Class<?> getDeclaringClass(); 045 }