Record Class Scope
- Record Components:
id- a non-nullAttributesidentifying thisScopenormal- whether thisScopeis 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 Scopes, behavior is undefined if there exist two Scopes with equal
identifiers but any other differing attributes. Any collection of Scopes, 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 ScopeThe (well-known and normal) application scope.static final AttributesAnAttributesidentifying the (well-known and normal) application scope.static final ScopeThe (well-known) none pseudo-scope.static final AttributesAnAttributesidentifying the (well-known) none pseudo-scope.static final AttributesAnAttributesidentifying the scope designator.static final ScopeThe (well-known and primordial) singleton pseudo-scope.static final AttributesAnAttributesidentifying the (well-known) singleton pseudo-scope. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal Optional<? extends ConstantDesc> final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.booleannormal()Returns the value of thenormalrecord component.static final Scopeof(Attributes id, boolean normal) Returns aScopesuitable for the supplied arguments.static final Attributesscope()Returns the scope designator.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
SCOPE
AnAttributesidentifying the scope designator. -
SINGLETON_ID
AnAttributesidentifying the (well-known) singleton pseudo-scope.The
Attributesconstituting 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
AnAttributesidentifying the (well-known and normal) application scope.- See Also:
-
APPLICATION
-
NONE_ID
AnAttributesidentifying the (well-known) none pseudo-scope.- See Also:
-
NONE
-
-
Constructor Details
-
Scope
Creates a newScope.- Parameters:
id- a non-nullAttributesidentifying thisScope; must be a scopenormal- whether thisScopeis normal- Throws:
NullPointerException- if any argument isnullIllegalArgumentException- if any argument is not a scope- See Also:
-
-
Method Details
-
describeConstable
Returns a non-nullOptionalhousing aConstantDescdescribing thisScope, or an emptyOptionalif thisScopecould not be so described.- Specified by:
describeConstablein interfaceConstable- Returns:
- a non-
nullOptional
-
of
Returns aScopesuitable for the supplied arguments.- Parameters:
id- a non-nullAttributesidentifying thisScopenormal- whether thisScopeis normal- Returns:
- a non-
nullScope - 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 thecomparemethod from their corresponding wrapper classes. -
id
-
normal
-