@JacksonXmlRootElement(localName = "Error") public class S3Error { private String mCode;
@Override public PropertyName findRootName(AnnotatedClass ac) { JacksonXmlRootElement root = ac.getAnnotation(JacksonXmlRootElement.class); if (root != null) { String local = root.localName(); String ns = root.namespace(); if (local.length() == 0 && ns.length() == 0) { return PropertyName.USE_DEFAULT; } return new PropertyName(local, ns); } return super.findRootName(ac); }
private String getName( Class<?> klass ) { if ( AnnotationUtils.isAnnotationPresent( klass, JacksonXmlRootElement.class ) ) { JacksonXmlRootElement rootElement = AnnotationUtils.getAnnotation( klass, JacksonXmlRootElement.class ); if ( !StringUtils.isEmpty( rootElement.localName() ) ) { return rootElement.localName(); } } return CaseFormat.UPPER_CAMEL.to( CaseFormat.LOWER_CAMEL, klass.getSimpleName() ); }
@Override public PropertyName findRootName(AnnotatedClass ac) { JacksonXmlRootElement root = ac.getAnnotation(JacksonXmlRootElement.class); if (root != null) { String local = root.localName(); String ns = root.namespace(); if (local.length() == 0 && ns.length() == 0) { return PropertyName.USE_DEFAULT; } return new PropertyName(local, ns); } return super.findRootName(ac); }
@JacksonXmlRootElement(localName = "InitiateMultipartUploadResult") @JsonPropertyOrder({ "Bucket", "Key", "UploadId" }) public class InitiateMultipartUploadResult {
@JacksonXmlRootElement(localName = "CompleteMultipartUploadResult") @JsonPropertyOrder({ "Location", "Bucket", "Key", "ETag" }) public class CompleteMultipartUploadResult {
@JacksonXmlRootElement(localName = "ListPartsResult") @JsonPropertyOrder({ "Bucket", "Key", "UploadId", "StorageClass", "IsTruncated", "Part" }) public class ListPartsResult {
@JacksonXmlRootElement(localName = "ListBucketResult") @JsonPropertyOrder({ "Name", "Prefix", "ContinuationToken", "NextContinuationToken", "KeyCount", "MaxKeys", "IsTruncated", "Contents" })
@JacksonXmlRootElement public class Config { // key为handler id private Map<String, Class<Handler>> handlerClassMap = new HashMap<>(); public void mergeFrom(Config otherConfig) { handlerClassMap.putAll(otherConfig.handlerClassMap); } public Map<String, Class<Handler>> getHandlerClassMap() { return this.handlerClassMap; } @JacksonXmlProperty(localName = "handler") @JacksonXmlElementWrapper(useWrapping = false) public void setHandlerConfigList(List<HandlerConfig> handlerConfigList) { for (HandlerConfig handlerConfig : handlerConfigList) { handlerClassMap.put(handlerConfig.getHandlerId(), handlerConfig.getClazz()); } } }
/** * Created by exizhai on 9/29/2015. */ @JacksonXmlRootElement(localName = "xml") public class QyTextRequest extends TextRequest { @JsonProperty("AgentID") private int agentId; public int getAgentId() { return agentId; } public void setAgentId(int agentId) { this.agentId = agentId; } }
/** * Created by exizhai on 9/29/2015. */ @JacksonXmlRootElement(localName = "xml") public class QyVoiceRequest extends VoiceRequest { @JsonProperty("AgentID") private int agentId; public int getAgentId() { return agentId; } public void setAgentId(int agentId) { this.agentId = agentId; } }
/** * Created by exizhai on 9/29/2015. */ @JacksonXmlRootElement(localName = "xml") public class QyLocationRequest extends LocationRequest { @JsonProperty("AgentID") private int agentId; public int getAgentId() { return agentId; } public void setAgentId(int agentId) { this.agentId = agentId; } }
/** * Created by exizhai on 9/29/2015. */ @JacksonXmlRootElement(localName = "xml") public class QyShortVideoRequest extends ShortVideoRequest { @JsonProperty("AgentID") private int agentId; public int getAgentId() { return agentId; } public void setAgentId(int agentId) { this.agentId = agentId; } }
/** * Created by exizhai on 9/29/2015. */ @JacksonXmlRootElement(localName = "xml") public class QyVideoRequest extends VideoRequest { @JsonProperty("AgentID") private int agentId; public int getAgentId() { return agentId; } public void setAgentId(int agentId) { this.agentId = agentId; } }
/** * Created by exizhai on 9/29/2015. */ @JacksonXmlRootElement(localName = "xml") public class QyImageRequest extends ImageRequest { @JsonProperty("AgentID") private int agentId; public int getAgentId() { return agentId; } public void setAgentId(int agentId) { this.agentId = agentId; } }
/** * Created by exizhai on 9/26/2015. */ @JacksonXmlRootElement(localName = "xml") public class ImageXmlMessage extends XmlMessageHeader { @JsonProperty("Image") private Media media; public ImageXmlMessage() { this.msgType = MsgType.image; this.setCreateTime(new Date()); } public Media getMedia() { return media; } public void setMedia(Media media) { this.media = media; } public ImageXmlMessage image(String mediaId) { this.media = new Media(mediaId); return this; } }
/** * Created by exizhai on 9/26/2015. */ @JacksonXmlRootElement(localName = "xml") public class VoiceXmlMessage extends XmlMessageHeader { @JsonProperty("Voice") private Media media; public VoiceXmlMessage() { this.msgType = MsgType.voice; this.setCreateTime(new Date()); } public Media getMedia() { return media; } public void setMedia(Media media) { this.media = media; } public VoiceXmlMessage voice(String mediaId) { this.media = new Media(mediaId); return this; } }
/** * Created by exizhai on 11/14/2015. */ @JacksonXmlRootElement(localName = "xml") public class MusicXmlMessage extends XmlMessageHeader { @JsonProperty("Music") private Music music; public MusicXmlMessage() { this.msgType = MsgType.music; this.setCreateTime(new Date()); } public Music getMusic() { return music; } public void setMusic(Music music) { this.music = music; } public MusicXmlMessage music(Music music) { this.music = music; return this; } }
/** * Created by exizhai on 9/26/2015. */ @JacksonXmlRootElement(localName = "xml") public class VideoXmlMessage extends XmlMessageHeader { @JsonProperty("Video") private Video video; public VideoXmlMessage() { this.msgType = MsgType.video; this.setCreateTime(new Date()); } public Video getVideo() { return video; } public void setVideo(Video video) { this.video = video; } public VideoXmlMessage video(Video video) { this.video = video; return this; } }
/** * Created by exizhai on 9/26/2015. */ @JacksonXmlRootElement(localName = "xml") public class NewsXmlMessage extends XmlMessageHeader { @JsonProperty("ArticleCount") private int articleCount; @JsonProperty("Articles") private News news; public NewsXmlMessage() { this.msgType = MsgType.news; this.setCreateTime(new Date()); } public News getNews() { return news; } public void setNews(News news) { this.news = news; } public int getArticleCount() { return news.getArticles().size(); } }