All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.swak.license.api.LicenseValidationException Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (C) 2005 - 2019 Schlichtherle IT Services.
 * All rights reserved. Use is subject to license terms.
 */
package com.swak.license.api;


import com.swak.license.api.i18n.Message;

import java.util.Locale;

import static java.util.Objects.requireNonNull;

/**
 * Indicates that a
 * {@linkplain LicenseValidation#validate(License) license validation} failed.
 */
public class LicenseValidationException extends LicenseManagementException {

    private static final long serialVersionUID = 0L;

    private final Message msg;


    /**
     * Constructs a license validation exception with the given
     * internationalized message.
     *
     * @param msg the internationalized message.
     */
    public LicenseValidationException(final Message msg) {
        this.msg = requireNonNull(msg);
    }

    @Override
    public String getMessage() { return msg.toString(Locale.ROOT); }

    @Override
    public String getLocalizedMessage() {
        return msg.toString(Locale.getDefault());
    }

    /**
     * Returns {@code true} if this exception is considered confidential and
     * should not be shared with users.
     * 

* The implementation in the class {@code LicenseValidationException} * returns {@code false}. */ @Override public boolean isConfidential() { return false; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy