Example usage for org.apache.wicket.util.lang Bytes compareTo

List of usage examples for org.apache.wicket.util.lang Bytes compareTo

Introduction

In this page you can find the example usage for org.apache.wicket.util.lang Bytes compareTo.

Prototype

@Override
public final int compareTo(final LongValue that) 

Source Link

Document

Compares this Object to a given Object.

Usage

From source file:org.hippoecm.frontend.plugins.yui.upload.validation.DefaultUploadValidationService.java

License:Apache License

private void validateMaxFileSize(final FileUpload upload) {
    Bytes fileSize = Bytes.bytes(upload.getSize());

    final Bytes maxFileSize = Bytes.valueOf(values.getString(MAX_FILE_SIZE, getDefaultMaxFileSize()));
    if (maxFileSize.compareTo(fileSize) == -1) {
        addViolation("file.validation.size", upload.getClientFileName(), fileSize.toString(),
                maxFileSize.toString());

        if (log.isDebugEnabled()) {
            log.debug("File '{}' has size {} which is too big. The maximum size allowed is {}",
                    upload.getClientFileName(), fileSize.toString(), maxFileSize.toString());
        }// w  w w  .  j  a va 2 s . co m
    }
}