com.swak.license.api.LicenseValidationException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of swak-license-core Show documentation
Show all versions of swak-license-core Show documentation
swak component of trueLicense core
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; }
}