Example usage for org.eclipse.jdt.internal.compiler.lookup FieldBinding canBeSeenBy

List of usage examples for org.eclipse.jdt.internal.compiler.lookup FieldBinding canBeSeenBy

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.lookup FieldBinding canBeSeenBy.

Prototype

public final boolean canBeSeenBy(TypeBinding receiverType, InvocationSite invocationSite, Scope scope) 

Source Link

Usage

From source file:org.eclipse.recommenders.internal.chain.rcp.TypeBindingAnalyzer.java

License:Open Source License

private static Collection<Binding> findFieldsAndMethods(final TypeBinding type,
        final InvocationSite invocationSite, final Scope scope, final Predicate<FieldBinding> fieldFilter,
        final Predicate<MethodBinding> methodFilter) {
    final Map<String, Binding> tmp = Maps.newLinkedHashMap();
    final TypeBinding receiverType = scope.classScope().referenceContext.binding;
    for (final ReferenceBinding cur : findAllSupertypesIncludeingArgument(type)) {
        for (final MethodBinding method : cur.methods()) {
            if (methodFilter.apply(method) || !method.canBeSeenBy(invocationSite, scope)) {
                continue;
            }//from  w w  w  .ja  v  a2s.  c om
            final String key = createMethodKey(method);
            if (!tmp.containsKey(key)) {
                tmp.put(key, method);
            }
        }
        for (final FieldBinding field : cur.fields()) {
            if (fieldFilter.apply(field) || !field.canBeSeenBy(receiverType, invocationSite, scope)) {
                continue;
            }
            final String key = createFieldKey(field);
            if (!tmp.containsKey(key)) {
                tmp.put(key, field);
            }
        }
    }
    return tmp.values();
}