// Path: main/java/com/viviframework/petapojo/handlers/converters/ConvertException.java
// public class ConvertException extends Exception {
// 
//     public ConvertException(String message) {
//         super(message);
//     }
// 
//     public ConvertException(String message, Throwable cause) {
//         super(message, cause);
//     }
// }
// 
// Path: main/java/com/viviframework/petapojo/handlers/converters/Converter.java
// public interface Converter<T> {
// 
//     T convert(Object val) throws ConvertException;
// }


import com.viviframework.petapojo.handlers.converters.ConvertException;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.joda.time.LocalDateTime;
import com.viviframework.petapojo.handlers.converters.Converter;
package com.viviframework.petapojo.handlers.converters.dates.joda;


/**
 * 时间类型转换器
 */
public class DateTimeConverter implements Converter<DateTime> {

    private final DateTimeZone timeZone;

    public DateTimeConverter(DateTimeZone timeZone) {
        this.timeZone = timeZone;
    }

    public DateTimeConverter() {
        this(DateTimeZone.getDefault());
    }

    public DateTime convert(Object val) throws ConvertException {

        if (val == null)
            return null;

// Path: main/java/com/viviframework/petapojo/handlers/converters/ConvertException.java
// public class ConvertException extends Exception {
// 
//     public ConvertException(String message) {
//         super(message);
//     }
// 
//     public ConvertException(String message, Throwable cause) {
//         super(message, cause);
//     }
// }
// 
// Path: main/java/com/viviframework/petapojo/handlers/converters/Converter.java
// public interface Converter<T> {
// 
//     T convert(Object val) throws ConvertException;
// }


// Path: main/java/com/viviframework/petapojo/handlers/converters/dates/joda/DateTimeConverter.java
import com.viviframework.petapojo.handlers.converters.ConvertException;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.joda.time.LocalDateTime;
import com.viviframework.petapojo.handlers.converters.Converter;

package com.viviframework.petapojo.handlers.converters.dates.joda;


/**
 * 时间类型转换器
 */
public class DateTimeConverter implements Converter<DateTime> {

    private final DateTimeZone timeZone;

    public DateTimeConverter(DateTimeZone timeZone) {
        this.timeZone = timeZone;
    }

    public DateTimeConverter() {
        this(DateTimeZone.getDefault());
    }

    public DateTime convert(Object val) throws ConvertException {

        if (val == null)
            return null;

        try {