Java Code Examples for com.alibaba.dubbo.common.bytecode.Wrapper#getWrapper()

The following examples show how to use com.alibaba.dubbo.common.bytecode.Wrapper#getWrapper() . 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: 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 2
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 3
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 4
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 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 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();
	}
}