streams-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rbnks <...@git.apache.org>
Subject [GitHub] incubator-streams pull request: Streams-203 | GooglePlus Activity ...
Date Fri, 31 Oct 2014 14:44:43 GMT
Github user rbnks commented on a diff in the pull request:

    https://github.com/apache/incubator-streams/pull/115#discussion_r19670218
  
    --- Diff: streams-contrib/streams-provider-google/google-gplus/src/main/java/com/google/gplus/serializer/util/GPlusActivityDeserializer.java
---
    @@ -0,0 +1,129 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *   http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +
    +package com.google.gplus.serializer.util;
    +
    +import com.fasterxml.jackson.core.JsonParser;
    +import com.fasterxml.jackson.core.JsonProcessingException;
    +import com.fasterxml.jackson.databind.DeserializationContext;
    +import com.fasterxml.jackson.databind.JsonDeserializer;
    +import com.fasterxml.jackson.databind.JsonNode;
    +import com.google.api.client.util.DateTime;
    +import com.google.api.client.util.Lists;
    +import com.google.api.services.plus.model.Activity;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +
    +import java.io.IOException;
    +import java.util.List;
    +
    +/**
    + * Custom deserializer for GooglePlus' Person model
    + */
    +public class GPlusActivityDeserializer extends JsonDeserializer<Activity> {
    +    private final static Logger LOGGER = LoggerFactory.getLogger(GPlusActivityDeserializer.class);
    +
    +    /**
    +     * Because the GooglePlus Activity object {@link com.google.api.services.plus.model.Activity}
contains complex objects
    +     * within its hierarchy, we have to use a custom deserializer
    +     *
    +     * @param jsonParser
    +     * @param deserializationContext
    +     * @return The deserialized {@link com.google.api.services.plus.model.Activity} object
    +     * @throws IOException
    +     * @throws JsonProcessingException
    +     */
    +    @Override
    +    public Activity deserialize(JsonParser jsonParser, DeserializationContext deserializationContext)
throws IOException, JsonProcessingException {
    --- End diff --
    
    Can you break this method apart into multiple methods / helper functions?  a 100 line
method is a little too big.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message