Java 类org.apache.commons.beanutils.converters.SqlTimeConverter 实例源码

项目:zswxsqxt    文件:ConvertRegisterHelper.java   
public static void registerConverters() {
    ConvertUtils.register(new StringConverter(), String.class);
    //date 
    ConvertUtils.register(new DateConverter(null),java.util.Date.class);
       ConvertUtils.register(new SqlDateConverter(null),java.sql.Date.class);
    ConvertUtils.register(new SqlTimeConverter(null),Time.class);
    ConvertUtils.register(new SqlTimestampConverter(null),Timestamp.class);
    //number
    ConvertUtils.register(new BooleanConverter(null), Boolean.class);
    ConvertUtils.register(new ShortConverter(null), Short.class);
    ConvertUtils.register(new IntegerConverter(null), Integer.class);
    ConvertUtils.register(new LongConverter(null), Long.class);
    ConvertUtils.register(new FloatConverter(null), Float.class);
    ConvertUtils.register(new DoubleConverter(null), Double.class);
    ConvertUtils.register(new BigDecimalConverter(null), BigDecimal.class); 
    ConvertUtils.register(new BigIntegerConverter(null), BigInteger.class); 
}
项目:zswxsqxt    文件:ConvertRegisterHelper.java   
public static void registerConverters(ConvertUtilsBean convertUtils,String[] datePatterns) {
    convertUtils.register(new StringConverter(), String.class);
    //date 
    convertUtils.register(ConvertRegisterHelper.setPatterns(new DateConverter(null),datePatterns),java.util.Date.class);
    convertUtils.register(ConvertRegisterHelper.setPatterns(new SqlDateConverter(null),datePatterns),java.sql.Date.class);
    convertUtils.register(ConvertRegisterHelper.setPatterns(new SqlTimeConverter(null),datePatterns),Time.class);
    convertUtils.register(ConvertRegisterHelper.setPatterns(new SqlTimestampConverter(null),datePatterns),Timestamp.class);
    //number
    convertUtils.register(new BooleanConverter(null), Boolean.class);
    convertUtils.register(new ShortConverter(null), Short.class);
    convertUtils.register(new IntegerConverter(null), Integer.class);
    convertUtils.register(new LongConverter(null), Long.class);
    convertUtils.register(new FloatConverter(null), Float.class);
    convertUtils.register(new DoubleConverter(null), Double.class);
    convertUtils.register(new BigDecimalConverter(null), BigDecimal.class); 
    convertUtils.register(new BigIntegerConverter(null), BigInteger.class); 
}
项目:NotifyTools    文件:ConvertUtilsBean.java   
/**
 * Register array converters.
 *
 * @param throwException <code>true</code> if the converters should
 * throw an exception when a conversion error occurs, otherwise <code>
 * <code>false</code> if a default value should be used.
 * @param defaultArraySize The size of the default array value for array converters
 * (N.B. This values is ignored if <code>throwException</code> is <code>true</code>).
 * Specifying a value less than zero causes a <code>null<code> value to be used for
 * the default.
 */
private void registerArrays(final boolean throwException, final int defaultArraySize) {

    // Primitives
    registerArrayConverter(Boolean.TYPE,   new BooleanConverter(),   throwException, defaultArraySize);
    registerArrayConverter(Byte.TYPE,      new ByteConverter(),      throwException, defaultArraySize);
    registerArrayConverter(Character.TYPE, new CharacterConverter(), throwException, defaultArraySize);
    registerArrayConverter(Double.TYPE,    new DoubleConverter(),    throwException, defaultArraySize);
    registerArrayConverter(Float.TYPE,     new FloatConverter(),     throwException, defaultArraySize);
    registerArrayConverter(Integer.TYPE,   new IntegerConverter(),   throwException, defaultArraySize);
    registerArrayConverter(Long.TYPE,      new LongConverter(),      throwException, defaultArraySize);
    registerArrayConverter(Short.TYPE,     new ShortConverter(),     throwException, defaultArraySize);

    // Standard
    registerArrayConverter(BigDecimal.class, new BigDecimalConverter(), throwException, defaultArraySize);
    registerArrayConverter(BigInteger.class, new BigIntegerConverter(), throwException, defaultArraySize);
    registerArrayConverter(Boolean.class,    new BooleanConverter(),    throwException, defaultArraySize);
    registerArrayConverter(Byte.class,       new ByteConverter(),       throwException, defaultArraySize);
    registerArrayConverter(Character.class,  new CharacterConverter(),  throwException, defaultArraySize);
    registerArrayConverter(Double.class,     new DoubleConverter(),     throwException, defaultArraySize);
    registerArrayConverter(Float.class,      new FloatConverter(),      throwException, defaultArraySize);
    registerArrayConverter(Integer.class,    new IntegerConverter(),    throwException, defaultArraySize);
    registerArrayConverter(Long.class,       new LongConverter(),       throwException, defaultArraySize);
    registerArrayConverter(Short.class,      new ShortConverter(),      throwException, defaultArraySize);
    registerArrayConverter(String.class,     new StringConverter(),     throwException, defaultArraySize);

    // Other
    registerArrayConverter(Class.class,          new ClassConverter(),        throwException, defaultArraySize);
    registerArrayConverter(java.util.Date.class, new DateConverter(),         throwException, defaultArraySize);
    registerArrayConverter(Calendar.class,       new DateConverter(),         throwException, defaultArraySize);
    registerArrayConverter(File.class,           new FileConverter(),         throwException, defaultArraySize);
    registerArrayConverter(java.sql.Date.class,  new SqlDateConverter(),      throwException, defaultArraySize);
    registerArrayConverter(java.sql.Time.class,  new SqlTimeConverter(),      throwException, defaultArraySize);
    registerArrayConverter(Timestamp.class,      new SqlTimestampConverter(), throwException, defaultArraySize);
    registerArrayConverter(URL.class,            new URLConverter(),          throwException, defaultArraySize);

}
项目:NotifyTools    文件:ConvertUtilsBean.java   
/**
 * Register the converters for other types.
 * </p>
 * This method registers the following converters:
 * <ul>
 *     <li><code>Class.class</code> - {@link ClassConverter}</li>
 *     <li><code>java.util.Date.class</code> - {@link DateConverter}</li>
 *     <li><code>java.util.Calendar.class</code> - {@link CalendarConverter}</li>
 *     <li><code>File.class</code> - {@link FileConverter}</li>
 *     <li><code>java.sql.Date.class</code> - {@link SqlDateConverter}</li>
 *     <li><code>java.sql.Time.class</code> - {@link SqlTimeConverter}</li>
 *     <li><code>java.sql.Timestamp.class</code> - {@link SqlTimestampConverter}</li>
 *     <li><code>URL.class</code> - {@link URLConverter}</li>
 * </ul>
 * @param throwException <code>true</code> if the converters should
 * throw an exception when a conversion error occurs, otherwise <code>
 * <code>false</code> if a default value should be used.
 */
private void registerOther(final boolean throwException) {
    register(Class.class,         throwException ? new ClassConverter()        : new ClassConverter(null));
    register(java.util.Date.class, throwException ? new DateConverter()        : new DateConverter(null));
    register(Calendar.class,      throwException ? new CalendarConverter()     : new CalendarConverter(null));
    register(File.class,          throwException ? new FileConverter()         : new FileConverter(null));
    register(java.sql.Date.class, throwException ? new SqlDateConverter()      : new SqlDateConverter(null));
    register(java.sql.Time.class, throwException ? new SqlTimeConverter()      : new SqlTimeConverter(null));
    register(Timestamp.class,     throwException ? new SqlTimestampConverter() : new SqlTimestampConverter(null));
    register(URL.class,           throwException ? new URLConverter()          : new URLConverter(null));
}