@Documented @Retention(value=RUNTIME) @Target(value={PARAMETER,METHOD}) public @interface RuntimeType
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 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.Copyright © 2014–2018. All rights reserved.