Record Class Scope
- Record Components:
id
- a non-null
Attributes
identifying thisScope
normal
- whether thisScope
is normal
- All Implemented Interfaces:
Constable
A Scope
is either a normal scope or a
pseudo-scope. Implementations of normal scopes permit their objects to have circular dependencies, whereas
pseudo-scopes do not. Pragmatically, objects managed by normal scopes are usually instances of a particular kind of
proxy, namely a client proxy. Objects managed by pseudo-scopes may or may not be proxied, but
are not client proxies.
A Scope
is notionally governed by another scope which manages its lifecycle. A Scope
that reports that it is governed by itself is known as the primordial scope. All scopes are ultimately
governed by the primordial scope.
In any program using Scope
s, behavior is undefined if there exist two Scope
s with equal
identifiers but any other differing attributes. Any collection of Scope
s, in other words,
must be a set
.
Behavior is also undefined if any two scopes declare each other, by any means, as their respective governing scopes.
- Author:
- Laird Nelson
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Scope
The (well-known and normal) application scope.static final Attributes
AnAttributes
identifying the (well-known and normal) application scope.static final Scope
The (well-known) none pseudo-scope.static final Attributes
AnAttributes
identifying the (well-known) none pseudo-scope.static final Attributes
AnAttributes
identifying the scope designator.static final Scope
The (well-known and primordial) singleton pseudo-scope.static final Attributes
AnAttributes
identifying the (well-known) singleton pseudo-scope. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal Optional
<? extends ConstantDesc> final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.id()
Returns the value of theid
record component.boolean
normal()
Returns the value of thenormal
record component.static final Scope
of
(Attributes id, boolean normal) Returns aScope
suitable for the supplied arguments.static final Attributes
scope()
Returns the scope designator.final String
toString()
Returns a string representation of this record class.
-
Field Details
-
SCOPE
AnAttributes
identifying the scope designator. -
SINGLETON_ID
AnAttributes
identifying the (well-known) singleton pseudo-scope.The
Attributes
constituting the singleton pseudo-scope identifier is attributed with the scope designator, the qualifier designator, and the primordial qualifier, indicating that the scope it identifies governs itself.- See Also:
-
SINGLETON
-
APPLICATION_ID
AnAttributes
identifying the (well-known and normal) application scope.- See Also:
-
APPLICATION
-
NONE_ID
AnAttributes
identifying the (well-known) none pseudo-scope.- See Also:
-
NONE
-
-
Constructor Details
-
Scope
Creates a newScope
.- Parameters:
id
- a non-null
Attributes
identifying thisScope
; must be a scopenormal
- whether thisScope
is normal- Throws:
NullPointerException
- if any argument isnull
IllegalArgumentException
- if any argument is not a scope- See Also:
-
-
Method Details
-
describeConstable
Returns a non-null
Optional
housing aConstantDesc
describing thisScope
, or an emptyOptional
if thisScope
could not be so described.- Specified by:
describeConstable
in interfaceConstable
- Returns:
- a non-
null
Optional
-
of
Returns aScope
suitable for the supplied arguments.- Parameters:
id
- a non-null
Attributes
identifying thisScope
normal
- whether thisScope
is normal- Returns:
- a non-
null
Scope
- Throws:
NullPointerException
- if any argument isnull
-
scope
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with thecompare
method from their corresponding wrapper classes. -
id
-
normal
-