Example usage for com.amazonaws.transform StaxUnmarshallerContext getCurrentDepth

List of usage examples for com.amazonaws.transform StaxUnmarshallerContext getCurrentDepth

Introduction

In this page you can find the example usage for com.amazonaws.transform StaxUnmarshallerContext getCurrentDepth.

Prototype

public int getCurrentDepth() 

Source Link

Document

Returns the element depth of the parser's current position in the XML document being parsed.

Usage

From source file:com.github.sjones4.youcan.youare.model.transform.AccountStaxUnmarshaller.java

License:Open Source License

public Account unmarshall(StaxUnmarshallerContext context) throws Exception {
    Account account = new Account();
    int originalDepth = context.getCurrentDepth();
    int targetDepth = originalDepth + 1;

    if (context.isStartOfDocument())
        targetDepth += 2;/* w ww .  j  a  v a2 s. c  o m*/

    while (true) {
        XMLEvent xmlEvent = context.nextEvent();
        if (xmlEvent.isEndDocument())
            return account;

        if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {
            if (context.testExpression("AccountId", targetDepth)) {
                account.setAccountId(
                        SimpleTypeStaxUnmarshallers.StringStaxUnmarshaller.getInstance().unmarshall(context));
                continue;
            }
            if (context.testExpression("AccountName", targetDepth)) {
                account.setAccountName(
                        SimpleTypeStaxUnmarshallers.StringStaxUnmarshaller.getInstance().unmarshall(context));
                continue;
            }
        } else if (xmlEvent.isEndElement()) {
            if (context.getCurrentDepth() < originalDepth) {
                return account;
            }
        }
    }
}

From source file:com.github.sjones4.youcan.youare.model.transform.CreateAccountResultStaxUnmarshaller.java

License:Open Source License

public CreateAccountResult unmarshall(StaxUnmarshallerContext context) throws Exception {
    CreateAccountResult createAccountResult = new CreateAccountResult();
    int originalDepth = context.getCurrentDepth();
    int targetDepth = originalDepth + 1;

    if (context.isStartOfDocument())
        targetDepth += 2;//from w  w  w .  jav  a2 s .  co m

    while (true) {
        XMLEvent xmlEvent = context.nextEvent();
        if (xmlEvent.isEndDocument())
            return createAccountResult;

        if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {
            if (context.testExpression("Account", targetDepth)) {
                createAccountResult.setAccount(AccountStaxUnmarshaller.getInstance().unmarshall(context));
                continue;
            }
        } else if (xmlEvent.isEndElement()) {
            if (context.getCurrentDepth() < originalDepth) {
                return createAccountResult;
            }
        }
    }
}

From source file:com.github.sjones4.youcan.youare.model.transform.GetAccountPolicyResultStaxUnmarshaller.java

License:Open Source License

public GetAccountPolicyResult unmarshall(StaxUnmarshallerContext context) throws Exception {
    GetAccountPolicyResult getAccountPolicyResult = new GetAccountPolicyResult();
    int originalDepth = context.getCurrentDepth();
    int targetDepth = originalDepth + 1;

    if (context.isStartOfDocument())
        targetDepth += 2;/*  w w w  .  j a v a2 s .co m*/

    while (true) {
        XMLEvent xmlEvent = context.nextEvent();
        if (xmlEvent.isEndDocument())
            return getAccountPolicyResult;

        if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {
            if (context.testExpression("AccountName", targetDepth)) {
                getAccountPolicyResult.setAccountName(
                        SimpleTypeStaxUnmarshallers.StringStaxUnmarshaller.getInstance().unmarshall(context));
                continue;
            }
            if (context.testExpression("PolicyName", targetDepth)) {
                getAccountPolicyResult.setPolicyName(
                        SimpleTypeStaxUnmarshallers.StringStaxUnmarshaller.getInstance().unmarshall(context));
                continue;
            }
            if (context.testExpression("PolicyDocument", targetDepth)) {
                getAccountPolicyResult.setPolicyDocument(
                        SimpleTypeStaxUnmarshallers.StringStaxUnmarshaller.getInstance().unmarshall(context));
                continue;
            }
        } else if (xmlEvent.isEndElement()) {
            if (context.getCurrentDepth() < originalDepth) {
                return getAccountPolicyResult;
            }
        }
    }
}

From source file:com.github.sjones4.youcan.youare.model.transform.ListAccountPoliciesResultStaxUnmarshaller.java

License:Open Source License

public ListAccountPoliciesResult unmarshall(StaxUnmarshallerContext context) throws Exception {
    ListAccountPoliciesResult listAccountPoliciesResult = new ListAccountPoliciesResult();
    int originalDepth = context.getCurrentDepth();
    int targetDepth = originalDepth + 1;

    if (context.isStartOfDocument())
        targetDepth += 2;//from   w  w  w.j a v  a 2s  .c om

    while (true) {
        XMLEvent xmlEvent = context.nextEvent();
        if (xmlEvent.isEndDocument())
            return listAccountPoliciesResult;

        if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {
            if (context.testExpression("PolicyNames/member", targetDepth)) {
                listAccountPoliciesResult.getPolicyNames().add(
                        SimpleTypeStaxUnmarshallers.StringStaxUnmarshaller.getInstance().unmarshall(context));
                continue;
            }
        } else if (xmlEvent.isEndElement()) {
            if (context.getCurrentDepth() < originalDepth) {
                return listAccountPoliciesResult;
            }
        }
    }
}

From source file:com.github.sjones4.youcan.youare.model.transform.ListAccountsResultStaxUnmarshaller.java

License:Open Source License

public ListAccountsResult unmarshall(StaxUnmarshallerContext context) throws Exception {
    ListAccountsResult listUsersResult = new ListAccountsResult();
    int originalDepth = context.getCurrentDepth();
    int targetDepth = originalDepth + 1;

    if (context.isStartOfDocument())
        targetDepth += 2;/*from ww  w. j  a  va 2  s  . co m*/

    while (true) {
        XMLEvent xmlEvent = context.nextEvent();
        if (xmlEvent.isEndDocument())
            return listUsersResult;

        if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {
            if (context.testExpression("Accounts/member", targetDepth)) {
                listUsersResult.getAccounts().add(AccountStaxUnmarshaller.getInstance().unmarshall(context));
                continue;
            }
        } else if (xmlEvent.isEndElement()) {
            if (context.getCurrentDepth() < originalDepth) {
                return listUsersResult;
            }
        }
    }
}

From source file:com.github.sjones4.youcan.youconfig.model.transform.ComponentInfoStaxUnmarshaller.java

License:Open Source License

public ComponentInfo unmarshall(final StaxUnmarshallerContext context) throws Exception {
    ComponentInfo componentInfo = new ComponentInfo();
    int originalDepth = context.getCurrentDepth();
    int targetDepth = originalDepth + 1;

    if (context.isStartOfDocument())
        targetDepth += 1;// ww w .  ja  va  2 s.  c o  m

    while (true) {
        XMLEvent xmlEvent = context.nextEvent();
        if (xmlEvent.isEndDocument())
            return componentInfo;

        if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {
            if (context.testExpression("type", targetDepth)) {
                componentInfo.setType(
                        SimpleTypeStaxUnmarshallers.StringStaxUnmarshaller.getInstance().unmarshall(context));
                continue;
            }
            if (context.testExpression("partition", targetDepth)) {
                componentInfo.setPartition(
                        SimpleTypeStaxUnmarshallers.StringStaxUnmarshaller.getInstance().unmarshall(context));
                continue;
            }
            if (context.testExpression("name", targetDepth)) {
                componentInfo.setName(
                        SimpleTypeStaxUnmarshallers.StringStaxUnmarshaller.getInstance().unmarshall(context));
                continue;
            }
            if (context.testExpression("hostName", targetDepth)) {
                componentInfo.setHostName(
                        SimpleTypeStaxUnmarshallers.StringStaxUnmarshaller.getInstance().unmarshall(context));
                continue;
            }
            if (context.testExpression("fullName", targetDepth)) {
                componentInfo.setFullName(
                        SimpleTypeStaxUnmarshallers.StringStaxUnmarshaller.getInstance().unmarshall(context));
                continue;
            }
            if (context.testExpression("state", targetDepth)) {
                componentInfo.setState(
                        SimpleTypeStaxUnmarshallers.StringStaxUnmarshaller.getInstance().unmarshall(context));
                continue;
            }
            if (context.testExpression("detail", targetDepth)) {
                componentInfo.setDetail(
                        SimpleTypeStaxUnmarshallers.StringStaxUnmarshaller.getInstance().unmarshall(context));
                continue;
            }
        } else if (xmlEvent.isEndElement()) {
            if (context.getCurrentDepth() < originalDepth) {
                return componentInfo;
            }
        }
    }
}

From source file:com.github.sjones4.youcan.youconfig.model.transform.DescribeComponentsResultStaxUnmarshaller.java

License:Open Source License

public DescribeComponentsResult unmarshall(StaxUnmarshallerContext context) throws Exception {
    DescribeComponentsResult describeComponentsResult = new DescribeComponentsResult();
    int originalDepth = context.getCurrentDepth();
    int targetDepth = originalDepth + 1;

    if (context.isStartOfDocument())
        targetDepth += 1;//from ww  w .  j a  v a 2  s  .c o m

    while (true) {
        XMLEvent xmlEvent = context.nextEvent();
        if (xmlEvent.isEndDocument())
            return describeComponentsResult;

        if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {
            if (context.testExpression("registered/item", targetDepth)) {
                describeComponentsResult.getComponentInfos()
                        .add(ComponentInfoStaxUnmarshaller.getInstance().unmarshall(context));
                continue;
            }
        } else if (xmlEvent.isEndElement()) {
            if (context.getCurrentDepth() < originalDepth) {
                return describeComponentsResult;
            }
        }
    }
}

From source file:com.github.sjones4.youcan.youprop.model.transform.DescribePropertiesResultStaxUnmarshaller.java

License:Open Source License

public DescribePropertiesResult unmarshall(StaxUnmarshallerContext context) throws Exception {
    DescribePropertiesResult describePropertiesResult = new DescribePropertiesResult();
    int originalDepth = context.getCurrentDepth();
    int targetDepth = originalDepth + 1;

    if (context.isStartOfDocument())
        targetDepth += 1;//w  w w  .  j  av  a2s .  c o  m

    while (true) {
        XMLEvent xmlEvent = context.nextEvent();
        if (xmlEvent.isEndDocument())
            return describePropertiesResult;

        if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {
            if (context.testExpression("properties/item", targetDepth)) {
                describePropertiesResult.getProperties()
                        .add(PropertyStaxUnmarshaller.getInstance().unmarshall(context));
                continue;
            }
        } else if (xmlEvent.isEndElement()) {
            if (context.getCurrentDepth() < originalDepth) {
                return describePropertiesResult;
            }
        }
    }
}

From source file:com.github.sjones4.youcan.youprop.model.transform.ModifyPropertyValueResultStaxUnmarshaller.java

License:Open Source License

public ModifyPropertyValueResult unmarshall(StaxUnmarshallerContext context) throws Exception {
    ModifyPropertyValueResult modifyPropertyValueResult = new ModifyPropertyValueResult();
    int originalDepth = context.getCurrentDepth();
    int targetDepth = originalDepth + 1;

    if (context.isStartOfDocument())
        targetDepth += 1;//w  w  w  . j  av a  2 s .  co  m

    while (true) {
        XMLEvent xmlEvent = context.nextEvent();
        if (xmlEvent.isEndDocument())
            return modifyPropertyValueResult;

        if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {
            if (context.testExpression("name", targetDepth)) {
                modifyPropertyValueResult.setName(
                        SimpleTypeStaxUnmarshallers.StringStaxUnmarshaller.getInstance().unmarshall(context));
                continue;
            }
            if (context.testExpression("value", targetDepth)) {
                modifyPropertyValueResult.setValue(
                        SimpleTypeStaxUnmarshallers.StringStaxUnmarshaller.getInstance().unmarshall(context));
                continue;
            }
            if (context.testExpression("oldValue", targetDepth)) {
                modifyPropertyValueResult.setOldValue(
                        SimpleTypeStaxUnmarshallers.StringStaxUnmarshaller.getInstance().unmarshall(context));
                continue;
            }
        } else if (xmlEvent.isEndElement()) {
            if (context.getCurrentDepth() < originalDepth) {
                return modifyPropertyValueResult;
            }
        }
    }
}

From source file:com.github.sjones4.youcan.youprop.model.transform.PropertyStaxUnmarshaller.java

License:Open Source License

public Property unmarshall(final StaxUnmarshallerContext context) throws Exception {
    Property property = new Property();
    int originalDepth = context.getCurrentDepth();
    int targetDepth = originalDepth + 1;

    if (context.isStartOfDocument())
        targetDepth += 1;//from ww w.  j  a  v  a2  s . c om

    while (true) {
        XMLEvent xmlEvent = context.nextEvent();
        if (xmlEvent.isEndDocument())
            return property;

        if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {
            if (context.testExpression("name", targetDepth)) {
                property.setName(
                        SimpleTypeStaxUnmarshallers.StringStaxUnmarshaller.getInstance().unmarshall(context));
                continue;
            }
            if (context.testExpression("value", targetDepth)) {
                property.setValue(
                        SimpleTypeStaxUnmarshallers.StringStaxUnmarshaller.getInstance().unmarshall(context));
                continue;
            }
            if (context.testExpression("description", targetDepth)) {
                property.setDescription(
                        SimpleTypeStaxUnmarshallers.StringStaxUnmarshaller.getInstance().unmarshall(context));
                continue;
            }
            if (context.testExpression("defaultValue", targetDepth)) {
                property.setDefaultValue(
                        SimpleTypeStaxUnmarshallers.StringStaxUnmarshaller.getInstance().unmarshall(context));
                continue;
            }
            if (context.testExpression("readOnly", targetDepth)) {
                property.setReadOnly(
                        SimpleTypeStaxUnmarshallers.BooleanStaxUnmarshaller.getInstance().unmarshall(context));
                continue;
            }
        } else if (xmlEvent.isEndElement()) {
            if (context.getCurrentDepth() < originalDepth) {
                return property;
            }
        }
    }
}