public LegendInfo build() { // let's see if we need to really on the default values for width, height and format Integer finalWidth = width == null ? defaultWidth : width; Integer finalHeight = height == null ? defaultHeight : height; String finalFormat = format == null ? defaultFormat : format; // checking mandatory format value checkNotNull(finalFormat, "A legend image format is mandatory."); // default styles can have a NULL name String finalStyleName = styleName == null ? "" : styleName; // building the legend url String finalUrl = buildFinalUrl(finalStyleName, finalWidth, finalHeight, finalFormat); return new LegendInfo( finalStyleName, finalWidth, finalHeight, finalFormat, finalUrl, minScale, maxScale); }