Example usage for com.amazonaws.services.securitytoken.model.transform CredentialsStaxUnmarshaller getInstance

List of usage examples for com.amazonaws.services.securitytoken.model.transform CredentialsStaxUnmarshaller getInstance

Introduction

In this page you can find the example usage for com.amazonaws.services.securitytoken.model.transform CredentialsStaxUnmarshaller getInstance.

Prototype

public static CredentialsStaxUnmarshaller getInstance() 

Source Link

Usage

From source file:com.github.sjones4.youcan.youtoken.model.transform.GetAccessTokenResultStaxUnmarshaller.java

License:Open Source License

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

    if (context.isStartOfDocument())
        targetDepth += 2;//from   ww w  .ja va2  s . c  om

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

        if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {
            if (context.testExpression("Credentials", targetDepth)) {
                getAccessTokenResult
                        .setCredentials(CredentialsStaxUnmarshaller.getInstance().unmarshall(context));
                continue;
            }
        } else if (xmlEvent.isEndElement()) {
            if (context.getCurrentDepth() < originalDepth) {
                return getAccessTokenResult;
            }
        }
    }
}

From source file:com.github.sjones4.youcan.youtoken.model.transform.GetImpersonationTokenResultStaxUnmarshaller.java

License:Open Source License

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

    if (context.isStartOfDocument())
        targetDepth += 2;/*ww w .  j av  a2 s.  c  om*/

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

        if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {
            if (context.testExpression("Credentials", targetDepth)) {
                getImpersonationTokenResult
                        .setCredentials(CredentialsStaxUnmarshaller.getInstance().unmarshall(context));
                continue;
            }
        } else if (xmlEvent.isEndElement()) {
            if (context.getCurrentDepth() < originalDepth) {
                return getImpersonationTokenResult;
            }
        }
    }
}