java.lang.Object
java.lang.Record
org.microbean.bean.Bean<I>
- Type Parameters:
I
- the type of the contextual instances the associatedFactory
creates- Record Components:
id
- theId
; must not benull
factory
- theFactory
; must not benull
public record Bean<I>(Id id, Factory<I> factory)
extends Record
implements Aggregate, Constable, Ranked
- Author:
- Laird Nelson
- See Also:
-
Field Summary
Fields inherited from interface org.microbean.bean.Aggregate
EMPTY_ASSIGNMENTS, EMPTY_DEPENDENCIES
Fields inherited from interface org.microbean.bean.Ranked
DEFAULT_RANK
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Returnstrue
if thisRanked
is to be considered an alternate, which may have an effect on how the return value of theRanked.rank()
method is interpreted in some situations.final <X> Bean
<X> cast()
Returns thisBean
, forcibly cast appropriately.final SequencedSet
<AttributedElement> Returns an unmodifiableSequencedSet
ofAttributedElement
instances.final Optional
<DynamicConstantDesc<Bean<I>>> final boolean
Indicates whether some other object is "equal to" this one.factory()
Returns the value of thefactory
record component.int
hashCode()
Returns a hash code value for this object.id()
Returns the value of theid
record component.final int
rank()
Returns the rank of thisRanked
implementation.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
Bean
Creates a newBean
.- Parameters:
id
- theId
; must not benull
factory
- theFactory
; must not benull
- Throws:
NullPointerException
- if either argument isnull
-
-
Method Details
-
alternate
Description copied from interface:Ranked
Returnstrue
if thisRanked
is to be considered an alternate, which may have an effect on how the return value of theRanked.rank()
method is interpreted in some situations.The default implementation of this method returns
false
.Overrides of this method must be idempotent and return a determinate value.
-
cast
Returns thisBean
, forcibly cast appropriately. -
dependencies
Description copied from interface:Aggregate
Returns an unmodifiableSequencedSet
ofAttributedElement
instances.- Specified by:
dependencies
in interfaceAggregate
- Returns:
- an unmodifiable
SequencedSet
ofAttributedElement
instances; nevernull
- See Also:
-
describeConstable
- Specified by:
describeConstable
in interfaceConstable
-
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. All components in this record class are compared withObjects::equals(Object,Object)
. -
hashCode
Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
rank
Description copied from interface:Ranked
Returns the rank of thisRanked
implementation.Implementations of this method may return any integer: positive, zero, or negative.
The default implementation of this method returns the value of the
Ranked.DEFAULT_RANK
field (0).Overrides of this method must return a determinate value.
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
id
Returns the value of theid
record component.- Returns:
- the value of the
id
record component
-
factory
Returns the value of thefactory
record component.- Returns:
- the value of the
factory
record component
-