196849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe/*
296849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe * Copyright (C) 2014 The Android Open Source Project
396849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe *
496849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe * Licensed under the Apache License, Version 2.0 (the "License");
596849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe * you may not use this file except in compliance with the License.
696849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe * You may obtain a copy of the License at
796849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe *
896849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe *      http://www.apache.org/licenses/LICENSE-2.0
996849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe *
1096849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe * Unless required by applicable law or agreed to in writing, software
1196849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe * distributed under the License is distributed on an "AS IS" BASIS,
1296849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1396849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe * See the License for the specific language governing permissions and
1496849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe * limitations under the License.
1596849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe */
1696849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe
1796849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampeimport java.lang.reflect.*;
1896849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe
1996849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe/**
2096849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe * Test java.lang.reflect.Proxy
2196849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe */
2296849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampepublic class FloatSelect {
2396849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe
2496849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe    public interface FloatSelectI {
2596849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe      public float method(float a, float b);
2696849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe    }
2796849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe
2896849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe    static class FloatSelectIInvoke1 implements InvocationHandler {
2996849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe        public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
3096849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe            return args[1];
3196849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe        }
3296849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe    }
3396849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe
3496849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe    public static void main(String[] args) {
3596849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe        FloatSelectI proxyObject = (FloatSelectI) Proxy.newProxyInstance(
3696849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe            FloatSelectI.class.getClassLoader(),
3796849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe            new Class[] { FloatSelectI.class },
3896849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe            new FloatSelectIInvoke1());
3996849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe
4096849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe        float floatResult = proxyObject.method(2.1f, 5.8f);
4196849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe        System.out.println(floatResult);
4296849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe    }
4396849cec52b598b22e0a9e62d5ec37f39f9b9af5Andreas Gampe}
44