对于java.lang.Object/java.util.Date对象, hessian序列化的时候写入类型是object/date,此处进行解析

@param type 类名称
@return 转换结果
428663
public static String decodeObjectAndDate(String type) {
        return type.replace("object", Object.class.getName()).replace("date", Date.class.getName());
    }
1112060
@Override  // override with covariant return type
    public HijrahDate date(TemporalAccessor temporal) {
        if (temporal instanceof HijrahDate) {
            return (HijrahDate) temporal;
        }
        return HijrahDate.ofEpochDay(temporal.getLong(EPOCH_DAY));
    }
891017
function(type, args, obj) {
        var val = args[0];
        if (Lang.isString(val)) {
            val = this._parseDate(val);
            this.cfg.setProperty(DEF_CFG.MINDATE.key, DateMath.getDate(val[0],(val[1]-1),val[2]));
        }
    }
266608
protected Date massageDate (Object arg)
    {
        if (arg instanceof Long) {
            return new Date(((Long)arg).longValue());
        } else if (arg instanceof Date) {
            return (Date)arg;
        } else if (arg instanceof Calendar) {
            return ((Calendar)arg).getTime();
        } else {
            System.err.println("Date provided with invalid argument " +
                               "[arg=" + arg + ", aclass=" +
                               StringUtil.shortClassName(arg) + "].");
            return null;
        }
    }
266648
public void setObject(Class<?> type, Object value) {
		if (type.equals(String.class)) {
			this.setString((String) value);
		}
		else if (type.equals(Integer.class) || type.equals(int.class)) {
			this.setInt((Integer) value);
		}
		else if (type.equals(Long.class) || type.equals(long.class)) {
			this.setLong((Long) value);
		}
		else if (type.equals(Float.class) || type.equals(float.class)) {
			this.setFloat((Float) value);
		}
		else if (type.equals(Double.class) || type.equals(double.class)) {
			this.setDouble((Double) value);
		}
		else if (type.equals(Boolean.class) || type.equals(boolean.class)) {
			if (value instanceof Integer) {
				int num = (Integer) value;
				this.setBool(num == 1);
			}
			else {
				this.setBool((Boolean) value);
			}
		}
		// else if (type.equals(Month.class)) {
		// if (value instanceof String) {
		// String month = (String) value;
		// this.setMonth(new Month(month));
		// }
		// else {
		// this.setMonth((Month) value);
		// }
		// }
		else if (type.equals(Date.class)) {
			this.setDate((Date) value);
		}
		// else if (type.equals(OnlyDate.class)) {
		// if (value instanceof java.sql.Date) {
		// java.sql.Date date = (java.sql.Date) value;
		// this.setOnlyDate(new OnlyDate(date.getTime()));
		// }
		// else {
		// this.setOnlyDate((OnlyDate) value);
		// }
		// }
		else {
			throw new IllegalArgumentException("未知类型[" + type + "].");
		}
	}
135721
public static boolean mightContainsProperties(Class<?> type) {
    return type != Object.class
        && type != String.class
        && type != Date.class
        && type != Calendar.class
        && !Primitives.isPrimitive(type)
        && !Iterables.isIterable(type)
        && !Types.isGroovyType(type);
  }
643750
public static <D extends Comparable> DateExpression<D> date(Class<D> type, DateTimeExpression<?> dateTime) {
        return Expressions.dateOperation(type, Ops.DateTimeOps.DATE, dateTime);
    }
330955
@Override  // for covariant return type
    @SuppressWarnings("unchecked")
    public ChronoLocalDateTime<JulianDate> atTime(LocalTime localTime) {
        return (ChronoLocalDateTime<JulianDate>) super.atTime(localTime);
    }
302767
public static Object converValue(String type, String value){
		if(type.equals("java.lang.String")){
			return value;
		} else if(type.equals("int") || type.equals("java.lang.Integer")){
			return (int)Integer.parseInt(value);
		} else if(type.equals("boolean") || type.equals("java.lang.Boolean")){
			return (boolean)Boolean.parseBoolean(value);
		} else if(type.equals("float") || type.equals("java.lang.Double")){
			return (float)Float.parseFloat(value);
		} else if(type.equals("double") || type.equals("java.lang.Double")){
			return (double)Double.parseDouble(value);
		} else if(type.equals("short") || type.equals("java.lang.Short")){
			return (short)Short.parseShort(value);
		} else if(type.equals("char") || type.equals("java.lang.Character")){
			if(value.length()>0){
				return value.charAt(0);
			}else{
				return null;
			}
		} else if(type.equals("long") || type.equals("java.lang.Long")){
			return (long)Long.parseLong(value);
		} else if(type.equals("byte") || type.equals("java.lang.Byte")){
			return (byte)Byte.parseByte(value);
		} else if (type.equals("java.util.Date")){
			SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
			if (value.contains("/")){
				String items[] = value.split("/");
				dateFormat = new SimpleDateFormat(items[0]);
				value = items[1];
			}
			try {
				return dateFormat.parseObject(value);
			} catch (ParseException e) {
				logger.error(String.format("Parse Date Exception: exception=%s", e.getMessage()));
				return null;
			}
		} else if (type.equals("java.math.BigDecimal")){
			return new BigDecimal(value);
		} else if (type.equals("java.math.BigInteger")){
			return new BigInteger(value);
		} else{
			return null;
		}
	}
1372283
public static long getTimeSpan(Date begin, Date end, int type) {
        long diff = end.getTime() - begin.getTime();
        switch (type) {
            case DAY:
            default:
                return diff / org.apache.commons.lang.time.DateUtils.MILLIS_PER_DAY;
            case HOUR:
                return diff / org.apache.commons.lang.time.DateUtils.MILLIS_PER_HOUR;
            case MINUTE:
                return diff / org.apache.commons.lang.time.DateUtils.MILLIS_PER_MINUTE;
            case SECOND:
                return diff / org.apache.commons.lang.time.DateUtils.MILLIS_PER_SECOND;
        }
    }
778371
public Date getLastIndexed(FeatureIndexType type) {
		Date lastIndexed = null;
		if (type == null) {
			lastIndexed = getLastIndexed();
		} else {
			switch (type) {
			case GEOPACKAGE:
				lastIndexed = featureTableIndex.getLastIndexed();
				break;
			case RTREE:
				if (rTreeIndexTableDao.has()) {
					// Updated by triggers, assume up to date
					lastIndexed = new Date();
				}
				break;
			default:
				throw new GeoPackageException("Unsupported FeatureIndexType: "
						+ type);
			}
		}
		return lastIndexed;
	}
405853
public static Date date(String date) {
		Date result = null;
		try {
			result = getDateFormater(DATE_FORMAT, null).parse(date);
		}
		catch (ParseException pex) {
			LOG.warn("Date not constructable {}", pex, date);
		}
		return result;
	}
956334
@SuppressWarnings({ "unchecked", "rawtypes" })
    public static Object convert(Object value, Class<?> type) {
        if (value == null || type == null || type.isAssignableFrom(value.getClass())) {
            return value;
        }
        if (value instanceof String) {
            String string = (String) value;
            if (char.class.equals(type) || Character.class.equals(type)) {
                if (string.length() != 1) {
                    throw new IllegalArgumentException(String.format("can not convert String(%s) to char!" +
                        " when convert String to char, the String must only 1 char.", string));
                }
                return string.charAt(0);
            } else if (type.isEnum()) {
                return Enum.valueOf((Class<Enum>) type, string);
            } else if (type == BigInteger.class) {
                return new BigInteger(string);
            } else if (type == BigDecimal.class) {
                return new BigDecimal(string);
            } else if (type == Short.class || type == short.class) {
                return Short.valueOf(string);
            } else if (type == Integer.class || type == int.class) {
                return Integer.valueOf(string);
            } else if (type == Long.class || type == long.class) {
                return Long.valueOf(string);
            } else if (type == Double.class || type == double.class) {
                return new Double(string);
            } else if (type == Float.class || type == float.class) {
                return new Float(string);
            } else if (type == Byte.class || type == byte.class) {
                return Byte.valueOf(string);
            } else if (type == Boolean.class || type == boolean.class) {
                return Boolean.valueOf(string);
            } else if (type == Date.class || type == java.sql.Date.class || type == java.sql.Time.class ||
                type == java.sql.Timestamp.class) {
                try {
                    if (type == Date.class) {
                        return DateUtils.strToDate(string, DateUtils.DATE_FORMAT_TIME);
                    } else if (type == java.sql.Date.class) {
                        return new java.sql.Date(DateUtils.strToLong(string));
                    } else if (type == java.sql.Timestamp.class) {
                        return new java.sql.Timestamp(DateUtils.strToLong(string));
                    } else {
                        return new java.sql.Time(DateUtils.strToLong(string));
                    }
                } catch (ParseException e) {
                    throw new IllegalStateException("Failed to parse date " + value + " by format " +
                        DateUtils.DATE_FORMAT_TIME + ", cause: " + e.getMessage(), e);
                }
            } else if (type == Class.class) {
                return ClassTypeUtils.getClass((String) value);
            }
        } else if (value instanceof Number) {
            Number number = (Number) value;
            if (type == byte.class || type == Byte.class) {
                return number.byteValue();
            } else if (type == short.class || type == Short.class) {
                return number.shortValue();
            } else if (type == int.class || type == Integer.class) {
                return number.intValue();
            } else if (type == long.class || type == Long.class) {
                return number.longValue();
            } else if (type == float.class || type == Float.class) {
                return number.floatValue();
            } else if (type == double.class || type == Double.class) {
                return number.doubleValue();
            } else if (type == BigInteger.class) {
                return BigInteger.valueOf(number.longValue());
            } else if (type == BigDecimal.class) {
                return BigDecimal.valueOf(number.doubleValue());
            } else if (type == Date.class) {
                return new Date(number.longValue());
            } else if (type == java.sql.Date.class) {
                return new java.sql.Date(number.longValue());
            } else if (type == java.sql.Time.class) {
                return new java.sql.Time(number.longValue());
            } else if (type == java.sql.Timestamp.class) {
                return new java.sql.Timestamp(number.longValue());
            }
        } else if (value instanceof Collection) {
            Collection collection = (Collection) value;
            if (type.isArray()) {
                int length = collection.size();
                Object array = Array.newInstance(type.getComponentType(), length);
                int i = 0;
                for (Object item : collection) {
                    Array.set(array, i++, item);
                }
                return array;
            } else if (!type.isInterface()) {
                try {
                    Collection result = (Collection) type.newInstance();
                    result.addAll(collection);
                    return result;
                } catch (Throwable ignore) { // NOPMD
                }
            } else if (type == List.class) {
                return new ArrayList<Object>(collection);
            } else if (type == Set.class) {
                return new HashSet<Object>(collection);
            }
        } else if (value.getClass().isArray() && Collection.class.isAssignableFrom(type)) {
            Collection collection;
            if (!type.isInterface()) {
                try {
                    collection = (Collection) type.newInstance();
                } catch (Throwable e) {
                    collection = new ArrayList<Object>();
                }
            } else if (type == Set.class) {
                collection = new HashSet<Object>();
            } else {
                collection = new ArrayList<Object>();
            }
            int length = Array.getLength(value);
            for (int i = 0; i < length; i++) {
                collection.add(Array.get(value, i));
            }
            return collection;
        }
        return value;
    }
93327
def _get_date_type(date):
        
        if isinstance(date, str):
            return 'str'

        if isinstance(date, datetime.date):
            return 'date'

        if isinstance(date, int):
            return 'int'

        raise ValueError('Unexpected type {0!s}'.format(date.__class__))
82348
public Date getDate(final Date min, final Date max) {
		return getDate(min.getTime(), max.getTime());
	}
83708
public static Date fromJavaUtilDate(java.util.Date date) {
    Calendar cal = Calendar.getInstance();
    cal.setTime(date);
    cal.set(Calendar.HOUR_OF_DAY, 0);
    cal.set(Calendar.MINUTE, 0);
    cal.set(Calendar.SECOND, 0);
    cal.set(Calendar.MILLISECOND, 0);
    // Calender.MONTH starts from 0 while G C date starts from 1
    return new Date(
        cal.get(Calendar.YEAR), cal.get(Calendar.MONTH) + 1, cal.get(Calendar.DAY_OF_MONTH));
  }
989390
public static Function<Object,Date> date(final String methodName, final Object... optionalParameters) {
        return methodForDate(methodName, optionalParameters);
    }