private void ensureInterfaces() { if (_interfaces == null) { synchronized (CACHE_LOCK) { if (_interfaces == null) { _interfaces = GenericBinder.visit(_genericTypeDefinition.getExplicitInterfaces(), _typeBindings); } } } }
private void ensureInterfaces() { if (_interfaces == null) { synchronized (CACHE_LOCK) { if (_interfaces == null) { _interfaces = GenericBinder.visit(_genericTypeDefinition.getExplicitInterfaces(), _typeBindings); } } } }
private void ensureInterfaces() { if (_interfaces == null) { synchronized (CACHE_LOCK) { if (_interfaces == null) { _interfaces = GenericBinder.visit(_basedOn.getExplicitInterfaces(), _allBindings); } } } }
private void ensureInterfaces() { if (_interfaces == null) { synchronized (CACHE_LOCK) { if (_interfaces == null) { _interfaces = GenericEraser.visit(_originalType.getExplicitInterfaces()); } } } }
private void ensureInterfaces() { if (_interfaces == null) { synchronized (CACHE_LOCK) { if (_interfaces == null) { _interfaces = GenericEraser.visit(_originalType.getExplicitInterfaces()); } } } }
private void ensureInterfaces() { if (_interfaces == null) { synchronized (CACHE_LOCK) { if (_interfaces == null) { _interfaces = GenericBinder.visit(_basedOn.getExplicitInterfaces(), _allBindings); } } } }
private void ensureInterfaces() { if (_interfaces == null) { synchronized (CACHE_LOCK) { if (_interfaces == null) { _interfaces = GenericEraser.visit(_originalType.getExplicitInterfaces()); } } } }
private void ensureInterfaces() { if (_interfaces == null) { synchronized (CACHE_LOCK) { if (_interfaces == null) { _interfaces = GenericBinder.visit(_genericTypeDefinition.getExplicitInterfaces(), _typeBindings); } } } }
private void ensureInterfaces() { if (_interfaces == null) { synchronized (CACHE_LOCK) { if (_interfaces == null) { _interfaces = GenericBinder.visit(_basedOn.getExplicitInterfaces(), _allBindings); } } } }
@Override public ImmutableList<Type<?>> visitClassType(final Type<?> t, final ImmutableList<Type<?>> list) { final TypeList interfaces = t.getExplicitInterfaces(); if (interfaces.isEmpty()) { return ImmutableList.empty(); } ImmutableList<Type<?>> result = union(list, ImmutableList.from(t.getExplicitInterfaces().toArray())); for (final Type ifType : interfaces) { if (!list.contains(ifType)) { result = union(result, visit(ifType, result)); } } return result; }
@Override public ImmutableList<Type<?>> visitClassType(final Type<?> t, final ImmutableList<Type<?>> list) { final TypeList interfaces = t.getExplicitInterfaces(); if (interfaces.isEmpty()) { return ImmutableList.empty(); } ImmutableList<Type<?>> result = union(list, ImmutableList.from(t.getExplicitInterfaces().toArray())); for (final Type ifType : interfaces) { if (!list.contains(ifType)) { result = union(result, visit(ifType, result)); } } return result; }
@Override public ImmutableList<Type<?>> visitClassType(final Type<?> t, final ImmutableList<Type<?>> list) { final TypeList interfaces = t.getExplicitInterfaces(); if (interfaces.isEmpty()) { return ImmutableList.empty(); } ImmutableList<Type<?>> result = union(list, ImmutableList.from(t.getExplicitInterfaces().toArray())); for (final Type ifType : interfaces) { if (!list.contains(ifType)) { result = union(result, visit(ifType, result)); } } return result; }
@SuppressWarnings("UnusedParameters") public boolean implementsInterface(final Type interfaceType) { Type t = this; while (t != null && t != Type.NullType) { final TypeList interfaces = t.getExplicitInterfaces(); for (int i = 0, n = interfaces.size(); i < n; i++) { final Type type = interfaces.get(i); if (type.isEquivalentTo(interfaceType) || type.implementsInterface(interfaceType)) { return true; } } t = t.getBaseType(); } return false; }
public MethodInfo findOverriddenMethod() { final Type baseType = getDeclaringType().getBaseType(); MethodInfo baseMethod; if (baseType != null && baseType != Type.NullType && (baseMethod = findBaseMethod(baseType)) != null) { return baseMethod; } for (final Type<?> ifType : getDeclaringType().getExplicitInterfaces()) { if ((baseMethod = findBaseMethod(ifType)) != null) { return baseMethod; } } return null; }
@SuppressWarnings("UnusedParameters") public boolean implementsInterface(final Type interfaceType) { Type t = this; while (t != null && t != Type.NullType) { final TypeList interfaces = t.getExplicitInterfaces(); for (int i = 0, n = interfaces.size(); i < n; i++) { final Type type = interfaces.get(i); if (type.isEquivalentTo(interfaceType) || type.implementsInterface(interfaceType)) { return true; } } t = t.getBaseType(); } return false; }
@SuppressWarnings("UnusedParameters") public boolean implementsInterface(final Type interfaceType) { Type t = this; while (t != null && t != Type.NullType) { final TypeList interfaces = t.getExplicitInterfaces(); for (int i = 0, n = interfaces.size(); i < n; i++) { final Type type = interfaces.get(i); if (type.isEquivalentTo(interfaceType) || type.implementsInterface(interfaceType)) { return true; } } t = t.getBaseType(); } return false; }
private ArrayList<RuntimeFieldInfo> populateFields(final Filter filter) { final ArrayList<RuntimeFieldInfo> list = new ArrayList<>(); final Type<?> reflectedType = getReflectedType(); Type<?> declaringType = reflectedType; while (declaringType.isGenericParameter()) { declaringType = declaringType.getExtendsBound(); } while (declaringType != null && declaringType != Type.NullType) { populateRuntimeFields(filter, declaringType.getDeclaredFields(), declaringType, list); declaringType = declaringType.getBaseType(); } final TypeList interfaces = reflectedType.isGenericParameter() ? reflectedType.getExtendsBound().getExplicitInterfaces() : reflectedType.getExplicitInterfaces(); for (int i = 0, n = interfaces.size(); i < n; i++) { // Populate literal fields defined on any of the interfaces implemented by the declaring type final Type<?> interfaceType = interfaces.get(i); populateRuntimeFields(filter, interfaceType.getDeclaredFields(), interfaceType, list); } return list; }
private ArrayList<RuntimeFieldInfo> populateFields(final Filter filter) { final ArrayList<RuntimeFieldInfo> list = new ArrayList<>(); final Type<?> reflectedType = getReflectedType(); Type<?> declaringType = reflectedType; while (declaringType.isGenericParameter()) { declaringType = declaringType.getExtendsBound(); } while (declaringType != null && declaringType != Type.NullType) { populateRuntimeFields(filter, declaringType.getDeclaredFields(), declaringType, list); declaringType = declaringType.getBaseType(); } final TypeList interfaces = reflectedType.isGenericParameter() ? reflectedType.getExtendsBound().getExplicitInterfaces() : reflectedType.getExplicitInterfaces(); for (int i = 0, n = interfaces.size(); i < n; i++) { // Populate literal fields defined on any of the interfaces implemented by the declaring type final Type<?> interfaceType = interfaces.get(i); populateRuntimeFields(filter, interfaceType.getDeclaredFields(), interfaceType, list); } return list; }
private ArrayList<RuntimeFieldInfo> populateFields(final Filter filter) { final ArrayList<RuntimeFieldInfo> list = new ArrayList<>(); final Type<?> reflectedType = getReflectedType(); Type<?> declaringType = reflectedType; while (declaringType.isGenericParameter()) { declaringType = declaringType.getExtendsBound(); } while (declaringType != null && declaringType != Type.NullType) { populateRuntimeFields(filter, declaringType.getDeclaredFields(), declaringType, list); declaringType = declaringType.getBaseType(); } final TypeList interfaces = reflectedType.isGenericParameter() ? reflectedType.getExtendsBound().getExplicitInterfaces() : reflectedType.getExplicitInterfaces(); for (int i = 0, n = interfaces.size(); i < n; i++) { // Populate literal fields defined on any of the interfaces implemented by the declaring type final Type<?> interfaceType = interfaces.get(i); populateRuntimeFields(filter, interfaceType.getDeclaredFields(), interfaceType, list); } return list; }
public static boolean isSubtype(final Type t, final Type p, final boolean capture) { if (t == p) { return true; } if (p == null) { return false; } if (p == Types.Object) { return true; } if (p.isCompoundType()) { final Type baseType = p.getBaseType(); if (baseType != null && !isSubtype(t, baseType, capture)) { return false; } final TypeList interfaces = p.getExplicitInterfaces(); for (int i = 0, n = interfaces.size(); i < n; i++) { final Type type = interfaces.get(i); if (!isSubtype(t, type, capture)) { return false; } } return true; } final Type lower = lowerBound(p); if (p != lower) { return isSubtype(capture ? capture(t) : t, lower, false); } return IsSubtypeRelation.visit(capture ? capture(t) : t, p); }