com.google.gson.internal.bind.util.ISO8601Utils Java Examples

The following examples show how to use com.google.gson.internal.bind.util.ISO8601Utils. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: influxdb-client-java   Author: influxdata   File: JSON.java    License: MIT License 6 votes vote down vote up
@Override
public java.sql.Date read(JsonReader in) throws IOException {
    switch (in.peek()) {
        case NULL:
            in.nextNull();
            return null;
        default:
            String date = in.nextString();
            try {
                if (dateFormat != null) {
                    return new java.sql.Date(dateFormat.parse(date).getTime());
                }
                return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime());
            } catch (ParseException e) {
                throw new JsonParseException(e);
            }
    }
}
 
Example #2
Source Project: huaweicloud-cs-sdk   Author: huaweicloud   File: JSON.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public java.sql.Date read(JsonReader in) throws IOException {
    switch (in.peek()) {
        case NULL:
            in.nextNull();
            return null;
        default:
            String date = in.nextString();
            try {
                if (dateFormat != null) {
                    return new java.sql.Date(dateFormat.parse(date).getTime());
                }
                return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime());
            } catch (ParseException e) {
                throw new JsonParseException(e);
            }
    }
}
 
Example #3
Source Project: huaweicloud-cs-sdk   Author: huaweicloud   File: JSON.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public java.sql.Date read(JsonReader in) throws IOException {
    switch (in.peek()) {
        case NULL:
            in.nextNull();
            return null;
        default:
            String date = in.nextString();
            try {
                if (dateFormat != null) {
                    return new java.sql.Date(dateFormat.parse(date).getTime());
                }
                return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime());
            } catch (ParseException e) {
                throw new JsonParseException(e);
            }
    }
}
 
Example #4
Source Project: openapi-generator   Author: OpenAPITools   File: JSON.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public java.sql.Date read(JsonReader in) throws IOException {
    switch (in.peek()) {
        case NULL:
            in.nextNull();
            return null;
        default:
            String date = in.nextString();
            try {
                if (dateFormat != null) {
                    return new java.sql.Date(dateFormat.parse(date).getTime());
                }
                return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime());
            } catch (ParseException e) {
                throw new JsonParseException(e);
            }
    }
}
 
Example #5
Source Project: openapi-generator   Author: OpenAPITools   File: JSON.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public java.sql.Date read(JsonReader in) throws IOException {
    switch (in.peek()) {
        case NULL:
            in.nextNull();
            return null;
        default:
            String date = in.nextString();
            try {
                if (dateFormat != null) {
                    return new java.sql.Date(dateFormat.parse(date).getTime());
                }
                return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime());
            } catch (ParseException e) {
                throw new JsonParseException(e);
            }
    }
}
 
Example #6
Source Project: openapi-generator   Author: OpenAPITools   File: JSON.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public java.sql.Date read(JsonReader in) throws IOException {
    switch (in.peek()) {
        case NULL:
            in.nextNull();
            return null;
        default:
            String date = in.nextString();
            try {
                if (dateFormat != null) {
                    return new java.sql.Date(dateFormat.parse(date).getTime());
                }
                return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime());
            } catch (ParseException e) {
                throw new JsonParseException(e);
            }
    }
}
 
Example #7
Source Project: openapi-generator   Author: OpenAPITools   File: JSON.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public java.sql.Date read(JsonReader in) throws IOException {
    switch (in.peek()) {
        case NULL:
            in.nextNull();
            return null;
        default:
            String date = in.nextString();
            try {
                if (dateFormat != null) {
                    return new java.sql.Date(dateFormat.parse(date).getTime());
                }
                return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime());
            } catch (ParseException e) {
                throw new JsonParseException(e);
            }
    }
}
 
Example #8
Source Project: openapi-generator   Author: OpenAPITools   File: JSON.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public java.sql.Date read(JsonReader in) throws IOException {
    switch (in.peek()) {
        case NULL:
            in.nextNull();
            return null;
        default:
            String date = in.nextString();
            try {
                if (dateFormat != null) {
                    return new java.sql.Date(dateFormat.parse(date).getTime());
                }
                return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime());
            } catch (ParseException e) {
                throw new JsonParseException(e);
            }
    }
}
 
Example #9
Source Project: openapi-generator   Author: OpenAPITools   File: JSON.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public java.sql.Date read(JsonReader in) throws IOException {
    switch (in.peek()) {
        case NULL:
            in.nextNull();
            return null;
        default:
            String date = in.nextString();
            try {
                if (dateFormat != null) {
                    return new java.sql.Date(dateFormat.parse(date).getTime());
                }
                return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime());
            } catch (ParseException e) {
                throw new JsonParseException(e);
            }
    }
}
 
Example #10
Source Project: android   Author: gotify   File: JSON.java    License: MIT License 6 votes vote down vote up
@Override
public java.sql.Date read(JsonReader in) throws IOException {
    switch (in.peek()) {
        case NULL:
            in.nextNull();
            return null;
        default:
            String date = in.nextString();
            try {
                if (dateFormat != null) {
                    return new java.sql.Date(dateFormat.parse(date).getTime());
                }
                return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime());
            } catch (ParseException e) {
                throw new JsonParseException(e);
            }
    }
}
 
Example #11
Source Project: nifi-swagger-client   Author: hermannpencole   File: JSON.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public java.sql.Date read(JsonReader in) throws IOException {
    switch (in.peek()) {
        case NULL:
            in.nextNull();
            return null;
        default:
            String date = in.nextString();
            try {
                if (dateFormat != null) {
                    return new java.sql.Date(dateFormat.parse(date).getTime());
                }
                return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime());
            } catch (ParseException e) {
                throw new JsonParseException(e);
            }
    }
}
 
Example #12
Source Project: swaggy-jenkins   Author: cliffano   File: JSON.java    License: MIT License 6 votes vote down vote up
@Override
public java.sql.Date read(JsonReader in) throws IOException {
    switch (in.peek()) {
        case NULL:
            in.nextNull();
            return null;
        default:
            String date = in.nextString();
            try {
                if (dateFormat != null) {
                    return new java.sql.Date(dateFormat.parse(date).getTime());
                }
                return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime());
            } catch (ParseException e) {
                throw new JsonParseException(e);
            }
    }
}
 
Example #13
Source Project: intra42   Author: pvarry   File: Tags.java    License: Apache License 2.0 6 votes vote down vote up
@Nullable
public static List<Tags> getTagsUpdate(ApiService api, Date updateAtStart, Date updateAtEnd) {
    List<Tags> list = new ArrayList<>();
    int pageSize = 100;
    String range = ISO8601Utils.format(updateAtStart) + "," + ISO8601Utils.format(updateAtEnd);

    try {
        Response<List<Tags>> response = api.getTags(range, pageSize, Pagination.getPage(list, pageSize)).execute();
        if (!Tools.apiIsSuccessfulNoThrow(response))
            return null;

        int total = Integer.decode(response.headers().get("X-Total"));
        list.addAll(response.body());

        while (list.size() < total) {
            response = api.getTags(range, pageSize, Pagination.getPage(list, pageSize)).execute();
            if (!Tools.apiIsSuccessfulNoThrow(response))
                return null;
            list.addAll(response.body());
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
    return list;
}
 
Example #14
Source Project: swagger-aem   Author: shinesolutions   File: JSON.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public java.sql.Date read(JsonReader in) throws IOException {
    switch (in.peek()) {
        case NULL:
            in.nextNull();
            return null;
        default:
            String date = in.nextString();
            try {
                if (dateFormat != null) {
                    return new java.sql.Date(dateFormat.parse(date).getTime());
                }
                return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime());
            } catch (ParseException e) {
                throw new JsonParseException(e);
            }
    }
}
 
Example #15
Source Project: eve-esi   Author: burberius   File: JSON.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public java.sql.Date read(JsonReader in) throws IOException {
    switch (in.peek()) {
    case NULL:
        in.nextNull();
        return null;
    default:
        String date = in.nextString();
        try {
            if (dateFormat != null) {
                return new java.sql.Date(dateFormat.parse(date).getTime());
            }
            return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime());
        } catch (ParseException e) {
            throw new JsonParseException(e);
        }
    }
}
 
Example #16
Source Project: director-sdk   Author: cloudera   File: JSON.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public java.sql.Date read(JsonReader in) throws IOException {
    switch (in.peek()) {
        case NULL:
            in.nextNull();
            return null;
        default:
            String date = in.nextString();
            try {
                if (dateFormat != null) {
                    return new java.sql.Date(dateFormat.parse(date).getTime());
                }
                return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime());
            } catch (ParseException e) {
                throw new JsonParseException(e);
            }
    }
}
 
Example #17
Source Project: edx-app-android   Author: edx   File: DateUtil.java    License: Apache License 2.0 6 votes vote down vote up
public static Date convertToDate(String date) {
    if(date==null){
        return null;
    }

    java.util.Date parsedate = null;
    final ParsePosition parsePosition = new ParsePosition(0);
    try {
        parsedate = ISO8601Utils.parse(date, parsePosition);
        logger.debug("Parsed Data"+parsedate);
        return parsedate;

    } catch (ParseException e) {
        logger.error(e);
    }
    return parsedate;
}
 
Example #18
Source Project: oxd   Author: GluuFederation   File: JSON.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public java.sql.Date read(JsonReader in) throws IOException {
    switch (in.peek()) {
        case NULL:
            in.nextNull();
            return null;
        default:
            String date = in.nextString();
            try {
                if (dateFormat != null) {
                    return new java.sql.Date(dateFormat.parse(date).getTime());
                }
                return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime());
            } catch (ParseException e) {
                throw new JsonParseException(e);
            }
    }
}
 
Example #19
Source Project: influxdb-client-java   Author: influxdata   File: JSON.java    License: MIT License 5 votes vote down vote up
@Override
public void write(JsonWriter out, Date date) throws IOException {
    if (date == null) {
        out.nullValue();
    } else {
        String value;
        if (dateFormat != null) {
            value = dateFormat.format(date);
        } else {
            value = ISO8601Utils.format(date, true);
        }
        out.value(value);
    }
}
 
Example #20
Source Project: huaweicloud-cs-sdk   Author: huaweicloud   File: JSON.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void write(JsonWriter out, Date date) throws IOException {
    if (date == null) {
        out.nullValue();
    } else {
        String value;
        if (dateFormat != null) {
            value = dateFormat.format(date);
        } else {
            value = ISO8601Utils.format(date, true);
        }
        out.value(value);
    }
}
 
Example #21
Source Project: huaweicloud-cs-sdk   Author: huaweicloud   File: JSON.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void write(JsonWriter out, Date date) throws IOException {
    if (date == null) {
        out.nullValue();
    } else {
        String value;
        if (dateFormat != null) {
            value = dateFormat.format(date);
        } else {
            value = ISO8601Utils.format(date, true);
        }
        out.value(value);
    }
}
 
Example #22
Source Project: openapi-generator   Author: OpenAPITools   File: JSON.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void write(JsonWriter out, Date date) throws IOException {
    if (date == null) {
        out.nullValue();
    } else {
        String value;
        if (dateFormat != null) {
            value = dateFormat.format(date);
        } else {
            value = ISO8601Utils.format(date, true);
        }
        out.value(value);
    }
}
 
Example #23
Source Project: openapi-generator   Author: OpenAPITools   File: JSON.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void write(JsonWriter out, Date date) throws IOException {
    if (date == null) {
        out.nullValue();
    } else {
        String value;
        if (dateFormat != null) {
            value = dateFormat.format(date);
        } else {
            value = ISO8601Utils.format(date, true);
        }
        out.value(value);
    }
}
 
Example #24
Source Project: openapi-generator   Author: OpenAPITools   File: JSON.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void write(JsonWriter out, Date date) throws IOException {
    if (date == null) {
        out.nullValue();
    } else {
        String value;
        if (dateFormat != null) {
            value = dateFormat.format(date);
        } else {
            value = ISO8601Utils.format(date, true);
        }
        out.value(value);
    }
}
 
Example #25
Source Project: openapi-generator   Author: OpenAPITools   File: JSON.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void write(JsonWriter out, Date date) throws IOException {
    if (date == null) {
        out.nullValue();
    } else {
        String value;
        if (dateFormat != null) {
            value = dateFormat.format(date);
        } else {
            value = ISO8601Utils.format(date, true);
        }
        out.value(value);
    }
}
 
Example #26
Source Project: openapi-generator   Author: OpenAPITools   File: JSON.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void write(JsonWriter out, Date date) throws IOException {
    if (date == null) {
        out.nullValue();
    } else {
        String value;
        if (dateFormat != null) {
            value = dateFormat.format(date);
        } else {
            value = ISO8601Utils.format(date, true);
        }
        out.value(value);
    }
}
 
Example #27
Source Project: openapi-generator   Author: OpenAPITools   File: JSON.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void write(JsonWriter out, Date date) throws IOException {
    if (date == null) {
        out.nullValue();
    } else {
        String value;
        if (dateFormat != null) {
            value = dateFormat.format(date);
        } else {
            value = ISO8601Utils.format(date, true);
        }
        out.value(value);
    }
}
 
Example #28
Source Project: android   Author: gotify   File: JSON.java    License: MIT License 5 votes vote down vote up
@Override
public void write(JsonWriter out, Date date) throws IOException {
    if (date == null) {
        out.nullValue();
    } else {
        String value;
        if (dateFormat != null) {
            value = dateFormat.format(date);
        } else {
            value = ISO8601Utils.format(date, true);
        }
        out.value(value);
    }
}
 
Example #29
Source Project: nifi-swagger-client   Author: hermannpencole   File: JSON.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void write(JsonWriter out, Date date) throws IOException {
    if (date == null) {
        out.nullValue();
    } else {
        String value;
        if (dateFormat != null) {
            value = dateFormat.format(date);
        } else {
            value = ISO8601Utils.format(date, true);
        }
        out.value(value);
    }
}
 
Example #30
Source Project: swaggy-jenkins   Author: cliffano   File: JSON.java    License: MIT License 5 votes vote down vote up
@Override
public void write(JsonWriter out, Date date) throws IOException {
    if (date == null) {
        out.nullValue();
    } else {
        String value;
        if (dateFormat != null) {
            value = dateFormat.format(date);
        } else {
            value = ISO8601Utils.format(date, true);
        }
        out.value(value);
    }
}