APIdia Launch Partner
Top Description Fields Constructors Methods
sun.reflect.generics.scope

public abstract Class AbstractScope<D extends GenericDeclaration>

extends Object
implements Scope
Class Inheritance
All Implemented Interfaces
sun.reflect.generics.scope.Scope
Known Direct Subclasses
sun.reflect.generics.scope.ClassScope, sun.reflect.generics.scope.ConstructorScope, sun.reflect.generics.scope.MethodScope
Imports
java.lang.reflect.GenericDeclaration, .TypeVariable

Abstract superclass for lazy scope objects, used when building factories for generic information repositories. The type parameter D represents the type of reflective object whose scope this class is representing.

To subclass this, all one needs to do is implement computeEnclosingScope and the subclass' constructor.

Field Summary

Modifier and TypeField and Description
private volatile Scope
enclosingScope

The enclosing scope of this scope.

private final D

Constructor Summary

AccessConstructor and Description
protected
AbstractScope(D
- A generic declaration whose scope the newly constructed instance will represent
decl
)

Constructor.

Method Summary

Modifier and TypeMethod and Description
protected abstract Scope

Returns:

The enclosing scope of this scope
computeEnclosingScope
()

This method must be implemented by any concrete subclass.

protected Scope

Returns:

the enclosing scope
getEnclosingScope
()

Accessor for the enclosing scope, which is computed lazily and cached.

protected D

Returns:

The object whose scope this Scope object represents
getRecvr
()

Accessor for the receiver - the object whose scope this Scope object represents.

public TypeVariable<?>

Returns:

the requested type variable, if found
lookup
(String
- the name of the type variable being looked up
name
)

Implements sun.reflect.generics.scope.Scope.lookup.

Lookup a type variable in the scope, using its name.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

enclosingScopeback to summary
private volatile Scope enclosingScope

The enclosing scope of this scope. Lazily initialized.

recvrback to summary
private final D recvr

Constructor Detail

AbstractScopeback to summary
protected AbstractScope(D decl)

Constructor. Takes a reflective object whose scope the newly constructed instance will represent.

Parameters
decl:D

- A generic declaration whose scope the newly constructed instance will represent

Method Detail

computeEnclosingScopeback to summary
protected abstract Scope computeEnclosingScope()

This method must be implemented by any concrete subclass. It must return the enclosing scope of this scope. If this scope is a top-level scope, an instance of DummyScope must be returned.

Returns:Scope

The enclosing scope of this scope

getEnclosingScopeback to summary
protected Scope getEnclosingScope()

Accessor for the enclosing scope, which is computed lazily and cached.

Returns:Scope

the enclosing scope

getRecvrback to summary
protected D getRecvr()

Accessor for the receiver - the object whose scope this Scope object represents.

Returns:D

The object whose scope this Scope object represents

lookupback to summary
public TypeVariable<?> lookup(String name)

Implements sun.reflect.generics.scope.Scope.lookup.

Lookup a type variable in the scope, using its name. Returns null if no type variable with this name is declared in this scope or any of its surrounding scopes.

Parameters
name:String

- the name of the type variable being looked up

Returns:TypeVariable<?>

the requested type variable, if found