microsoft-azure-storage/src/com/microsoft/azure/storage/ServicePropertiesSerializer.java
private static void writeRetentionPolicy(final XmlSerializer xmlw, final Integer val)
            throws IllegalArgumentException, IllegalStateException, IOException {
        xmlw.startTag(Constants.EMPTY_STRING, Constants.AnalyticsConstants.RETENTION_POLICY_ELEMENT);

        // Enabled
        Utility.serializeElement(xmlw, Constants.AnalyticsConstants.ENABLED_ELEMENT, val != null ? Constants.TRUE
                : Constants.FALSE);

        if (val != null) {
            // Days
            Utility.serializeElement(xmlw, Constants.AnalyticsConstants.DAYS_ELEMENT, val.toString());
        }

        // End Retention Policy
        xmlw.endTag(Constants.EMPTY_STRING, Constants.AnalyticsConstants.RETENTION_POLICY_ELEMENT);
    }
private static void writeRetentionPolicy(final XmlSerializer xmlw, final Integer val)
            throws IllegalArgumentException, IllegalStateException, IOException {
        xmlw.startTag(Constants.EMPTY_STRING, Constants.AnalyticsConstants.RETENTION_POLICY_ELEMENT);

        // Enabled
        Utility.serializeElement(xmlw, Constants.AnalyticsConstants.ENABLED_ELEMENT, val != null ? Constants.TRUE
                : Constants.FALSE);

        if (val != null) {
            // Days
            Utility.serializeElement(xmlw, Constants.AnalyticsConstants.DAYS_ELEMENT, val.toString());
        }

        // End Retention Policy
        xmlw.endTag(Constants.EMPTY_STRING, Constants.AnalyticsConstants.RETENTION_POLICY_ELEMENT);
    }
Writes the retention policy to the XMLStreamWriter.

@param xmlw
the XMLStreamWriter to write to.
@param val
the nullable Integer indicating if the retention policy is enabled, and how long
@throws IOException
if there is an error writing the service properties.
@throws IllegalStateException
if there is an error writing the service properties.
@throws IllegalArgumentException
if there is an error writing the service properties.