Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright 2013 SAP AG Licensed 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.sap.core.odata.core.ep.consumer;
 
 import java.util.List;
 

Author(s):
SAP AG
 
 public class JsonFeedConsumer {
 
   private JsonReader reader;
   private EntityInfoAggregator eia;
   private List<ODataEntryentries = new ArrayList<ODataEntry>();
   private boolean resultsArrayPresent = false;
 
   public JsonFeedConsumer(final JsonReader readerfinal EntityInfoAggregator eiafinal EntityProviderReadProperties readProperties) {
     this. = reader;
     this. = eia;
     this. = readProperties;
   }
 
     try {
       readFeed();
 
       if (.peek() != .) {
         //TODO: CA Messagetext
       }
 
     } catch (IOException e) {
     } catch (EdmException e) {
     } catch (IllegalStateException e) {
     }
     return new ODataFeedImpl();
   }
 
   private void readFeed() throws IOExceptionEdmExceptionEntityProviderException {
     if (.peek() == .) {
       readArrayContent();
     } else {
       .beginObject();
       final String nextName = .nextName();
       if (..equals(nextName)) {
         if (.peek() == .) {
           readArrayContent();
         } else {
           .beginObject();
           readFeedContent();
           .endObject();
         }
       } else {
         handleName(nextName);
         readFeedContent();
       }
 
       .endObject();
     }
   }
 
   private void readFeedContent() throws IOExceptionEdmExceptionEntityProviderException {
     while (.hasNext()) {
       final String nextName = .nextName();
       handleName(nextName);
     }
 
    if (!) {
      //TODO: Messagetext
    }
  }
  private void handleName(final String nextNamethrows IOExceptionEdmExceptionEntityProviderException {
    if (..equals(nextName)) {
       = true;
      readArrayContent();
    } else if (..equals(nextName)) {
      if (.peek() == . && .getInlineCount() == null) {
        int inlineCount;
        try {
          inlineCount = .nextInt();
        } catch (final NumberFormatException e) {
        }
        if (inlineCount >= 0) {
          .setInlineCount(inlineCount);
        } else {
        }
      } else {
      }
    } else if (..equals(nextName)) {
      if (.peek() == . && .getNextLink() == null) {
        String nextLink = .nextString();
        .setNextLink(nextLink);
      } else {
        //TODO: CA Messagetext
      }
    } else {
      //TODO: CA Messagetext
    }
  }
    while (.hasNext()) {
      final ODataEntry entry = new JsonEntryConsumer().readFeedEntry();
      .add(entry);
    }
    .endArray();
  }
    //consume the already started content
    handleName(name);
    //consume the rest of the entry content
    return new ODataFeedImpl();
  }
    readFeed();
    return new ODataFeedImpl();
  }
New to GrepCode? Check out our FAQ X