Package space.arim.dazzleconf.reflect
Class MethodYield
java.lang.Object
space.arim.dazzleconf.reflect.MethodYield
Bank of values yielded when calling an instantiated proxy.
This class is mutable: it is designed to be passed from its producer to its consumer. If defensive copies are
needed, see copy().
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classAn entry added to the method yieldfinal classBuilder of return value instructions, given an implementable class. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears all added values and starts over again@NonNull MethodYieldcopy()Returns a deep copy of this method yield's contents.@NonNull Iterable<@NonNull MethodYield.Entry> entries()Gets all entries added.booleanforImplementable(@NonNull Class<?> implementable) Begins adding yield values for the given interface.inthashCode()intGets the estimated number of entriestoString()Gets the yieldable values
-
Constructor Details
-
MethodYield
public MethodYield()Creates an empty yield.
-
-
Method Details
-
forImplementable
Begins adding yield values for the given interface.The returned
MethodYield.ForImplementablemust be used, and closed, before this method can be called again. Additionally, this method cannot be used more than once with the sameimplementableargument.- Parameters:
implementable- the interface being implemented- Returns:
- a handler to attach return values for it
-
clear
public void clear()Clears all added values and starts over again -
valuesFor
Gets the yieldable values- Parameters:
implementable- the interface being implemented- Returns:
- the values for method calls on that interface's methods, immutable
-
entries
Gets all entries added. Each entry represents a single return value instruction- Returns:
- the iterable entries
-
sizeEstimate
public int sizeEstimate()Gets the estimated number of entries- Returns:
- the estimated size of this
MethodYield
-
copy
Returns a deep copy of this method yield's contents.Mutating this
MethodYield, such as by adding or clearing values, will not affect the copy; likewise mutating the copy will not affect this instance.- Returns:
- a copy of this method yield's contents
-
equals
-
hashCode
public int hashCode() -
toString
-