Lines Matching refs:wrap

147     private static MethodType unboxType(Wrapper wrap, int kind) {
149 return MethodType.methodType(wrap.primitiveType(), wrap.wrapperType());
150 return MethodType.methodType(wrap.primitiveType(), Object.class, boolean.class);
155 private static MethodHandle unbox(Wrapper wrap, int kind) {
161 MethodHandle mh = cache.get(wrap);
166 switch (wrap) {
169 throw new IllegalArgumentException("unbox "+wrap);
172 String name = "unbox" + wrap.wrapperSimpleName();
173 MethodType type = unboxType(wrap, kind);
185 mh = mh.asType(unboxType(wrap, 0));
187 return cache.put(wrap, mh);
189 throw new IllegalArgumentException("cannot find unbox adapter for " + wrap
228 * according to the primitive type of the given wrapper {@code wrap}.
232 public static Number primitiveConversion(Wrapper wrap, Object x, boolean cast) {
250 if (xwrap == null || !cast && !wrap.isConvertibleFrom(xwrap))
252 return (Number) wrap.wrapperType().cast(x);
311 private static MethodType boxType(Wrapper wrap) {
313 Class<?> boxType = wrap.wrapperType();
314 return MethodType.methodType(boxType, wrap.primitiveType());
319 public static MethodHandle boxExact(Wrapper wrap) {
321 MethodHandle mh = cache.get(wrap);
326 String name = "box" + wrap.wrapperSimpleName();
327 MethodType type = boxType(wrap);
334 return cache.put(wrap, mh);
336 throw new IllegalArgumentException("cannot find box adapter for " + wrap);
370 public static MethodHandle zeroConstantFunction(Wrapper wrap) {
372 MethodHandle mh = cache.get(wrap);
377 MethodType type = MethodType.methodType(wrap.primitiveType());
378 switch (wrap) {
385 mh = IMPL_LOOKUP.findStatic(THIS_CLASS, "zero"+wrap.wrapperSimpleName(), type);
392 return cache.put(wrap, mh);
396 if (wrap.isSubwordOrInt() && wrap != Wrapper.INT) {
398 return cache.put(wrap, mh);
400 throw new IllegalArgumentException("cannot find zero constant for " + wrap);