Example usage for com.amazonaws.transform JsonUnmarshallerContext getLastParsedParentElement

List of usage examples for com.amazonaws.transform JsonUnmarshallerContext getLastParsedParentElement

Introduction

In this page you can find the example usage for com.amazonaws.transform JsonUnmarshallerContext getLastParsedParentElement.

Prototype

public String getLastParsedParentElement() 

Source Link

Document

This will return the deleted string in stackString when doing update on the stack.

Usage

From source file:com.ivona.services.tts.model.transform.lexicons.GetLexiconResultJsonUnmarshaller.java

License:Open Source License

public GetLexiconResult unmarshall(JsonUnmarshallerContext context) throws Exception {
    GetLexiconResult getLexiconResult = new GetLexiconResult();

    int originalDepth = context.getCurrentDepth();
    String currentParentElement = context.getCurrentParentElement();
    int targetDepth = originalDepth + 1;

    JsonToken token = context.getCurrentToken();
    if (token == null) {
        token = context.nextToken();//from w  ww. j a  va  2  s .c  o  m
    }
    if (token == VALUE_NULL) {
        return null;
    }

    while (true) {
        if (token == null) {
            break;
        }

        if (token == FIELD_NAME || token == START_OBJECT) {
            if (context.testExpression(JSON_KEY_LEXICON, targetDepth)) {
                context.nextToken();
                getLexiconResult.setLexicon(LexiconJsonUnmarshaller.getInstance().unmarshall(context));
            }
        } else if (token == END_ARRAY || token == END_OBJECT) {
            if (context.getLastParsedParentElement() == null
                    || context.getLastParsedParentElement().equals(currentParentElement)) {
                if (context.getCurrentDepth() <= originalDepth) {
                    break;
                }
            }
        }

        token = context.nextToken();
    }

    return getLexiconResult;
}

From source file:com.ivona.services.tts.model.transform.lexicons.LexiconJsonUnmarshaller.java

License:Open Source License

public Lexicon unmarshall(JsonUnmarshallerContext context) throws Exception {
    Lexicon lexicon = new Lexicon();

    int originalDepth = context.getCurrentDepth();
    String currentParentElement = context.getCurrentParentElement();
    int targetDepth = originalDepth + 1;

    JsonToken token = context.getCurrentToken();
    if (token == null) {
        token = context.nextToken();/*from w  w w  .  ja  v  a 2s . c  o  m*/
    }
    if (token == VALUE_NULL) {
        return null;
    }

    while (true) {
        if (token == null) {
            break;
        }

        if (token == FIELD_NAME || token == START_OBJECT) {
            if (context.testExpression(JSON_KEY_NAME, targetDepth)) {
                context.nextToken();
                lexicon.setName(
                        SimpleTypeJsonUnmarshallers.StringJsonUnmarshaller.getInstance().unmarshall(context));
            }
            if (context.testExpression(JSON_KEY_CONTENTS, targetDepth)) {
                context.nextToken();
                lexicon.setContents(
                        SimpleTypeJsonUnmarshallers.StringJsonUnmarshaller.getInstance().unmarshall(context));
            }
        } else if (token == END_ARRAY || token == END_OBJECT) {
            if (context.getLastParsedParentElement() == null
                    || context.getLastParsedParentElement().equals(currentParentElement)) {
                if (context.getCurrentDepth() <= originalDepth) {
                    break;
                }
            }
        }

        token = context.nextToken();
    }

    return lexicon;
}

From source file:com.ivona.services.tts.model.transform.lexicons.ListLexiconsResultJsonUnmarshaller.java

License:Open Source License

public ListLexiconsResult unmarshall(JsonUnmarshallerContext context) throws Exception {
    ListLexiconsResult listLexiconsResult = new ListLexiconsResult();

    int originalDepth = context.getCurrentDepth();
    String currentParentElement = context.getCurrentParentElement();
    int targetDepth = originalDepth + 1;

    JsonToken token = context.getCurrentToken();
    if (token == null) {
        token = context.nextToken();/*from   w  w w. ja  v  a 2 s. c  o  m*/
    }
    if (token == VALUE_NULL) {
        return null;
    }

    while (true) {
        if (token == null) {
            break;
        }

        if (token == FIELD_NAME || token == START_OBJECT) {
            if (context.testExpression(JSON_KEY_LEXICONS, targetDepth)) {
                listLexiconsResult.setLexiconNames(new ListUnmarshaller<String>(
                        SimpleTypeJsonUnmarshallers.StringJsonUnmarshaller.getInstance()).unmarshall(context));
            }
        } else if (token == END_ARRAY || token == END_OBJECT) {
            if (context.getLastParsedParentElement() == null
                    || context.getLastParsedParentElement().equals(currentParentElement)) {
                if (context.getCurrentDepth() <= originalDepth) {
                    break;
                }
            }
        }

        token = context.nextToken();
    }

    return listLexiconsResult;
}

From source file:com.ivona.services.tts.model.transform.listvoices.ListVoicesResultJsonUnmarshaller.java

License:Open Source License

public ListVoicesResult unmarshall(JsonUnmarshallerContext context) throws Exception {
    ListVoicesResult listVoicesResult = new ListVoicesResult();

    int originalDepth = context.getCurrentDepth();
    String currentParentElement = context.getCurrentParentElement();
    int targetDepth = originalDepth + 1;

    JsonToken token = context.getCurrentToken();
    if (token == null) {
        token = context.nextToken();/*  w ww  .  ja va 2 s.  c  o m*/
    }
    if (token == VALUE_NULL) {
        return null;
    }

    while (true) {
        if (token == null) {
            break;
        }

        if (token == FIELD_NAME || token == START_OBJECT) {
            if (context.testExpression(JSON_KEY_VOICES, targetDepth)) {
                listVoicesResult.setVoices(
                        new ListUnmarshaller<Voice>(VoiceJsonUnmarshaller.getInstance()).unmarshall(context));
            }
        } else if (token == END_ARRAY || token == END_OBJECT) {
            if (context.getLastParsedParentElement() == null
                    || context.getLastParsedParentElement().equals(currentParentElement)) {
                if (context.getCurrentDepth() <= originalDepth) {
                    break;
                }
            }
        }

        token = context.nextToken();
    }

    return listVoicesResult;
}

From source file:com.ivona.services.tts.model.transform.listvoices.VoiceJsonUnmarshaller.java

License:Open Source License

public Voice unmarshall(JsonUnmarshallerContext context) throws Exception {

    Voice voice = new Voice();

    int originalDepth = context.getCurrentDepth();
    String currentParentElement = context.getCurrentParentElement();
    int targetDepth = originalDepth + 1;

    JsonToken token = context.getCurrentToken();
    if (token == null) {
        token = context.nextToken();/*from w ww.j  a va2  s .co  m*/
    }
    if (token == VALUE_NULL) {
        return null;
    }

    while (true) {
        if (token == null) {
            break;
        }

        if (token == FIELD_NAME || token == START_OBJECT) {
            if (context.testExpression(JSON_KEY_NAME, targetDepth)) {
                context.nextToken();
                voice.setName(
                        SimpleTypeJsonUnmarshallers.StringJsonUnmarshaller.getInstance().unmarshall(context));
            }
            if (context.testExpression(JSON_KEY_LANGUAGE, targetDepth)) {
                context.nextToken();
                voice.setLanguage(
                        SimpleTypeJsonUnmarshallers.StringJsonUnmarshaller.getInstance().unmarshall(context));
            }
            if (context.testExpression(JSON_KEY_GENDER, targetDepth)) {
                context.nextToken();
                voice.setGender(
                        SimpleTypeJsonUnmarshallers.StringJsonUnmarshaller.getInstance().unmarshall(context));
            }
        } else if (token == END_ARRAY || token == END_OBJECT) {
            if (context.getLastParsedParentElement() == null
                    || context.getLastParsedParentElement().equals(currentParentElement)) {
                if (context.getCurrentDepth() <= originalDepth) {
                    break;
                }
            }
        }

        token = context.nextToken();
    }

    return voice;
}