com.qcloud.cos.internal.converter.CIConverter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cos_api-bundle Show documentation
Show all versions of cos_api-bundle Show documentation
A single bundled dependency that includes all service and dependent JARs with third-party libraries
relocated to different namespaces.
package com.qcloud.cos.internal.converter;
import com.qcloud.cos.internal.CIServiceRequest;
import com.thoughtworks.xstream.converters.Converter;
import com.thoughtworks.xstream.converters.MarshallingContext;
import com.thoughtworks.xstream.converters.UnmarshallingContext;
import com.thoughtworks.xstream.io.HierarchicalStreamReader;
import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
// 自定义转换器来处理null值字段
public class CIConverter implements Converter {
@Override
public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) {
// 在此处检查字段是否为null,根据需要决定是否写入到XML中
if (source instanceof CIServiceRequest) {
}
}
@Override
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
return null;
}
@Override
public boolean canConvert(Class type) {
// 此处返回true,以便将该转换器应用于所有类型的对象
return true;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy