• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java BooleanConverter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: testYesNoValues

import com.thoughtworks.xstream.converters.basic.BooleanConverter; //导入依赖的package包/类
public void testYesNoValues() {
    List jazzIcons = new ArrayList();
    jazzIcons.add(new Musican("Miles Davis", "jazz", false));
    jazzIcons.add(new Musican("Wynton Marsalis", "jazz", true));

    xstream.alias("musician", Musican.class);
    xstream.registerConverter(BooleanConverter.YES_NO);

    String expectedXml =
            "<list>\n" +
            "  <musician>\n" +
            "    <name>Miles Davis</name>\n" +
            "    <genre>jazz</genre>\n" +
            "    <alive>no</alive>\n" +
            "  </musician>\n" +
            "  <musician>\n" +
            "    <name>Wynton Marsalis</name>\n" +
            "    <genre>jazz</genre>\n" +
            "    <alive>yes</alive>\n" +
            "  </musician>\n" +
            "</list>";

    assertBothWays(jazzIcons, expectedXml);
}
 
开发者ID:x-stream,项目名称:xstream,代码行数:25,代码来源:BooleanFieldsTest.java


示例2: testBinaryValues

import com.thoughtworks.xstream.converters.basic.BooleanConverter; //导入依赖的package包/类
public void testBinaryValues() {
    List jazzIcons = new ArrayList();
    jazzIcons.add(new Musican("Miles Davis", "jazz", false));
    jazzIcons.add(new Musican("Wynton Marsalis", "jazz", true));

    xstream.alias("musician", Musican.class);
    xstream.registerConverter(BooleanConverter.BINARY);

    String expectedXml =
            "<list>\n" +
            "  <musician>\n" +
            "    <name>Miles Davis</name>\n" +
            "    <genre>jazz</genre>\n" +
            "    <alive>0</alive>\n" +
            "  </musician>\n" +
            "  <musician>\n" +
            "    <name>Wynton Marsalis</name>\n" +
            "    <genre>jazz</genre>\n" +
            "    <alive>1</alive>\n" +
            "  </musician>\n" +
            "</list>";

    assertBothWays(jazzIcons, expectedXml);
}
 
开发者ID:x-stream,项目名称:xstream,代码行数:25,代码来源:BooleanFieldsTest.java


示例3: testCanBeAppliedToIndividualFields

import com.thoughtworks.xstream.converters.basic.BooleanConverter; //导入依赖的package包/类
public void testCanBeAppliedToIndividualFields() {
    MultiBoolean multiBool = new MultiBoolean(true, true, true);
    String xml = ""
        + "<mbool>\n"
        + "  <bool>true</bool>\n"
        + "  <speech>yes</speech>\n"
        + "  <bit>1</bit>\n"
        + "</mbool>";

    xstream.registerLocalConverter(MultiBoolean.class, "speech", BooleanConverter.YES_NO);
    xstream.registerLocalConverter(MultiBoolean.class, "bit", BooleanConverter.BINARY);
    assertBothWays(multiBool, xml);
}
 
开发者ID:x-stream,项目名称:xstream,代码行数:14,代码来源:LocalConverterTest.java


示例4: setupConverters

import com.thoughtworks.xstream.converters.basic.BooleanConverter; //导入依赖的package包/类
protected void setupConverters() {
    registerConverter(new ReflectionConverter(mapper, reflectionProvider), PRIORITY_VERY_LOW);

    registerConverter(new SerializableConverter(mapper, reflectionProvider, classLoaderReference), PRIORITY_LOW);
    registerConverter(new ExternalizableConverter(mapper, classLoaderReference), PRIORITY_LOW);

    registerConverter(new NullConverter(), PRIORITY_VERY_HIGH);
    registerConverter(new IntConverter(), PRIORITY_NORMAL);
    registerConverter(new FloatConverter(), PRIORITY_NORMAL);
    registerConverter(new DoubleConverter(), PRIORITY_NORMAL);
    registerConverter(new LongConverter(), PRIORITY_NORMAL);
    registerConverter(new ShortConverter(), PRIORITY_NORMAL);
    registerConverter((Converter)new CharConverter(), PRIORITY_NORMAL);
    registerConverter(new BooleanConverter(), PRIORITY_NORMAL);
    registerConverter(new ByteConverter(), PRIORITY_NORMAL);

    registerConverter(new StringConverter(), PRIORITY_NORMAL);
    registerConverter(new StringBufferConverter(), PRIORITY_NORMAL);
    registerConverter(new StringBuilderConverter(), PRIORITY_NORMAL);
    registerConverter(new ThrowableConverter(converterLookup), PRIORITY_NORMAL);
    registerConverter(new StackTraceElementConverter(), PRIORITY_NORMAL);
    registerConverter(new DateConverter(), PRIORITY_NORMAL);
    registerConverter(new GregorianCalendarConverter(), PRIORITY_NORMAL);
    registerConverter(new RegexPatternConverter(), PRIORITY_NORMAL);
    registerConverter(new CurrencyConverter(), PRIORITY_NORMAL);
    registerConverter(new CharsetConverter(), PRIORITY_NORMAL);
    registerConverter(new LocaleConverter(), PRIORITY_NORMAL);
    registerConverter(new BitSetConverter(), PRIORITY_NORMAL);
    registerConverter(new UUIDConverter(), PRIORITY_NORMAL);
    registerConverter(new URIConverter(), PRIORITY_NORMAL);
    registerConverter(new URLConverter(), PRIORITY_NORMAL);
    registerConverter(new BigIntegerConverter(), PRIORITY_NORMAL);
    registerConverter(new BigDecimalConverter(), PRIORITY_NORMAL);

    registerConverter(new ArrayConverter(mapper), PRIORITY_NORMAL);
    registerConverter(new CharArrayConverter(), PRIORITY_NORMAL);
    registerConverter(new CollectionConverter(mapper), PRIORITY_NORMAL);
    registerConverter(new MapConverter(mapper), PRIORITY_NORMAL);
    registerConverter(new TreeMapConverter(mapper), PRIORITY_NORMAL);
    registerConverter(new TreeSetConverter(mapper), PRIORITY_NORMAL);
    registerConverter(new SingletonCollectionConverter(mapper), PRIORITY_NORMAL);
    registerConverter(new SingletonMapConverter(mapper), PRIORITY_NORMAL);
    registerConverter(new PropertiesConverter(), PRIORITY_NORMAL);
    registerConverter((Converter)new EncodedByteArrayConverter(), PRIORITY_NORMAL);
    registerConverter(new EnumConverter(), PRIORITY_NORMAL);
    registerConverter(new EnumSetConverter(mapper), PRIORITY_NORMAL);
    registerConverter(new EnumMapConverter(mapper), PRIORITY_NORMAL);

    registerConverter(new FileConverter(), PRIORITY_NORMAL);
    if (JVM.isSQLAvailable()) {
        registerConverter(new SqlTimestampConverter(), PRIORITY_NORMAL);
        registerConverter(new SqlTimeConverter(), PRIORITY_NORMAL);
        registerConverter(new SqlDateConverter(), PRIORITY_NORMAL);
    }
    registerConverter(new DynamicProxyConverter(mapper, classLoaderReference), PRIORITY_NORMAL);
    registerConverter(new JavaClassConverter(classLoaderReference), PRIORITY_NORMAL);
    registerConverter(new JavaMethodConverter(classLoaderReference), PRIORITY_NORMAL);
    registerConverter(new JavaFieldConverter(classLoaderReference), PRIORITY_NORMAL);
    if (JVM.isAWTAvailable()) {
        registerConverter(new FontConverter(mapper), PRIORITY_NORMAL);
        registerConverter(new ColorConverter(), PRIORITY_NORMAL);
        registerConverter(new TextAttributeConverter(), PRIORITY_NORMAL);
    }
    if (JVM.isSwingAvailable()) {
        registerConverter(new LookAndFeelConverter(mapper, reflectionProvider), PRIORITY_NORMAL);
    }

    if (JVM.loadClassForName("javax.security.auth.Subject") != null) {
        registerConverterDynamically("com.thoughtworks.xstream.converters.extended.SubjectConverter",
            PRIORITY_NORMAL, new Class[]{Mapper.class}, new Object[]{mapper});
    }
    if (JVM.loadClassForName("javax.xml.datatype.Duration") != null) {
        registerConverterDynamically("com.thoughtworks.xstream.converters.extended.DurationConverter",
            PRIORITY_NORMAL, null, null);
    }

    registerConverter(new SelfStreamingInstanceChecker(converterLookup, this), PRIORITY_NORMAL);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:79,代码来源:XStream.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Sse类代码示例发布时间:2022-05-23
下一篇:
Java AddRequest类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap