Java Code Examples for com.alibaba.dubbo.common.utils.ReflectUtils#getName()

The following examples show how to use com.alibaba.dubbo.common.utils.ReflectUtils#getName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Proxy.java    From dubbo-2.6.5 with Apache License 2.0 6 votes vote down vote up
private static String asArgument(Class<?> cl, String name) {
    if (cl.isPrimitive()) {
        if (Boolean.TYPE == cl)
            return name + "==null?false:((Boolean)" + name + ").booleanValue()";
        if (Byte.TYPE == cl)
            return name + "==null?(byte)0:((Byte)" + name + ").byteValue()";
        if (Character.TYPE == cl)
            return name + "==null?(char)0:((Character)" + name + ").charValue()";
        if (Double.TYPE == cl)
            return name + "==null?(double)0:((Double)" + name + ").doubleValue()";
        if (Float.TYPE == cl)
            return name + "==null?(float)0:((Float)" + name + ").floatValue()";
        if (Integer.TYPE == cl)
            return name + "==null?(int)0:((Integer)" + name + ").intValue()";
        if (Long.TYPE == cl)
            return name + "==null?(long)0:((Long)" + name + ").longValue()";
        if (Short.TYPE == cl)
            return name + "==null?(short)0:((Short)" + name + ").shortValue()";
        throw new RuntimeException(name + " is unknown primitive type.");
    }
    return "(" + ReflectUtils.getName(cl) + ")" + name;
}
 
Example 2
Source File: Wrapper.java    From dubbox with Apache License 2.0 6 votes vote down vote up
private static String arg(Class<?> cl, String name)
{
	if( cl.isPrimitive() )
	{
		if( cl == Boolean.TYPE )
			return "((Boolean)" + name + ").booleanValue()";
		if( cl == Byte.TYPE )
			return "((Byte)" + name + ").byteValue()";
		if( cl == Character.TYPE )
			return "((Character)" + name + ").charValue()";
		if( cl == Double.TYPE )
			return "((Number)" + name + ").doubleValue()";
		if( cl == Float.TYPE )
			return "((Number)" + name + ").floatValue()";
		if( cl == Integer.TYPE )
			return "((Number)" + name + ").intValue()";
		if( cl == Long.TYPE )
			return "((Number)" + name + ").longValue()";
		if( cl == Short.TYPE )
			return "((Number)" + name + ").shortValue()";
		throw new RuntimeException("Unknown primitive type: " + cl.getName());
	}
	return "(" + ReflectUtils.getName(cl) + ")" + name;
}
 
Example 3
Source File: Proxy.java    From dubbox with Apache License 2.0 6 votes vote down vote up
private static String asArgument(Class<?> cl, String name)
{
	if( cl.isPrimitive() )
	{
		if( Boolean.TYPE == cl )
			return name + "==null?false:((Boolean)" + name + ").booleanValue()";
		if( Byte.TYPE == cl )
			return name + "==null?(byte)0:((Byte)" + name + ").byteValue()";
		if( Character.TYPE == cl )
			return name + "==null?(char)0:((Character)" + name + ").charValue()";
		if( Double.TYPE == cl )
			return name + "==null?(double)0:((Double)" + name + ").doubleValue()";
		if( Float.TYPE == cl )
			return name + "==null?(float)0:((Float)" + name + ").floatValue()";
		if( Integer.TYPE == cl )
			return name + "==null?(int)0:((Integer)" + name + ").intValue()";
		if( Long.TYPE == cl )
			return name + "==null?(long)0:((Long)" + name + ").longValue()";
		if( Short.TYPE == cl )
			return name + "==null?(short)0:((Short)" + name + ").shortValue()";
		throw new RuntimeException(name+" is unknown primitive type."); 
	}
	return "(" + ReflectUtils.getName(cl) + ")"+name;
}
 
Example 4
Source File: MakeWrapperInterceptor.java    From skywalking with Apache License 2.0 6 votes vote down vote up
private static String arg(Class<?> cl, String name) {
    if (cl.isPrimitive()) {
        if (cl == Boolean.TYPE)
            return "((Boolean)" + name + ").booleanValue()";
        if (cl == Byte.TYPE)
            return "((Byte)" + name + ").byteValue()";
        if (cl == Character.TYPE)
            return "((Character)" + name + ").charValue()";
        if (cl == Double.TYPE)
            return "((Number)" + name + ").doubleValue()";
        if (cl == Float.TYPE)
            return "((Number)" + name + ").floatValue()";
        if (cl == Integer.TYPE)
            return "((Number)" + name + ").intValue()";
        if (cl == Long.TYPE)
            return "((Number)" + name + ").longValue()";
        if (cl == Short.TYPE)
            return "((Number)" + name + ").shortValue()";
        throw new RuntimeException("Unknown primitive type: " + cl.getName());
    }
    return "(" + ReflectUtils.getName(cl) + ")" + name;
}
 
Example 5
Source File: Wrapper.java    From dubbox with Apache License 2.0 6 votes vote down vote up
private static String arg(Class<?> cl, String name)
{
	if( cl.isPrimitive() )
	{
		if( cl == Boolean.TYPE )
			return "((Boolean)" + name + ").booleanValue()";
		if( cl == Byte.TYPE )
			return "((Byte)" + name + ").byteValue()";
		if( cl == Character.TYPE )
			return "((Character)" + name + ").charValue()";
		if( cl == Double.TYPE )
			return "((Number)" + name + ").doubleValue()";
		if( cl == Float.TYPE )
			return "((Number)" + name + ").floatValue()";
		if( cl == Integer.TYPE )
			return "((Number)" + name + ").intValue()";
		if( cl == Long.TYPE )
			return "((Number)" + name + ").longValue()";
		if( cl == Short.TYPE )
			return "((Number)" + name + ").shortValue()";
		throw new RuntimeException("Unknown primitive type: " + cl.getName());
	}
	return "(" + ReflectUtils.getName(cl) + ")" + name;
}
 
Example 6
Source File: Proxy.java    From dubbox with Apache License 2.0 6 votes vote down vote up
private static String asArgument(Class<?> cl, String name)
{
	if( cl.isPrimitive() )
	{
		if( Boolean.TYPE == cl )
			return name + "==null?false:((Boolean)" + name + ").booleanValue()";
		if( Byte.TYPE == cl )
			return name + "==null?(byte)0:((Byte)" + name + ").byteValue()";
		if( Character.TYPE == cl )
			return name + "==null?(char)0:((Character)" + name + ").charValue()";
		if( Double.TYPE == cl )
			return name + "==null?(double)0:((Double)" + name + ").doubleValue()";
		if( Float.TYPE == cl )
			return name + "==null?(float)0:((Float)" + name + ").floatValue()";
		if( Integer.TYPE == cl )
			return name + "==null?(int)0:((Integer)" + name + ").intValue()";
		if( Long.TYPE == cl )
			return name + "==null?(long)0:((Long)" + name + ").longValue()";
		if( Short.TYPE == cl )
			return name + "==null?(short)0:((Short)" + name + ").shortValue()";
		throw new RuntimeException(name+" is unknown primitive type."); 
	}
	return "(" + ReflectUtils.getName(cl) + ")"+name;
}
 
Example 7
Source File: Wrapper.java    From dubbo3 with Apache License 2.0 6 votes vote down vote up
private static String arg(Class<?> cl, String name)
{
	if( cl.isPrimitive() )
	{
		if( cl == Boolean.TYPE )
			return "((Boolean)" + name + ").booleanValue()";
		if( cl == Byte.TYPE )
			return "((Byte)" + name + ").byteValue()";
		if( cl == Character.TYPE )
			return "((Character)" + name + ").charValue()";
		if( cl == Double.TYPE )
			return "((Number)" + name + ").doubleValue()";
		if( cl == Float.TYPE )
			return "((Number)" + name + ").floatValue()";
		if( cl == Integer.TYPE )
			return "((Number)" + name + ").intValue()";
		if( cl == Long.TYPE )
			return "((Number)" + name + ").longValue()";
		if( cl == Short.TYPE )
			return "((Number)" + name + ").shortValue()";
		throw new RuntimeException("Unknown primitive type: " + cl.getName());
	}
	return "(" + ReflectUtils.getName(cl) + ")" + name;
}
 
Example 8
Source File: Proxy.java    From dubbo3 with Apache License 2.0 6 votes vote down vote up
private static String asArgument(Class<?> cl, String name) {
    if (cl.isPrimitive()) {
        if (Boolean.TYPE == cl)
            return name + "==null?false:((Boolean)" + name + ").booleanValue()";
        if (Byte.TYPE == cl)
            return name + "==null?(byte)0:((Byte)" + name + ").byteValue()";
        if (Character.TYPE == cl)
            return name + "==null?(char)0:((Character)" + name + ").charValue()";
        if (Double.TYPE == cl)
            return name + "==null?(double)0:((Double)" + name + ").doubleValue()";
        if (Float.TYPE == cl)
            return name + "==null?(float)0:((Float)" + name + ").floatValue()";
        if (Integer.TYPE == cl)
            return name + "==null?(int)0:((Integer)" + name + ").intValue()";
        if (Long.TYPE == cl)
            return name + "==null?(long)0:((Long)" + name + ").longValue()";
        if (Short.TYPE == cl)
            return name + "==null?(short)0:((Short)" + name + ").shortValue()";
        throw new RuntimeException(name + " is unknown primitive type.");
    }
    return "(" + ReflectUtils.getName(cl) + ")" + name;
}
 
Example 9
Source File: Wrapper.java    From dubbox-hystrix with Apache License 2.0 6 votes vote down vote up
private static String arg(Class<?> cl, String name)
{
	if( cl.isPrimitive() )
	{
		if( cl == Boolean.TYPE )
			return "((Boolean)" + name + ").booleanValue()";
		if( cl == Byte.TYPE )
			return "((Byte)" + name + ").byteValue()";
		if( cl == Character.TYPE )
			return "((Character)" + name + ").charValue()";
		if( cl == Double.TYPE )
			return "((Number)" + name + ").doubleValue()";
		if( cl == Float.TYPE )
			return "((Number)" + name + ").floatValue()";
		if( cl == Integer.TYPE )
			return "((Number)" + name + ").intValue()";
		if( cl == Long.TYPE )
			return "((Number)" + name + ").longValue()";
		if( cl == Short.TYPE )
			return "((Number)" + name + ").shortValue()";
		throw new RuntimeException("Unknown primitive type: " + cl.getName());
	}
	return "(" + ReflectUtils.getName(cl) + ")" + name;
}
 
Example 10
Source File: Proxy.java    From dubbox-hystrix with Apache License 2.0 6 votes vote down vote up
private static String asArgument(Class<?> cl, String name)
{
	if( cl.isPrimitive() )
	{
		if( Boolean.TYPE == cl )
			return name + "==null?false:((Boolean)" + name + ").booleanValue()";
		if( Byte.TYPE == cl )
			return name + "==null?(byte)0:((Byte)" + name + ").byteValue()";
		if( Character.TYPE == cl )
			return name + "==null?(char)0:((Character)" + name + ").charValue()";
		if( Double.TYPE == cl )
			return name + "==null?(double)0:((Double)" + name + ").doubleValue()";
		if( Float.TYPE == cl )
			return name + "==null?(float)0:((Float)" + name + ").floatValue()";
		if( Integer.TYPE == cl )
			return name + "==null?(int)0:((Integer)" + name + ").intValue()";
		if( Long.TYPE == cl )
			return name + "==null?(long)0:((Long)" + name + ").longValue()";
		if( Short.TYPE == cl )
			return name + "==null?(short)0:((Short)" + name + ").shortValue()";
		throw new RuntimeException(name+" is unknown primitive type."); 
	}
	return "(" + ReflectUtils.getName(cl) + ")"+name;
}
 
Example 11
Source File: Wrapper.java    From dubbox with Apache License 2.0 6 votes vote down vote up
private static String arg(Class<?> cl, String name)
{
	if( cl.isPrimitive() )
	{
		if( cl == Boolean.TYPE )
			return "((Boolean)" + name + ").booleanValue()";
		if( cl == Byte.TYPE )
			return "((Byte)" + name + ").byteValue()";
		if( cl == Character.TYPE )
			return "((Character)" + name + ").charValue()";
		if( cl == Double.TYPE )
			return "((Number)" + name + ").doubleValue()";
		if( cl == Float.TYPE )
			return "((Number)" + name + ").floatValue()";
		if( cl == Integer.TYPE )
			return "((Number)" + name + ").intValue()";
		if( cl == Long.TYPE )
			return "((Number)" + name + ").longValue()";
		if( cl == Short.TYPE )
			return "((Number)" + name + ").shortValue()";
		throw new RuntimeException("Unknown primitive type: " + cl.getName());
	}
	return "(" + ReflectUtils.getName(cl) + ")" + name;
}
 
Example 12
Source File: Proxy.java    From dubbox with Apache License 2.0 6 votes vote down vote up
private static String asArgument(Class<?> cl, String name)
{
	if( cl.isPrimitive() )
	{
		if( Boolean.TYPE == cl )
			return name + "==null?false:((Boolean)" + name + ").booleanValue()";
		if( Byte.TYPE == cl )
			return name + "==null?(byte)0:((Byte)" + name + ").byteValue()";
		if( Character.TYPE == cl )
			return name + "==null?(char)0:((Character)" + name + ").charValue()";
		if( Double.TYPE == cl )
			return name + "==null?(double)0:((Double)" + name + ").doubleValue()";
		if( Float.TYPE == cl )
			return name + "==null?(float)0:((Float)" + name + ").floatValue()";
		if( Integer.TYPE == cl )
			return name + "==null?(int)0:((Integer)" + name + ").intValue()";
		if( Long.TYPE == cl )
			return name + "==null?(long)0:((Long)" + name + ").longValue()";
		if( Short.TYPE == cl )
			return name + "==null?(short)0:((Short)" + name + ").shortValue()";
		throw new RuntimeException(name+" is unknown primitive type."); 
	}
	return "(" + ReflectUtils.getName(cl) + ")"+name;
}
 
Example 13
Source File: Wrapper.java    From dubbo-2.6.5 with Apache License 2.0 6 votes vote down vote up
private static String arg(Class<?> cl, String name) {
    if (cl.isPrimitive()) {
        if (cl == Boolean.TYPE)
            return "((Boolean)" + name + ").booleanValue()";
        if (cl == Byte.TYPE)
            return "((Byte)" + name + ").byteValue()";
        if (cl == Character.TYPE)
            return "((Character)" + name + ").charValue()";
        if (cl == Double.TYPE)
            return "((Number)" + name + ").doubleValue()";
        if (cl == Float.TYPE)
            return "((Number)" + name + ").floatValue()";
        if (cl == Integer.TYPE)
            return "((Number)" + name + ").intValue()";
        if (cl == Long.TYPE)
            return "((Number)" + name + ").longValue()";
        if (cl == Short.TYPE)
            return "((Number)" + name + ").shortValue()";
        throw new RuntimeException("Unknown primitive type: " + cl.getName());
    }
    return "(" + ReflectUtils.getName(cl) + ")" + name;
}
 
Example 14
Source File: Proxy.java    From dubbo3 with Apache License 2.0 4 votes vote down vote up
public Object invoke(Object proxy, Method method, Object[] args) {
    throw new UnsupportedOperationException("Method [" + ReflectUtils.getName(method) + "] unimplemented.");
}
 
Example 15
Source File: Proxy.java    From dubbo-2.6.5 with Apache License 2.0 4 votes vote down vote up
@Override
public Object invoke(Object proxy, Method method, Object[] args) {
    throw new UnsupportedOperationException("Method [" + ReflectUtils.getName(method) + "] unimplemented.");
}
 
Example 16
Source File: Proxy.java    From dubbox-hystrix with Apache License 2.0 votes vote down vote up
public Object invoke(Object proxy, Method method, Object[] args){ throw new UnsupportedOperationException("Method [" + ReflectUtils.getName(method) + "] unimplemented."); } 
Example 17
Source File: Proxy.java    From dubbox with Apache License 2.0 votes vote down vote up
public Object invoke(Object proxy, Method method, Object[] args){ throw new UnsupportedOperationException("Method [" + ReflectUtils.getName(method) + "] unimplemented."); } 
Example 18
Source File: Proxy.java    From dubbox with Apache License 2.0 votes vote down vote up
public Object invoke(Object proxy, Method method, Object[] args){ throw new UnsupportedOperationException("Method [" + ReflectUtils.getName(method) + "] unimplemented."); } 
Example 19
Source File: Proxy.java    From dubbox with Apache License 2.0 votes vote down vote up
public Object invoke(Object proxy, Method method, Object[] args){ throw new UnsupportedOperationException("Method [" + ReflectUtils.getName(method) + "] unimplemented."); }