org.mapfish.print.ExtraPropertyException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of print-lib Show documentation
Show all versions of print-lib Show documentation
Library for generating PDFs and images from online webmapping services
package org.mapfish.print;
import java.util.Collection;
import java.util.Set;
/**
* Indicates one or more properties are not used either in a config.yaml configuration file or in the request
* json.
*/
public final class ExtraPropertyException extends RuntimeException {
private final Collection extraProperties;
private final Set attributeNames;
/**
* Constructor.
*
* @param message the error message. A textual description of the extra properties. List of names
* will be appended at the end
* @param extraProperties the properties that are extra
* @param attributeNames all the allowed attribute names.
*/
public ExtraPropertyException(
final String message, final Collection extraProperties,
final Set attributeNames) {
super(createMessage(message, extraProperties, attributeNames));
this.extraProperties = extraProperties;
this.attributeNames = attributeNames;
}
private static String createMessage(
final String message, final Collection extraProperties,
final Set attributeNames) {
StringBuilder missingPropertyMessage =
new StringBuilder(message).append("\n").append("Extra Properties: \n");
for (String extraProperty: extraProperties) {
missingPropertyMessage.append("\n\t* ").append(extraProperty);
}
missingPropertyMessage.append("\n\nAll allowed properties are: \n");
for (String attributeName: attributeNames) {
missingPropertyMessage.append("\n\t* ").append(attributeName);
}
return missingPropertyMessage.toString();
}
public Collection getExtraProperties() {
return this.extraProperties;
}
public Set getAttributeNames() {
return this.attributeNames;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy