java.lang.Object
java.lang.Record
org.microbean.bean.Bean<I>
- Type Parameters:
I- the type of the contextual instances the associatedFactorycreates- Record Components:
id- theId; must not benullfactory- 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_DEPENDENCIESFields inherited from interface org.microbean.bean.Ranked
DEFAULT_RANK -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanReturnstrueif thisRankedis 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 unmodifiableSequencedSetofAttributedElementinstances.final Optional<DynamicConstantDesc<Bean<I>>> final booleanIndicates whether some other object is "equal to" this one.factory()Returns the value of thefactoryrecord component.inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.final intrank()Returns the rank of thisRankedimplementation.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Bean
Creates a newBean.- Parameters:
id- theId; must not benullfactory- theFactory; must not benull- Throws:
NullPointerException- if either argument isnull
-
-
Method Details
-
alternate
Description copied from interface:RankedReturnstrueif thisRankedis 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:AggregateReturns an unmodifiableSequencedSetofAttributedElementinstances.- Specified by:
dependenciesin interfaceAggregate- Returns:
- an unmodifiable
SequencedSetofAttributedElementinstances; nevernull - See Also:
-
describeConstable
- Specified by:
describeConstablein 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:RankedReturns the rank of thisRankedimplementation.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_RANKfield (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 theidrecord component.- Returns:
- the value of the
idrecord component
-
factory
Returns the value of thefactoryrecord component.- Returns:
- the value of the
factoryrecord component
-