Example usage for org.apache.commons.validator GenericValidator isByte

List of usage examples for org.apache.commons.validator GenericValidator isByte

Introduction

In this page you can find the example usage for org.apache.commons.validator GenericValidator isByte.

Prototype

public static boolean isByte(String value) 

Source Link

Document

Checks if the value can safely be converted to a byte primitive.

Usage

From source file:com.core.validators.CommonValidator.java

/**
 * Checks if the field can be successfully converted to a <code>byte</code>.
 *
 * @param    value       The value validation is being performed on.
 * @return   boolean      If the field can be successfully converted 
 *                           to a <code>byte</code> <code>true</code> is returned.  
 *                           Otherwise <code>false</code>.
 *///from  ww w .j  a  va 2s  .  co m
public static boolean validateByte(Object bean, Field field) {
    String value = ValidatorUtils.getValueAsString(bean, field.getProperty());

    return GenericValidator.isByte(value);
}