com.alibaba.dubbo.common.bytecode.Wrapper Java Examples

The following examples show how to use com.alibaba.dubbo.common.bytecode.Wrapper. 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: DubboRegistryFactory.java    From dubbox-hystrix with Apache License 2.0 6 votes vote down vote up
private static URL getRegistryURL(URL url) {
    return url.setPath(RegistryService.class.getName())
            .removeParameter(Constants.EXPORT_KEY).removeParameter(Constants.REFER_KEY)
            .addParameter(Constants.INTERFACE_KEY, RegistryService.class.getName())
            .addParameter(Constants.CLUSTER_STICKY_KEY, "true")
            .addParameter(Constants.LAZY_CONNECT_KEY, "true")
            .addParameter(Constants.RECONNECT_KEY, "false")
            .addParameterIfAbsent(Constants.TIMEOUT_KEY, "10000")
            .addParameterIfAbsent(Constants.CALLBACK_INSTANCES_LIMIT_KEY, "10000")
            .addParameterIfAbsent(Constants.CONNECT_TIMEOUT_KEY, "10000")
            .addParameter(Constants.METHODS_KEY, StringUtils.join(new HashSet<String>(Arrays.asList(Wrapper.getWrapper(RegistryService.class).getDeclaredMethodNames())), ","))
            //.addParameter(Constants.STUB_KEY, RegistryServiceStub.class.getName())
            //.addParameter(Constants.STUB_EVENT_KEY, Boolean.TRUE.toString()) //for event dispatch
            //.addParameter(Constants.ON_DISCONNECT_KEY, "disconnect")
            .addParameter("subscribe.1.callback", "true")
            .addParameter("unsubscribe.1.callback", "false");
}
 
Example #2
Source File: DubboRegistryFactory.java    From dubbox with Apache License 2.0 6 votes vote down vote up
private static URL getRegistryURL(URL url) {
    return url.setPath(RegistryService.class.getName())
            .removeParameter(Constants.EXPORT_KEY).removeParameter(Constants.REFER_KEY)
            .addParameter(Constants.INTERFACE_KEY, RegistryService.class.getName())
            .addParameter(Constants.CLUSTER_STICKY_KEY, "true")
            .addParameter(Constants.LAZY_CONNECT_KEY, "true")
            .addParameter(Constants.RECONNECT_KEY, "false")
            .addParameterIfAbsent(Constants.TIMEOUT_KEY, "10000")
            .addParameterIfAbsent(Constants.CALLBACK_INSTANCES_LIMIT_KEY, "10000")
            .addParameterIfAbsent(Constants.CONNECT_TIMEOUT_KEY, "10000")
            .addParameter(Constants.METHODS_KEY, StringUtils.join(new HashSet<String>(Arrays.asList(Wrapper.getWrapper(RegistryService.class).getDeclaredMethodNames())), ","))
            //.addParameter(Constants.STUB_KEY, RegistryServiceStub.class.getName())
            //.addParameter(Constants.STUB_EVENT_KEY, Boolean.TRUE.toString()) //for event dispatch
            //.addParameter(Constants.ON_DISCONNECT_KEY, "disconnect")
            .addParameter("subscribe.1.callback", "true")
            .addParameter("unsubscribe.1.callback", "false");
}
 
Example #3
Source File: JSON.java    From dubbox with Apache License 2.0 6 votes vote down vote up
private static void json(Object obj, String[] properties, JSONWriter jb, boolean writeClass) throws IOException
{
	if( obj == null )
	{
		jb.valueNull();
	}
	else
	{
		Wrapper wrapper = Wrapper.getWrapper(obj.getClass());

		Object value;
		jb.objectBegin();
		for( String prop : properties )
		{
			jb.objectItem(prop);
			value = wrapper.getPropertyValue(obj, prop);
			if( value == null )
				jb.valueNull();
			else
				DEFAULT_CONVERTER.writeValue(value, jb, writeClass);
		}
		jb.objectEnd();
	}
}
 
Example #4
Source File: DubboRegistryFactory.java    From dubbox with Apache License 2.0 6 votes vote down vote up
private static URL getRegistryURL(URL url) {
    return url.setPath(RegistryService.class.getName())
            .removeParameter(Constants.EXPORT_KEY).removeParameter(Constants.REFER_KEY)
            .addParameter(Constants.INTERFACE_KEY, RegistryService.class.getName())
            .addParameter(Constants.CLUSTER_STICKY_KEY, "true")
            .addParameter(Constants.LAZY_CONNECT_KEY, "true")
            .addParameter(Constants.RECONNECT_KEY, "false")
            .addParameterIfAbsent(Constants.TIMEOUT_KEY, "10000")
            .addParameterIfAbsent(Constants.CALLBACK_INSTANCES_LIMIT_KEY, "10000")
            .addParameterIfAbsent(Constants.CONNECT_TIMEOUT_KEY, "10000")
            .addParameter(Constants.METHODS_KEY, StringUtils.join(new HashSet<String>(Arrays.asList(Wrapper.getWrapper(RegistryService.class).getDeclaredMethodNames())), ","))
            //.addParameter(Constants.STUB_KEY, RegistryServiceStub.class.getName())
            //.addParameter(Constants.STUB_EVENT_KEY, Boolean.TRUE.toString()) //for event dispatch
            //.addParameter(Constants.ON_DISCONNECT_KEY, "disconnect")
            .addParameter("subscribe.1.callback", "true")
            .addParameter("unsubscribe.1.callback", "false");
}
 
Example #5
Source File: JSON.java    From dubbox with Apache License 2.0 6 votes vote down vote up
private static void json(Object obj, String[] properties, JSONWriter jb, boolean writeClass) throws IOException
{
	if( obj == null )
	{
		jb.valueNull();
	}
	else
	{
		Wrapper wrapper = Wrapper.getWrapper(obj.getClass());

		Object value;
		jb.objectBegin();
		for( String prop : properties )
		{
			jb.objectItem(prop);
			value = wrapper.getPropertyValue(obj, prop);
			if( value == null )
				jb.valueNull();
			else
				DEFAULT_CONVERTER.writeValue(value, jb, writeClass);
		}
		jb.objectEnd();
	}
}
 
Example #6
Source File: JSON.java    From dubbo3 with Apache License 2.0 6 votes vote down vote up
private static void json(Object obj, String[] properties, JSONWriter jb, boolean writeClass) throws IOException
{
	if( obj == null )
	{
		jb.valueNull();
	}
	else
	{
		Wrapper wrapper = Wrapper.getWrapper(obj.getClass());

		Object value;
		jb.objectBegin();
		for( String prop : properties )
		{
			jb.objectItem(prop);
			value = wrapper.getPropertyValue(obj, prop);
			if( value == null )
				jb.valueNull();
			else
				DEFAULT_CONVERTER.writeValue(value, jb, writeClass);
		}
		jb.objectEnd();
	}
}
 
Example #7
Source File: JSON.java    From dubbox-hystrix with Apache License 2.0 6 votes vote down vote up
private static void json(Object obj, String[] properties, JSONWriter jb, boolean writeClass) throws IOException
{
	if( obj == null )
	{
		jb.valueNull();
	}
	else
	{
		Wrapper wrapper = Wrapper.getWrapper(obj.getClass());

		Object value;
		jb.objectBegin();
		for( String prop : properties )
		{
			jb.objectItem(prop);
			value = wrapper.getPropertyValue(obj, prop);
			if( value == null )
				jb.valueNull();
			else
				DEFAULT_CONVERTER.writeValue(value, jb, writeClass);
		}
		jb.objectEnd();
	}
}
 
Example #8
Source File: DubboRegistryFactory.java    From dubbox with Apache License 2.0 6 votes vote down vote up
private static URL getRegistryURL(URL url) {
    return url.setPath(RegistryService.class.getName())
            .removeParameter(Constants.EXPORT_KEY).removeParameter(Constants.REFER_KEY)
            .addParameter(Constants.INTERFACE_KEY, RegistryService.class.getName())
            .addParameter(Constants.CLUSTER_STICKY_KEY, "true")
            .addParameter(Constants.LAZY_CONNECT_KEY, "true")
            .addParameter(Constants.RECONNECT_KEY, "false")
            .addParameterIfAbsent(Constants.TIMEOUT_KEY, "10000")
            .addParameterIfAbsent(Constants.CALLBACK_INSTANCES_LIMIT_KEY, "10000")
            .addParameterIfAbsent(Constants.CONNECT_TIMEOUT_KEY, "10000")
            .addParameter(Constants.METHODS_KEY, StringUtils.join(new HashSet<String>(Arrays.asList(Wrapper.getWrapper(RegistryService.class).getDeclaredMethodNames())), ","))
            //.addParameter(Constants.STUB_KEY, RegistryServiceStub.class.getName())
            //.addParameter(Constants.STUB_EVENT_KEY, Boolean.TRUE.toString()) //for event dispatch
            //.addParameter(Constants.ON_DISCONNECT_KEY, "disconnect")
            .addParameter("subscribe.1.callback", "true")
            .addParameter("unsubscribe.1.callback", "false");
}
 
Example #9
Source File: JSON.java    From dubbox with Apache License 2.0 6 votes vote down vote up
private static void json(Object obj, String[] properties, JSONWriter jb, boolean writeClass) throws IOException
{
	if( obj == null )
	{
		jb.valueNull();
	}
	else
	{
		Wrapper wrapper = Wrapper.getWrapper(obj.getClass());

		Object value;
		jb.objectBegin();
		for( String prop : properties )
		{
			jb.objectItem(prop);
			value = wrapper.getPropertyValue(obj, prop);
			if( value == null )
				jb.valueNull();
			else
				DEFAULT_CONVERTER.writeValue(value, jb, writeClass);
		}
		jb.objectEnd();
	}
}
 
Example #10
Source File: DubboRegistryFactory.java    From dubbo-2.6.5 with Apache License 2.0 6 votes vote down vote up
private static URL getRegistryURL(URL url) {
    return url.setPath(RegistryService.class.getName())
            .removeParameter(Constants.EXPORT_KEY).removeParameter(Constants.REFER_KEY)
            .addParameter(Constants.INTERFACE_KEY, RegistryService.class.getName())
            .addParameter(Constants.CLUSTER_STICKY_KEY, "true")
            .addParameter(Constants.LAZY_CONNECT_KEY, "true")
            .addParameter(Constants.RECONNECT_KEY, "false")
            .addParameterIfAbsent(Constants.TIMEOUT_KEY, "10000")
            .addParameterIfAbsent(Constants.CALLBACK_INSTANCES_LIMIT_KEY, "10000")
            .addParameterIfAbsent(Constants.CONNECT_TIMEOUT_KEY, "10000")
            .addParameter(Constants.METHODS_KEY, StringUtils.join(new HashSet<String>(Arrays.asList(Wrapper.getWrapper(RegistryService.class).getDeclaredMethodNames())), ","))
            //.addParameter(Constants.STUB_KEY, RegistryServiceStub.class.getName())
            //.addParameter(Constants.STUB_EVENT_KEY, Boolean.TRUE.toString()) //for event dispatch
            //.addParameter(Constants.ON_DISCONNECT_KEY, "disconnect")
            .addParameter("subscribe.1.callback", "true")
            .addParameter("unsubscribe.1.callback", "false");
}
 
Example #11
Source File: JSON.java    From dubbo-2.6.5 with Apache License 2.0 6 votes vote down vote up
private static void json(Object obj, String[] properties, JSONWriter jb, boolean writeClass) throws IOException {
    if (obj == null) {
        jb.valueNull();
    } else {
        Wrapper wrapper = Wrapper.getWrapper(obj.getClass());

        Object value;
        jb.objectBegin();
        for (String prop : properties) {
            jb.objectItem(prop);
            value = wrapper.getPropertyValue(obj, prop);
            if (value == null)
                jb.valueNull();
            else
                DEFAULT_CONVERTER.writeValue(value, jb, writeClass);
        }
        jb.objectEnd();
    }
}
 
Example #12
Source File: J2oVisitor.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
public Object objectEnd(int count)
{
	Object ret = mValue;
	mWrapper = (Wrapper)mStack.pop();
	mType = (Class<?>)mStack.pop();
	mValue = mStack.pop();
	return ret;
}
 
Example #13
Source File: J2oVisitor.java    From dubbo-2.6.5 with Apache License 2.0 5 votes vote down vote up
@Override
public Object objectEnd(int count) {
    Object ret = mValue;
    mWrapper = (Wrapper) mStack.pop();
    mType = (Class<?>) mStack.pop();
    mValue = mStack.pop();
    return ret;
}
 
Example #14
Source File: J2oVisitor.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
public Object objectEnd(int count)
{
	Object ret = mValue;
	mWrapper = (Wrapper)mStack.pop();
	mType = (Class<?>)mStack.pop();
	mValue = mStack.pop();
	return ret;
}
 
Example #15
Source File: J2oVisitor.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public Object objectEnd(int count)
{
	Object ret = mValue;
	mWrapper = (Wrapper)mStack.pop();
	mType = (Class<?>)mStack.pop();
	mValue = mStack.pop();
	return ret;
}
 
Example #16
Source File: J2oVisitor.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public Object objectEnd(int count)
{
	Object ret = mValue;
	mWrapper = (Wrapper)mStack.pop();
	mType = (Class<?>)mStack.pop();
	mValue = mStack.pop();
	return ret;
}
 
Example #17
Source File: J2oVisitor.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public Object objectEnd(int count)
{
	Object ret = mValue;
	mWrapper = (Wrapper)mStack.pop();
	mType = (Class<?>)mStack.pop();
	mValue = mStack.pop();
	return ret;
}