com.thoughtworks.xstream.XStream.processAnnotations()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(203)

本文整理了Java中com.thoughtworks.xstream.XStream.processAnnotations()方法的一些代码示例,展示了XStream.processAnnotations()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XStream.processAnnotations()方法的具体详情如下:
包路径:com.thoughtworks.xstream.XStream
类名称:XStream
方法名:processAnnotations

XStream.processAnnotations介绍

[英]Process the annotations of the given type and configure the XStream. A call of this method will automatically turn the auto-detection mode for annotations off.
[中]处理给定类型的注释并配置XStream。调用此方法将自动关闭注释的自动检测模式。

代码示例

代码示例来源:origin: com.thoughtworks.xstream/xstream

/**
 * Process the annotations of the given type and configure the XStream. A call of this
 * method will automatically turn the auto-detection mode for annotations off.
 * 
 * @param type the type with XStream annotations
 * @since 1.3
 */
public void processAnnotations(final Class type) {
  processAnnotations(new Class[]{type});
}

代码示例来源:origin: chanjarster/weixin-java-tools

private static XStream config_WxCpXmlMessage() {
 XStream xstream = XStreamInitializer.getInstance();
 xstream.processAnnotations(WxCpXmlMessage.class);
 xstream.processAnnotations(WxCpXmlMessage.ScanCodeInfo.class);
 xstream.processAnnotations(WxCpXmlMessage.SendPicsInfo.class);
 xstream.processAnnotations(WxCpXmlMessage.SendPicsInfo.Item.class);
 xstream.processAnnotations(WxCpXmlMessage.SendLocationInfo.class);
 return xstream;
}

代码示例来源:origin: chanjarster/weixin-java-tools

private static XStream config_WxMpXmlOutNewsMessage() {
 XStream xstream = XStreamInitializer.getInstance();
 xstream.processAnnotations(WxMpXmlOutMessage.class);
 xstream.processAnnotations(WxMpXmlOutNewsMessage.class);
 xstream.processAnnotations(WxMpXmlOutNewsMessage.Item.class);
 return xstream;
}

代码示例来源:origin: chanjarster/weixin-java-tools

private static XStream config_WxMpXmlOutVideoMessage() {
 XStream xstream = XStreamInitializer.getInstance();
 xstream.processAnnotations(WxMpXmlOutMessage.class);
 xstream.processAnnotations(WxMpXmlOutVideoMessage.class);
 xstream.processAnnotations(WxMpXmlOutVideoMessage.Video.class);
 return xstream;
}

代码示例来源:origin: chanjarster/weixin-java-tools

private static XStream config_WxCpXmlOutNewsMessage() {
 XStream xstream = XStreamInitializer.getInstance();
 xstream.processAnnotations(WxCpXmlOutMessage.class);
 xstream.processAnnotations(WxCpXmlOutNewsMessage.class);
 xstream.processAnnotations(WxCpXmlOutNewsMessage.Item.class);
 return xstream;
}

代码示例来源:origin: chanjarster/weixin-java-tools

private static XStream config_WxMpXmlOutMusicMessage() {
 XStream xstream = XStreamInitializer.getInstance();
 xstream.processAnnotations(WxMpXmlOutMessage.class);
 xstream.processAnnotations(WxMpXmlOutMusicMessage.class);
 xstream.processAnnotations(WxMpXmlOutMusicMessage.Music.class);
 return xstream;
}

代码示例来源:origin: chanjarster/weixin-java-tools

private static XStream config_WxCpXmlOutVideoMessage() {
 XStream xstream = XStreamInitializer.getInstance();
 xstream.processAnnotations(WxCpXmlOutMessage.class);
 xstream.processAnnotations(WxCpXmlOutVideoMessage.class);
 xstream.processAnnotations(WxCpXmlOutVideoMessage.Video.class);
 return xstream;
}

代码示例来源:origin: chanjarster/weixin-java-tools

private static XStream config_WxMpXmlOutTransferCustomerServiceMessage() {
 XStream xstream = XStreamInitializer.getInstance();
 xstream.processAnnotations(WxMpXmlOutMessage.class);
 xstream.processAnnotations(WxMpXmlOutTransferCustomerServiceMessage.class);
 xstream.processAnnotations(WxMpXmlOutTransferCustomerServiceMessage.TransInfo.class);
 return xstream;
}

代码示例来源:origin: chanjarster/weixin-java-tools

private static XStream config_WxMpXmlMessage() {
 XStream xstream = XStreamInitializer.getInstance();
 xstream.processAnnotations(WxMpXmlMessage.class);
 xstream.processAnnotations(WxMpXmlMessage.ScanCodeInfo.class);
 xstream.processAnnotations(WxMpXmlMessage.SendPicsInfo.class);
 xstream.processAnnotations(WxMpXmlMessage.SendPicsInfo.Item.class);
 xstream.processAnnotations(WxMpXmlMessage.SendLocationInfo.class);
 xstream.aliasField("MsgID", WxMpXmlMessage.class, "msgId");
 return xstream;
}

代码示例来源:origin: chanjarster/weixin-java-tools

private static XStream config_WxMpXmlOutImageMessage() {
 XStream xstream = XStreamInitializer.getInstance();
 xstream.processAnnotations(WxMpXmlOutMessage.class);
 xstream.processAnnotations(WxMpXmlOutImageMessage.class);
 return xstream;
}

代码示例来源:origin: chanjarster/weixin-java-tools

private static XStream config_WxCpXmlOutImageMessage() {
 XStream xstream = XStreamInitializer.getInstance();
 xstream.processAnnotations(WxCpXmlOutMessage.class);
 xstream.processAnnotations(WxCpXmlOutImageMessage.class);
 return xstream;
}

代码示例来源:origin: chanjarster/weixin-java-tools

private static XStream config_WxCpXmlOutTextMessage() {
 XStream xstream = XStreamInitializer.getInstance();
 xstream.processAnnotations(WxCpXmlOutMessage.class);
 xstream.processAnnotations(WxCpXmlOutTextMessage.class);
 return xstream;
}

代码示例来源:origin: chanjarster/weixin-java-tools

private static XStream config_WxCpXmlOutVoiceMessage() {
 XStream xstream = XStreamInitializer.getInstance();
 xstream.processAnnotations(WxCpXmlOutMessage.class);
 xstream.processAnnotations(WxCpXmlOutVoiceMessage.class);
 return xstream;
}

代码示例来源:origin: chanjarster/weixin-java-tools

private static XStream config_WxMpXmlOutTextMessage() {
 XStream xstream = XStreamInitializer.getInstance();
 xstream.processAnnotations(WxMpXmlOutMessage.class);
 xstream.processAnnotations(WxMpXmlOutTextMessage.class);
 return xstream;
}

代码示例来源:origin: chanjarster/weixin-java-tools

private static XStream config_WxMpXmlOutVoiceMessage() {
 XStream xstream = XStreamInitializer.getInstance();
 xstream.processAnnotations(WxMpXmlOutMessage.class);
 xstream.processAnnotations(WxMpXmlOutVoiceMessage.class);
 return xstream;
}

代码示例来源:origin: kiegroup/optaplanner

/**
 * @param xStreamAnnotations never null
 * @see XStream#processAnnotations(Class[])
 */
public void addXStreamAnnotations(Class<?>... xStreamAnnotations) {
  xStream.processAnnotations(xStreamAnnotations);
  xStream.allowTypes(xStreamAnnotations);
}

代码示例来源:origin: kiegroup/optaplanner

/**
 * @param xStreamAnnotations never null
 * @see XStream#processAnnotations(Class[])
 */
public void addXStreamAnnotations(Class... xStreamAnnotations) {
  xStream.processAnnotations(xStreamAnnotations);
  xStream.allowTypes(xStreamAnnotations);
}

代码示例来源:origin: kiegroup/optaplanner

public XStreamSolutionFileIO(Class... xStreamAnnotatedClasses) {
  xStream = new XStream();
  xStream.setMode(XStream.ID_REFERENCES);
  xStream.processAnnotations(xStreamAnnotatedClasses);
  XStream.setupDefaultSecurity(xStream);
  // Presume the XML file comes from a trusted source so it works out of the box. See class javadoc.
  xStream.addPermission(new AnyTypePermission());
}

代码示例来源:origin: kiegroup/optaplanner

public BenchmarkResultIO() {
  xStream = XStreamXmlSolverFactory.buildXStream();
  xStream.processAnnotations(PlannerBenchmarkResult.class);
  xStream.allowTypesByRegExp(new String[]{"org\\.optaplanner\\.\\w+\\.api\\..*"});
  xStream.allowTypesByRegExp(new String[]{"org\\.optaplanner\\.\\w+\\.impl\\..*"});
  AbstractScoreXStreamConverter.registerScoreConverters(xStream);
}

代码示例来源:origin: kiegroup/optaplanner

public static <T> T serializeAndDeserializeWithXStream(T input) {
  XStream xStream = new XStream();
  xStream.setMode(XStream.ID_REFERENCES);
  if (input != null) {
    xStream.processAnnotations(input.getClass());
  }
  XStream.setupDefaultSecurity(xStream);
  xStream.addPermission(new AnyTypePermission());
  String xmlString = xStream.toXML(input);
  return (T) xStream.fromXML(xmlString);
}

相关文章