All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sfm.map.impl.JodaTimeClasses Maven / Gradle / Ivy

Go to download

Java library to map flat record - ResultSet, csv - to java object with minimum configuration and low footprint.

There is a newer version: 1.10.3
Show newest version
package org.sfm.map.impl;

public class JodaTimeClasses {

    private static final Class dateTimeClass;

    private static final Class localDateClass;

    private static final Class localDateTimeClass;

    private static final Class localTimeClass;

    static {
        Class clazz = null;
        try {
             clazz = Class.forName("org.joda.time.DateTime");
        } catch (ClassNotFoundException e) {
        }
        dateTimeClass = clazz;

        clazz = null;
        try {
            clazz = Class.forName("org.joda.time.LocalDate");
        } catch (ClassNotFoundException e) {
        }
        localDateClass = clazz;

        clazz = null;
        try {
            clazz = Class.forName("org.joda.time.LocalDateTime");
        } catch (ClassNotFoundException e) {
        }
        localDateTimeClass = clazz;

        clazz = null;
        try {
            clazz = Class.forName("org.joda.time.LocalTime");
        } catch (ClassNotFoundException e) {
        }
        localTimeClass = clazz;

    }

    public static boolean isJodaDateTime(Class target) {
        return dateTimeClass != null && dateTimeClass.equals(target);
    }
    public static boolean isJodaLocalDateTime(Class target) {
        return localDateTimeClass != null && localDateTimeClass.equals(target);
    }
    public static boolean isJodaLocalDate(Class target) {
        return localDateClass != null && localDateClass.equals(target);
    }
    public static boolean isJodaLocalTime(Class target) {
        return localTimeClass != null && localTimeClass.equals(target);
    }
 }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy