code: @Override
    public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) {
      final String valueAsString = Objects.toString(pvalue, null);
      if (StringUtils.isEmpty(valueAsString)) {
        return true;
      }
      if (!StringUtils.isNumeric(valueAsString)) {
        // EAN must be numeric, but that's handled by digits annotation
        return true;
      }
      if (valueAsString.length() != Gtin8Validator.GTIN8_LENGTH
          && valueAsString.length() != Gtin13Validator.GTIN13_LENGTH) {
        // EAN size is wrong, but that's handled by alternate size annotation
        return true;
      }
      // calculate and check checksum (GTIN/EAN)
      return CHECK_GTIN.isValid(valueAsString);
    }
docs: {@inheritDoc} check if given string is a valid gtin.
  
  @see javax.validation.ConstraintValidator#isValid(java.lang.Object,
  javax.validation.ConstraintValidatorContext)