class PackageURLStringConverter implements AttributeConverter<PackageURL, String> {

    private static final Logger LOGGER = Logger.getLogger(PackageURLStringConverter.class);

    /**
     * {@inheritDoc}
     */
    public PackageURL convertToAttribute(final String str) {<FILL_FUNCTION_BODY>}

    /**
     * {@inheritDoc}
     */
    public String convertToDatastore(final PackageURL url) {
        return url != null ? url.canonicalize() : null;
    }
}

        if (str == null) {
            return null;
        }

        try {
            return new PackageURL(str.trim());
        } catch (MalformedPackageURLException e) {
            LOGGER.warn("A persisted object with a PackageURL string in the datastore failed validation and is not valid. Returning null for: " + str);
        }
        return null;
    
<no_super_class>