当前位置: 首页>>代码示例>>Java>>正文


Java XStreamAlias类代码示例

本文整理汇总了Java中com.liferay.exportimport.kernel.xstream.XStreamAlias的典型用法代码示例。如果您正苦于以下问题:Java XStreamAlias类的具体用法?Java XStreamAlias怎么用?Java XStreamAlias使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


XStreamAlias类属于com.liferay.exportimport.kernel.xstream包,在下文中一共展示了XStreamAlias类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initXStream

import com.liferay.exportimport.kernel.xstream.XStreamAlias; //导入依赖的package包/类
protected void initXStream() {

        _xStream = new XStream(null, new XppDriver(), new ClassLoaderReference(
                XStreamConfiguratorRegistryUtil.getConfiguratorsClassLoader(XStream.class.getClassLoader())));

        _xStream.omitField(HashMap.class, "cache_bitmask");

        Set<XStreamConfigurator> xStreamConfigurators = XStreamConfiguratorRegistryUtil.getXStreamConfigurators();

        if (SetUtil.isEmpty(xStreamConfigurators)) {
            return;
        }

        List<String> allowedTypeNames = new ArrayList<>();

        for (XStreamConfigurator xStreamConfigurator : xStreamConfigurators) {
            List<XStreamAlias> xStreamAliases = xStreamConfigurator.getXStreamAliases();

            if (ListUtil.isNotEmpty(xStreamAliases)) {
                for (XStreamAlias xStreamAlias : xStreamAliases) {
                    _xStream.alias(xStreamAlias.getName(), xStreamAlias.getClazz());
                }
            }

            List<XStreamConverter> xStreamConverters = xStreamConfigurator.getXStreamConverters();

            if (ListUtil.isNotEmpty(xStreamConverters)) {
                for (XStreamConverter xStreamConverter : xStreamConverters) {
                    _xStream.registerConverter(new ConverterAdapter(xStreamConverter), XStream.PRIORITY_VERY_HIGH);
                }
            }

            List<XStreamType> xStreamTypes = xStreamConfigurator.getAllowedXStreamTypes();

            if (ListUtil.isNotEmpty(xStreamTypes)) {
                for (XStreamType xStreamType : xStreamTypes) {
                    allowedTypeNames.add(xStreamType.getTypeExpression());
                }
            }
        }

        // For default permissions, first wipe than add default

        _xStream.addPermission(NoTypePermission.NONE);

        // Add permissions

        _xStream.addPermission(PrimitiveTypePermission.PRIMITIVES);
        _xStream.addPermission(XStreamStagedModelTypeHierarchyPermission.STAGED_MODELS);

        _xStream.allowTypes(_XSTREAM_DEFAULT_ALLOWED_TYPES);

        _xStream.allowTypeHierarchy(List.class);
        _xStream.allowTypeHierarchy(Map.class);
        _xStream.allowTypeHierarchy(Timestamp.class);
        _xStream.allowTypeHierarchy(Set.class);

        _xStream.allowTypes(allowedTypeNames.toArray(new String[0]));

        _xStream.allowTypesByWildcard(new String[] { "com.thoughtworks.xstream.mapper.DynamicProxyMapper*" });
    }
 
开发者ID:inofix,项目名称:ch-inofix-timetracker,代码行数:62,代码来源:BaseExportImportController.java

示例2: getXStreamAliases

import com.liferay.exportimport.kernel.xstream.XStreamAlias; //导入依赖的package包/类
@Override
public List<XStreamAlias> getXStreamAliases() {
    return ListUtil.toList(_xStreamAliases);
}
 
开发者ID:inofix,项目名称:ch-inofix-timetracker,代码行数:5,代码来源:TimetrackerXStreamConfigurator.java

示例3: activate

import com.liferay.exportimport.kernel.xstream.XStreamAlias; //导入依赖的package包/类
@Activate
protected void activate() {
    _xStreamAliases = new XStreamAlias[] { new XStreamAlias(TaskRecord.class, "TaskRecord") };
}
 
开发者ID:inofix,项目名称:ch-inofix-timetracker,代码行数:5,代码来源:TimetrackerXStreamConfigurator.java

示例4: activate

import com.liferay.exportimport.kernel.xstream.XStreamAlias; //导入依赖的package包/类
@Activate
protected void activate() {
    _xStreamAliases = new XStreamAlias[] { new XStreamAlias(Contact.class, "Contact") };
}
 
开发者ID:inofix,项目名称:ch-inofix-contact-manager,代码行数:5,代码来源:ContactManagerXStreamConfigurator.java


注:本文中的com.liferay.exportimport.kernel.xstream.XStreamAlias类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。