src/jdk/internal/dynalink/beans/SimpleDynamicMethod.java

changeset 963
e2497b11a021
parent 962
ac62e33a99b0
child 1205
4112748288bb
child 1539
684d430470f6
equal deleted inserted replaced
962:ac62e33a99b0 963:e2497b11a021
96 * 96 *
97 * @author Attila Szegedi 97 * @author Attila Szegedi
98 */ 98 */
99 class SimpleDynamicMethod extends SingleDynamicMethod { 99 class SimpleDynamicMethod extends SingleDynamicMethod {
100 private final MethodHandle target; 100 private final MethodHandle target;
101 private final boolean constructor;
101 102
102 /** 103 /**
103 * Creates a new simple dynamic method, with a name constructed from the class name, method name, and handle 104 * Creates a new simple dynamic method, with a name constructed from the class name, method name, and handle
104 * signature. 105 * signature.
105 * 106 *
106 * @param target the target method handle 107 * @param target the target method handle
107 * @param clazz the class declaring the method 108 * @param clazz the class declaring the method
108 * @param name the simple name of the method 109 * @param name the simple name of the method
109 */ 110 */
110 SimpleDynamicMethod(final MethodHandle target, final Class<?> clazz, final String name) { 111 SimpleDynamicMethod(final MethodHandle target, final Class<?> clazz, final String name) {
112 this(target, clazz, name, false);
113 }
114
115 /**
116 * Creates a new simple dynamic method, with a name constructed from the class name, method name, and handle
117 * signature.
118 *
119 * @param target the target method handle
120 * @param clazz the class declaring the method
121 * @param name the simple name of the method
122 * @param constructor does this represent a constructor?
123 */
124 SimpleDynamicMethod(final MethodHandle target, final Class<?> clazz, final String name, final boolean constructor) {
111 super(getName(target, clazz, name)); 125 super(getName(target, clazz, name));
112 this.target = target; 126 this.target = target;
127 this.constructor = constructor;
113 } 128 }
114 129
115 private static String getName(final MethodHandle target, final Class<?> clazz, final String name) { 130 private static String getName(final MethodHandle target, final Class<?> clazz, final String name) {
116 return getMethodNameWithSignature(target.type(), getClassAndMethodName(clazz, name)); 131 return getMethodNameWithSignature(target.type(), getClassAndMethodName(clazz, name));
117 } 132 }
128 143
129 @Override 144 @Override
130 MethodHandle getTarget(final Lookup lookup) { 145 MethodHandle getTarget(final Lookup lookup) {
131 return target; 146 return target;
132 } 147 }
148
149 @Override
150 boolean isConstructor() {
151 return constructor;
152 }
133 } 153 }

mercurial