library/src/main/java/com/kdgregory/aws/utils/iam/PolicyBuilder.java
/**
     *  Creates the JSON representation of this policy.
     */
Creates the JSON representation of this policy.
Creates the JSON representation of this policy .
public String build()
    {
        StringWriter sw = new StringWriter(8192);
        try (JsonGenerator out = jf.createGenerator(sw))
        {
            out.writeStartObject();
            out.writeStringField("Version", version);
            out.writeStringField("Id", id);
            out.writeArrayFieldStart("Statement");
            for (Statement stmt : statements)
            {
                stmt.append(out);
            }
            out.writeEndArray();
            out.writeEndObject();
            out.close();
            return sw.toString();
        }
        catch (IllegalArgumentException ex)
        {
            throw ex;
        }
        catch (Exception ex)
        {
            throw new RuntimeException("unexpected exception producing JSON output", ex);
        }
    }
public String build ( ) { StringWriter sw = new StringWriter ( 8192 ) ; try ( JsonGenerator out = jf . createGenerator ( sw ) ) { out . writeStartObject ( ) ; out . writeStringField ( "Version" , version ) ; out . writeStringField ( "Id" , id ) ; out . writeArrayFieldStart ( "Statement" ) ; for ( Statement stmt : statements ) { stmt . append ( out ) ; } out . writeEndArray ( ) ; out . writeEndObject ( ) ; out . close ( ) ; return sw . toString ( ) ; } catch ( IllegalArgumentException ex ) { throw ex ; } catch ( Exception ex ) { throw new RuntimeException ( "unexpected exception producing JSON output" , ex ) ; } }
Creates the JSON representation of this policy.
Creates the JSON representation of this policy .