For example, if a source method
foo(Object) is attempted to be bound to
bar(@RuntimeType String), the binding will attempt to cast the argument of foo to a String
type before calling bar with this argument. If this is not possible, a java.lang.ClassCastException
will be thrown at runtime. Similarly, if a method foo returns a type String but is bound to a method
that returns a type Object, annotating the target method with @RuntimeType results in the
foo method casting the target's method return value to String before returning a value itself.
net.bytebuddy.implementation.MethodDelegation , net.bytebuddy.implementation.bind.annotation.TargetMethodAnnotationDrivenBinder
| Modifier and Type | Class and Description |
|---|---|
| public static class | RuntimeType.Verifier
A non-instantiable type that allows to check if a method or parameter should consider a runtime type. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static Assigner. | Returns: Indicates if dynamic type castings should be attempted for incompatible assignments.The annotated element of interest. annotationSource)Checks if an annotated element should be assigned a value by considering the runtime type. |
| Verifier | back to summary |
|---|---|
| private Verifier() As this is merely a utility method, the constructor is not supposed to be invoked. | |
| check | back to summary |
|---|---|
| public static Assigner. Checks if an annotated element should be assigned a value by considering the runtime type.
| |