Java Code Examples for com.alibaba.dubbo.common.utils.ReflectUtils#getDesc()
The following examples show how to use
com.alibaba.dubbo.common.utils.ReflectUtils#getDesc() .
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: JacksonObjectOutput.java From dubbox with Apache License 2.0 | 6 votes |
public void writeObject(Object obj) throws IOException { // int i = ++index; if (obj == null) { writeObject0(obj); return; } //write data value writeObject0(obj); //write data type Class c = obj.getClass(); String desc = ReflectUtils.getDesc(c); data.put(KEY_PREFIX + (index) + "t", desc); // if (obj instanceof Collection) { // //集合类型 // } else if (obj instanceof Map) { // // // } else { // } }
Example 2
Source File: JacksonObjectOutput.java From dubbox with Apache License 2.0 | 6 votes |
public void writeObject(Object obj) throws IOException { // int i = ++index; if (obj == null) { writeObject0(obj); return; } //write data value writeObject0(obj); //write data type Class c = obj.getClass(); String desc = ReflectUtils.getDesc(c); data.put(KEY_PREFIX + (index) + "t", desc); // if (obj instanceof Collection) { // //集合类型 // } else if (obj instanceof Map) { // // // } else { // } }
Example 3
Source File: JacksonObjectOutput.java From dubbox-hystrix with Apache License 2.0 | 6 votes |
public void writeObject(Object obj) throws IOException { // int i = ++index; if (obj == null) { writeObject0(obj); return; } //write data value writeObject0(obj); //write data type Class c = obj.getClass(); String desc = ReflectUtils.getDesc(c); data.put(KEY_PREFIX + (index) + "t", desc); // if (obj instanceof Collection) { // //集合类型 // } else if (obj instanceof Map) { // // // } else { // } }
Example 4
Source File: JacksonObjectOutput.java From dubbox with Apache License 2.0 | 6 votes |
public void writeObject(Object obj) throws IOException { // int i = ++index; if (obj == null) { writeObject0(obj); return; } //write data value writeObject0(obj); //write data type Class c = obj.getClass(); String desc = ReflectUtils.getDesc(c); data.put(KEY_PREFIX + (index) + "t", desc); // if (obj instanceof Collection) { // //集合类型 // } else if (obj instanceof Map) { // // // } else { // } }
Example 5
Source File: GenericObjectOutput.java From dubbo3 with Apache License 2.0 | 6 votes |
@SuppressWarnings({"unchecked", "rawtypes"}) public void writeObject(Object obj) throws IOException { if (obj == null) { write0(OBJECT_NULL); return; } Class<?> c = obj.getClass(); if (c == Object.class) { write0(OBJECT_DUMMY); } else { String desc = ReflectUtils.getDesc(c); int index = mMapper.getDescriptorIndex(desc); if (index < 0) { write0(OBJECT_DESC); writeUTF(desc); } else { write0(OBJECT_DESC_ID); writeUInt(index); } Builder b = Builder.register(c, isAllowNonSerializable); b.writeTo(obj, this); } }
Example 6
Source File: GenericObjectOutput.java From dubbox with Apache License 2.0 | 5 votes |
@SuppressWarnings({ "unchecked", "rawtypes" }) public void writeObject(Object obj) throws IOException { if( obj == null ) { write0(OBJECT_NULL); return; } Class<?> c = obj.getClass(); if( c == Object.class ) { write0(OBJECT_DUMMY); } else { String desc = ReflectUtils.getDesc(c); int index = mMapper.getDescriptorIndex(desc); if( index < 0 ) { write0(OBJECT_DESC); writeUTF(desc); } else { write0(OBJECT_DESC_ID); writeUInt(index); } Builder b = Builder.register(c, isAllowNonSerializable); b.writeTo(obj, this); } }
Example 7
Source File: ClassGenerator.java From dubbox with Apache License 2.0 | 5 votes |
public ClassGenerator addConstructor(Constructor<?> c) { String desc = ReflectUtils.getDesc(c); addConstructor(":"+desc); if( mCopyConstructors == null ) mCopyConstructors = new ConcurrentHashMap<String, Constructor<?>>(4); mCopyConstructors.put(desc, c); return this; }
Example 8
Source File: Builder.java From dubbox with Apache License 2.0 | 5 votes |
private static void addDesc(Class<?> c) { String desc = ReflectUtils.getDesc(c); int index = mDescList.size(); mDescList.add(desc); mDescMap.put(desc, index); }
Example 9
Source File: GenericObjectOutput.java From dubbox with Apache License 2.0 | 5 votes |
@SuppressWarnings({ "unchecked", "rawtypes" }) public void writeObject(Object obj) throws IOException { if( obj == null ) { write0(OBJECT_NULL); return; } Class<?> c = obj.getClass(); if( c == Object.class ) { write0(OBJECT_DUMMY); } else { String desc = ReflectUtils.getDesc(c); int index = mMapper.getDescriptorIndex(desc); if( index < 0 ) { write0(OBJECT_DESC); writeUTF(desc); } else { write0(OBJECT_DESC_ID); writeUInt(index); } Builder b = Builder.register(c, isAllowNonSerializable); b.writeTo(obj, this); } }
Example 10
Source File: ClassGenerator.java From dubbox with Apache License 2.0 | 5 votes |
public ClassGenerator addConstructor(Constructor<?> c) { String desc = ReflectUtils.getDesc(c); addConstructor(":"+desc); if( mCopyConstructors == null ) mCopyConstructors = new ConcurrentHashMap<String, Constructor<?>>(4); mCopyConstructors.put(desc, c); return this; }
Example 11
Source File: Builder.java From dubbox with Apache License 2.0 | 5 votes |
private static void addDesc(Class<?> c) { String desc = ReflectUtils.getDesc(c); int index = mDescList.size(); mDescList.add(desc); mDescMap.put(desc, index); }
Example 12
Source File: GenericObjectOutput.java From dubbox with Apache License 2.0 | 5 votes |
@SuppressWarnings({ "unchecked", "rawtypes" }) public void writeObject(Object obj) throws IOException { if( obj == null ) { write0(OBJECT_NULL); return; } Class<?> c = obj.getClass(); if( c == Object.class ) { write0(OBJECT_DUMMY); } else { String desc = ReflectUtils.getDesc(c); int index = mMapper.getDescriptorIndex(desc); if( index < 0 ) { write0(OBJECT_DESC); writeUTF(desc); } else { write0(OBJECT_DESC_ID); writeUInt(index); } Builder b = Builder.register(c, isAllowNonSerializable); b.writeTo(obj, this); } }
Example 13
Source File: ClassGenerator.java From dubbo3 with Apache License 2.0 | 5 votes |
public ClassGenerator addConstructor(Constructor<?> c) { String desc = ReflectUtils.getDesc(c); addConstructor(":"+desc); if( mCopyConstructors == null ) mCopyConstructors = new ConcurrentHashMap<String, Constructor<?>>(4); mCopyConstructors.put(desc, c); return this; }
Example 14
Source File: ClassGenerator.java From dubbox-hystrix with Apache License 2.0 | 5 votes |
public ClassGenerator addConstructor(Constructor<?> c) { String desc = ReflectUtils.getDesc(c); addConstructor(":"+desc); if( mCopyConstructors == null ) mCopyConstructors = new ConcurrentHashMap<String, Constructor<?>>(4); mCopyConstructors.put(desc, c); return this; }
Example 15
Source File: GenericObjectOutput.java From dubbox-hystrix with Apache License 2.0 | 5 votes |
@SuppressWarnings({ "unchecked", "rawtypes" }) public void writeObject(Object obj) throws IOException { if( obj == null ) { write0(OBJECT_NULL); return; } Class<?> c = obj.getClass(); if( c == Object.class ) { write0(OBJECT_DUMMY); } else { String desc = ReflectUtils.getDesc(c); int index = mMapper.getDescriptorIndex(desc); if( index < 0 ) { write0(OBJECT_DESC); writeUTF(desc); } else { write0(OBJECT_DESC_ID); writeUInt(index); } Builder b = Builder.register(c, isAllowNonSerializable); b.writeTo(obj, this); } }
Example 16
Source File: ClassGenerator.java From dubbox with Apache License 2.0 | 5 votes |
public ClassGenerator addConstructor(Constructor<?> c) { String desc = ReflectUtils.getDesc(c); addConstructor(":"+desc); if( mCopyConstructors == null ) mCopyConstructors = new ConcurrentHashMap<String, Constructor<?>>(4); mCopyConstructors.put(desc, c); return this; }
Example 17
Source File: Builder.java From dubbox with Apache License 2.0 | 5 votes |
private static void addDesc(Class<?> c) { String desc = ReflectUtils.getDesc(c); int index = mDescList.size(); mDescList.add(desc); mDescMap.put(desc, index); }
Example 18
Source File: ClassGenerator.java From dubbo-2.6.5 with Apache License 2.0 | 5 votes |
public ClassGenerator addConstructor(Constructor<?> c) { String desc = ReflectUtils.getDesc(c); addConstructor(":" + desc); if (mCopyConstructors == null) mCopyConstructors = new ConcurrentHashMap<String, Constructor<?>>(4); mCopyConstructors.put(desc, c); return this; }
Example 19
Source File: Builder.java From dubbo3 with Apache License 2.0 | 4 votes |
private static void addDesc(Class<?> c) { String desc = ReflectUtils.getDesc(c); int index = mDescList.size(); mDescList.add(desc); mDescMap.put(desc, index); }
Example 20
Source File: DubboHessianPipe.java From Ak47 with Apache License 2.0 | 4 votes |
@Override public void encodeDubboRequest(Request<DubboHessianRequest> request, DubboData dd) throws Exception { DubboHessianRequest dubboreq = request.pojo(); // set flag DubboHeader dh = dubboreq.getDubboHeader(); dh.setFlag((byte) (FLAG_REQUEST | FLAG_TWOWAY | HESSIAN_SERIALIZATION_ID) ); // set body ByteArrayOutputStream bos = new ByteArrayOutputStream(); Hessian2Output h2out = hessianFactory.createHessian2Output(bos); String dubboVersion = dubboreq.getDubboVersion(); if( null == dubboVersion ) dubboVersion = DEFAULT_DUBBO_VERSION; h2out.writeString(dubboVersion); String service = dubboreq.getService(); h2out.writeString(service); String version = dubboreq.getVersion(); if( null == version ) version = DEFAULT_METHOD_VERSION; h2out.writeString(version); String method = dubboreq.getMethod(); h2out.writeString(method); Class<?>[] argtypes = CollectionUtil.objects2Classes( dubboreq.getArgs() ); String argsdesc = ReflectUtils.getDesc(argtypes); h2out.writeString(argsdesc); for( Object obj : dubboreq.getArgs() ){ h2out.writeObject(obj); } Map<String, String> attachments = dubboreq.getAttachments(); h2out.writeObject(attachments); h2out.close(); byte[] body = bos.toByteArray(); dd.setDubboHeader(dubboreq.getDubboHeader()); dd.setBody(body); log.debug("encodeDubboRequest dubboVersion:{} service:{} version:{} method:{} args.size:{} attachments:{}", dubboVersion, service, version, method, argtypes.length, YmlUtil.obj2Yml(attachments)); }