Record Class Bean<I>
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 SequencedSet<? extends Assignment<?>> assign(Function<? super AttributedType, ?> r) A convenience method that assigns a contextual reference to each of thisAggregate'sAttributedElementinstances and returns the resultingSequencedSetofAssignments.final <X> Bean<X> cast()Returns thisBean, forcibly cast appropriately.final SequencedSet<AttributedElement> Returns an immutableSequencedSetofAttributedElementinstances.final Optional<DynamicConstantDesc<Bean<I>>> final booleanIndicates whether some other object is "equal to" this one.factory()Returns the value of thefactoryrecord component.final 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
-
-
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.
-
assign
Description copied from interface:AggregateA convenience method that assigns a contextual reference to each of thisAggregate'sAttributedElementinstances and returns the resultingSequencedSetofAssignments.Typically there is no need to override this method.
- Specified by:
assignin interfaceAggregate- Parameters:
r- aFunctionthat retrieves a contextual reference suitable for anAttributedType; ifAggregate.dependencies()returns a non-emptySequencedSetthen this argument must not benull- Returns:
- an immutable
SequencedSetofAssignmentinstances; nevernull - See Also:
-
cast
-
dependencies
Description copied from interface:AggregateReturns an immutableSequencedSetofAttributedElementinstances.- Specified by:
dependenciesin interfaceAggregate- Returns:
- an immutable
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
-
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
-
id
-
factory
-