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


Java DateConverter类代码示例

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


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

示例1: dateConverterUsage

import com.thoughtworks.xstream.converters.basic.DateConverter; //导入依赖的package包/类
/**
 * 处理日期
 */
@Test
public void dateConverterUsage() {
    // 自定义convert
    xstream.registerConverter(new DateConverter());
    String xml = xstream.toXML(user);

    LoggerTool.info("date converter {}", xml);
}
 
开发者ID:sunlin901203,项目名称:example-java,代码行数:12,代码来源:XStreamExample.java

示例2: setupConverters

import com.thoughtworks.xstream.converters.basic.DateConverter; //导入依赖的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

示例3: initXStreamOptions

import com.thoughtworks.xstream.converters.basic.DateConverter; //导入依赖的package包/类
/**
 * Inits the X stream options.
 */
public void initXStreamOptions() {

    // xStream.alias("priority", QueueLogPriority.class);
    xStream.registerConverter(new DateConverter("yyyy-MM-dd HH:mm:ss.S", new String[] { "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss" }));
    xStream.useAttributeFor(Date.class);
    xStream.useAttributeFor(long.class);
    xStream.useAttributeFor(boolean.class);
    xStream.useAttributeFor(double.class);
    xStream.useAttributeFor(this.getClass(), "queueId");
    xStream.useAttributeFor(this.getClass(), "queueDesc");
    xStream.useAttributeFor(this.getClass(), "extractLocationData");
    xStream.useAttributeFor(this.getClass(), "downloadUrlPath");
    xStream.useAttributeFor(this.getClass(), "scriptVersion");

    // xStream.useAttributeFor("priority", int.class);
    // xStream.useAttributeFor("range", int.class);

    // xStream.useAttributeFor(QueueLogPriority.class, "priority");
    // xStream.useAttributeFor(QueueLogPriority.class, "range");

    xStream.useAttributeFor(ExtractionParameters.class, "userId");
    // xStream.useAttributeFor(ExtractionParameters.class, "user");
    // xStream.aliasAttribute("userId", "user");
    // xStream.registerConverter(new ExtractionParameters.UserBaseConverter());

    xStream.useAttributeFor(ExtractionParameters.class, "userHost");
    xStream.useAttributeFor(ExtractionParameters.class, "locationData");
    xStream.useAttributeFor(ExtractionParameters.class, "productId");
    xStream.useAttributeFor(ExtractionParameters.class, "serviceName");
    xStream.useAttributeFor(ExtractionParameters.class, "temporalCoverageInDays");

    xStream.omitField(ExtractionParameters.class, "dataOutputFormat");
    xStream.omitField(ExtractionParameters.class, "out");
    xStream.omitField(ExtractionParameters.class, "assertion");

    xStream.omitField(this.getClass(), "outputStream");
    xStream.omitField(this.getClass(), "writer");
    xStream.omitField(this.getClass(), "encoding");

    xStream.omitField(this.getClass(), "xStream");

}
 
开发者ID:clstoulouse,项目名称:motu,代码行数:46,代码来源:QueueLogInfo.java

示例4: getXStream

import com.thoughtworks.xstream.converters.basic.DateConverter; //导入依赖的package包/类
public static XStream getXStream() 
{
	XStream xstream = new XStream() {
        protected MapperWrapper wrapMapper(MapperWrapper next) {
            return new FieldUpperCaseMapper(next);
        }
	};

	// Add all the standard aliases
	xstream.alias("ImporterWorkItem", ImporterWorkItem.class);
	xstream.alias("ImporterWorkItemDetails", ImporterWorkItemDetails.class);
	xstream.alias("ImporterWorkItemDetailsReference", ImporterWorkItemDetailsReference.class);
	xstream.alias("ImporterWorkListFilter", ImporterWorkItemFilter.class);
	xstream.alias("Order", Order.class);
	xstream.alias("OrderingLocation", OrderingLocation.class);
	xstream.alias("ImagingLocation", ImagingLocation.class);
	xstream.alias("OrderingProvider", OrderingProvider.class);
	xstream.alias("Patient", Patient.class);
	xstream.alias("Procedure", Procedure.class);
	xstream.alias("ProcedureModifier", ProcedureModifier.class);
	xstream.alias("Reconciliation", Reconciliation.class);
	xstream.alias("Series", Series.class);
	xstream.alias("SopInstance", SopInstance.class);
	xstream.alias("Study", Study.class);
	xstream.alias("ReportParameters", ReportParameters.class);
	xstream.alias("Report", Report.class);
	xstream.alias("OriginIndex", OriginIndex.class);
	xstream.alias("UIDActionConfig", UIDActionConfig.class);
	xstream.alias("StandardReport", StandardReport.class);
	xstream.alias("DiagnosticCode", DiagnosticCode.class);
	xstream.alias("StatusChangeDetails", StatusChangeDetails.class);
	xstream.alias("SecondaryDiagnosticCode", SecondaryDiagnosticCode.class);
	xstream.alias("ApplicationTimeoutParameters", ApplicationTimeoutParameters.class);
	xstream.alias("NonDicomFile", NonDicomFile.class);
	xstream.alias("MediaCategory", MediaCategory.class);
	xstream.alias("MediaCategories", MediaCategories.class);
	
	String[] acceptableDateFormats = new String[]
	{
		"MM-dd-yyyy",
		"yyyyMMdd"
	};
	
	DateConverter dateConverter = new DateConverter("MM/dd/yyyy", acceptableDateFormats);
	xstream.registerConverter(dateConverter);
	return xstream;

}
 
开发者ID:VHAINNOVATIONS,项目名称:Telepathology,代码行数:49,代码来源:ImporterUtils.java


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