Java 类org.hibernate.type.ByteType 实例源码

项目:unitimes    文件:SessionRestore.java   
protected Object get(Class clazz, String id) {
    if (clazz.equals(String.class) || clazz.equals(StringType.class)) return id;
    if (clazz.equals(Character.class) || clazz.equals(CharacterType.class)) return (id == null || id.isEmpty() ? null : id.charAt(0));
    if (clazz.equals(Byte.class) || clazz.equals(ByteType.class)) return Byte.valueOf(id);
    if (clazz.equals(Short.class) || clazz.equals(ShortType.class)) return Short.valueOf(id);
    if (clazz.equals(Integer.class) || clazz.equals(IntegerType.class)) return Integer.valueOf(id);
    if (clazz.equals(Long.class) || clazz.equals(LongType.class)) return Long.valueOf(id);
    if (clazz.equals(Float.class) || clazz.equals(FloatType.class)) return Float.valueOf(id);
    if (clazz.equals(Double.class) || clazz.equals(DoubleType.class)) return Double.valueOf(id);
    if (clazz.equals(Boolean.class) || clazz.equals(BooleanType.class)) return Boolean.valueOf(id);

    Map<String, Entity> entities = iEntities.get(clazz.getName());
    if (entities != null) {
        Entity entity = entities.get(id);
        if (entity != null) return entity.getObject();
    }
       for (Map.Entry<String, Map<String, Entity>> entry: iEntities.entrySet()) {
        Entity o = entry.getValue().get(id);
        if (o != null && clazz.isInstance(o.getObject())) return o.getObject();
    }
       if (clazz.equals(Session.class))
        return ((Entity)iEntities.get(Session.class.getName()).values().iterator().next()).getObject();
       if (clazz.equals(Student.class))
        return checkUnknown(clazz, id, iStudents.get(id));
       if (iIsClone)
        return checkUnknown(clazz, id,
                iHibSession.get(clazz, clazz.equals(ItypeDesc.class) ? (Serializable) Integer.valueOf(id) : (Serializable) Long.valueOf(id)));
       return checkUnknown(clazz, id, null);
}
项目:unitime    文件:SessionRestore.java   
protected Object get(Class clazz, String id) {
    if (clazz.equals(String.class) || clazz.equals(StringType.class)) return id;
    if (clazz.equals(Character.class) || clazz.equals(CharacterType.class)) return (id == null || id.isEmpty() ? null : id.charAt(0));
    if (clazz.equals(Byte.class) || clazz.equals(ByteType.class)) return Byte.valueOf(id);
    if (clazz.equals(Short.class) || clazz.equals(ShortType.class)) return Short.valueOf(id);
    if (clazz.equals(Integer.class) || clazz.equals(IntegerType.class)) return Integer.valueOf(id);
    if (clazz.equals(Long.class) || clazz.equals(LongType.class)) return Long.valueOf(id);
    if (clazz.equals(Float.class) || clazz.equals(FloatType.class)) return Float.valueOf(id);
    if (clazz.equals(Double.class) || clazz.equals(DoubleType.class)) return Double.valueOf(id);
    if (clazz.equals(Boolean.class) || clazz.equals(BooleanType.class)) return Boolean.valueOf(id);

    Map<String, Entity> entities = iEntities.get(clazz.getName());
    if (entities != null) {
        Entity entity = entities.get(id);
        if (entity != null) return entity.getObject();
    }
       for (Map.Entry<String, Map<String, Entity>> entry: iEntities.entrySet()) {
        Entity o = entry.getValue().get(id);
        if (o != null && clazz.isInstance(o.getObject())) return o.getObject();
    }
       if (clazz.equals(Session.class))
        return ((Entity)iEntities.get(Session.class.getName()).values().iterator().next()).getObject();
       if (clazz.equals(Student.class))
        return checkUnknown(clazz, id, iStudents.get(id));
       if (iIsClone)
        return checkUnknown(clazz, id,
                iHibSession.get(clazz, clazz.equals(ItypeDesc.class) ? (Serializable) Integer.valueOf(id) : (Serializable) Long.valueOf(id)));
       return checkUnknown(clazz, id, null);
}