91 * <p>
92 * Like {@link java.lang.Integer#valueOf Integer.valueOf},
93 * {@code asInterfaceInstance} is a factory method whose results are defined
94 * by their behavior.
95 * It is not guaranteed to return a new instance for every call.
96 * <p>
97 * Because of the possibility of {@linkplain java.lang.reflect.Method#isBridge bridge methods}
98 * and other corner cases, the interface may also have several abstract methods
99 * with the same name but having distinct descriptors (types of returns and parameters).
100 * In this case, all the methods are bound in common to the one given target.
101 * The type check and effective {@code asType} conversion is applied to each
102 * method type descriptor, and all abstract methods are bound to the target in common.
103 * Beyond this type check, no further checks are made to determine that the
104 * abstract methods are related in any way.
105 * <p>
106 * Future versions of this API may accept additional types,
107 * such as abstract classes with single abstract methods.
108 * Future versions of this API may also equip wrapper instances
109 * with one or more additional public "marker" interfaces.
110 *
111 * @param target the method handle to invoke from the wrapper
112 * @param intfc the desired type of the wrapper, a single-method interface
113 * @return a correctly-typed wrapper for the given target
114 * @throws NullPointerException if either argument is null
115 * @throws IllegalArgumentException if the {@code intfc} is not a
116 * valid argument to this method
117 * @throws WrongMethodTypeException if the target cannot
118 * be converted to the type required by the requested interface
119 */
120 // Other notes to implementors:
121 // <p>
122 // No stable mapping is promised between the single-method interface and
123 // the implementation class C. Over time, several implementation
124 // classes might be used for the same type.
125 // <p>
126 // If the implementation is able
127 // to prove that a wrapper of the required type
128 // has already been created for a given
129 // method handle, or for another method handle with the
130 // same behavior, the implementation may return that wrapper in place of
131 // a new wrapper.
132 // <p>
|
91 * <p>
92 * Like {@link java.lang.Integer#valueOf Integer.valueOf},
93 * {@code asInterfaceInstance} is a factory method whose results are defined
94 * by their behavior.
95 * It is not guaranteed to return a new instance for every call.
96 * <p>
97 * Because of the possibility of {@linkplain java.lang.reflect.Method#isBridge bridge methods}
98 * and other corner cases, the interface may also have several abstract methods
99 * with the same name but having distinct descriptors (types of returns and parameters).
100 * In this case, all the methods are bound in common to the one given target.
101 * The type check and effective {@code asType} conversion is applied to each
102 * method type descriptor, and all abstract methods are bound to the target in common.
103 * Beyond this type check, no further checks are made to determine that the
104 * abstract methods are related in any way.
105 * <p>
106 * Future versions of this API may accept additional types,
107 * such as abstract classes with single abstract methods.
108 * Future versions of this API may also equip wrapper instances
109 * with one or more additional public "marker" interfaces.
110 *
111 * @param <T> the desired type of the wrapper, a single-method interface
112 * @param intfc a class object representing {@code T}
113 * @param target the method handle to invoke from the wrapper
114 * @return a correctly-typed wrapper for the given target
115 * @throws NullPointerException if either argument is null
116 * @throws IllegalArgumentException if the {@code intfc} is not a
117 * valid argument to this method
118 * @throws WrongMethodTypeException if the target cannot
119 * be converted to the type required by the requested interface
120 */
121 // Other notes to implementors:
122 // <p>
123 // No stable mapping is promised between the single-method interface and
124 // the implementation class C. Over time, several implementation
125 // classes might be used for the same type.
126 // <p>
127 // If the implementation is able
128 // to prove that a wrapper of the required type
129 // has already been created for a given
130 // method handle, or for another method handle with the
131 // same behavior, the implementation may return that wrapper in place of
132 // a new wrapper.
133 // <p>
|