/*
(non-Javadoc)

@see org.restcomm.ss7.management.console.CommandHandler#isValid(java.lang .String)
187396
@Override
    public void handle(CommandContext ctx, String commandLine) {
        // TODO Validate command
        if (commandLine.contains("--help")) {
            this.printHelp(commandLine, ctx);
            return;
        }
        ctx.sendMessage(commandLine);
    }
303515
public static boolean isValid(String name) {
		char[] nameChars = name.toCharArray();
		for (int i = 0; i < nameChars.length; i++) {
			boolean valid = i == 0 ? Character.isJavaIdentifierStart(nameChars[i]) : Character.isJavaIdentifierPart(nameChars[i]);
			if (!valid) {
				return valid;
			}
		}
		return true;
	}
597430
@Override
  public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) {
    final String valueAsString = Objects.toString(pvalue, null);

    if (StringUtils.isEmpty(valueAsString)) {
      // empty field is ok
      return true;
    }
    try {
      String countryCode = BeanUtils.getProperty(pvalue, fieldCountryCode);
      final String phoneNumber = BeanUtils.getProperty(pvalue, fieldPhoneNumber);
      if (StringUtils.isEmpty(phoneNumber)) {
        return true;
      }

      if (allowLowerCaseCountryCode) {
        countryCode = StringUtils.upperCase(countryCode);
      }
      final PathDefinitionInterface pathDefinition = GWT.create(PathDefinitionInterface.class);
      final String url =
          pathDefinition.getRestBasePath() + "/" + PhoneNumber.ROOT + "/" + PhoneNumber.VALIDATE //
              + "?" + Parameters.COUNTRY + "=" + countryCode //
              + "&" + Parameters.PHONE_NUMBER + "=" + urlEncode(phoneNumber) //
              + "&" + Parameters.DIN_5008 + "=" + PhoneNumberValueRestValidator.this.allowDin5008 //
              + "&" + Parameters.E123 + "=" + PhoneNumberValueRestValidator.this.allowE123 //
              + "&" + Parameters.URI + "=" + PhoneNumberValueRestValidator.this.allowUri //
              + "&" + Parameters.MS + "=" + PhoneNumberValueRestValidator.this.allowMs //
              + "&" + Parameters.COMMON + "=" + PhoneNumberValueRestValidator.this.allowCommon;
      final String restResult = CachedSyncHttpGetCall.syncRestCall(url);
      if (StringUtils.equalsIgnoreCase("TRUE", restResult)) {
        return true;
      }
      switchContext(pcontext);
      return false;
    } catch (final Exception ignore) {
      switchContext(pcontext);
      return false;
    }
  }
468604
@Override
    public boolean isValid(Object input) {
        long value;
        try {
            value = Long.parseLong(input.toString());
        } catch (NumberFormatException e) {
            return false;
        }

        if (minAllowedValue != null && value < minAllowedValue)
            return false;
        if (maxAllowedValue != null && value > maxAllowedValue)
            return false;

        return true;
    }
371875
public static boolean isValid(String fodselsnummer) {
		try {
			FodselsnummerValidator.getFodselsnummer(fodselsnummer);
			return true;
		} catch (IllegalArgumentException e) {
			return false;
		}
	}
234061
public static boolean isValid(final String name) {
        if (name == null) {
            return true;
        }
        for (final FileHandlerResult result : INSTANCES) {
            if (result.name.equals(name)) {
                return true;
            }
        }
        return false;
    }
517839
@JsonIgnore
    public boolean isValid() {
        if (kty == null) {
            return false;
        }

        if (keyOps != null) {
            final Set<JsonWebKeyOperation> set = new HashSet<JsonWebKeyOperation>(JsonWebKeyOperation.ALL_OPERATIONS);
            for (int i = 0; i < keyOps.size(); i++) {
                if (!set.contains(keyOps.get(i))) {
                    return false;
                }
            }
        }

        if (JsonWebKeyType.OCT.equals(kty)) {
            return isValidOctet();
        } else if (JsonWebKeyType.RSA.equals(kty)) {
            return isValidRsa();
        } else if (JsonWebKeyType.RSA_HSM.equals(kty)) {
            return isValidRsaHsm();
        } else if (JsonWebKeyType.EC.equals(kty)) {
            return isValidEc();
        } else if (JsonWebKeyType.EC_HSM.equals(kty)) {
            return isValidEcHsm();
        }

        return false;
    }
1256954
@SuppressWarnings("unlikely-arg-type")
	@Override
	@Pure
	public final boolean isValidPrimitive() {
		if (this.invalidityReason != null
				&& this.invalidityReason.equals(BusPrimitiveInvalidityType.VALIDITY_NOT_CHECKED)) {
			checkPrimitiveValidity();
		}
		return this.invalidityReason == null;
	}
171036
@Override
    public boolean isValid(String value, ConstraintValidatorContext context) {
        try {
            this.duracloudUserService.checkUsername(value);
            return false;
        } catch (InvalidUsernameException ex) {
            return false;
        } catch (UserAlreadyExistsException ex) {
            return true;
        }
    }
1040557
public boolean isValid() {
        if (name == null) {
            return false;
        }

        if (type == null || !type.isValid()) {
            return false;
        } else if (type == Type.Link) {
            if (url == null) {
                return false;
            }
        }

        // Check actions
        if (this.getActions() != null) {
            for (DesktopAction a : this.getActions()) {
                if (!a.isValid()) {
                    return false;
                }
            }
        }

        // Everything ok
        return true;
    }
441347
public static boolean isValid(final String value) {
        if (value == null) {
            return true;
        }
        if (value.length() == 0) {
            return false;
        }
        final int space = value.indexOf(' ');
        if (space == -1) {
            return false;
        }

        // Try converting amount
        final String amount = value.substring(0, space);
        if (!(amount.matches(DECIMAL) || amount.matches(INTEGER))) {
            return false;
        }

        // Try to convert code into a currency
        final String currencyCode = value.substring(space + 1);
        try {
            Currency.getInstance(currencyCode);
        } catch (RuntimeException ex) {
            return false;
        }

        return true;
    }
1033073
@Override
  public final boolean isValid(final String pvalue, final ConstraintValidatorContext pcontext) {
    if (StringUtils.isEmpty(pvalue)) {
      return true;
    }
    if (pvalue.length() > LENGTH_CREDIT_CARDNUMBER) {
      // credit card number is to long, but that's handled by size annotation
      return true;
    }
    return CHECK_CREDIT_CARD.isValid(pvalue);
  }
1181138
public boolean isValid(String value) {
    if (value == null) {
      return false;
    }
    for (int i = 0; i < patterns.length; i++) {
      if (patterns[i].matcher(value).matches()) {
        return true;
      }
    }
    return false;
  }
901024
@Override
    public boolean isValid(Object input) {
        long epochMillisec;
        try {
            epochMillisec = Long.parseLong(input.toString());
        } catch (NumberFormatException e) {
            return false;
        }

        if (minValidTime != null && epochMillisec < minValidTime)
            return false;
        return !(maxValidTime != null && epochMillisec > maxValidTime);
    }
483526
@Override
    public boolean isValid(Object input) {
        boolean value;
        try {
            value = Boolean.parseBoolean(input.toString());
        } catch (NumberFormatException e) {
            return false;
        }


        return true;
    }
330757
@Override
    public boolean isValid(T wert) {
        int length = Objects.toString(wert, "").length();
        return (length >= min) && (length <= max);
    }
1254441
public static boolean isValid(@Nullable final String dayOpeningHours) {
        if (dayOpeningHours == null) {
            return true;
        }
        final int p = dayOpeningHours.indexOf(' ');
        if (p < 0) {
            return false;
        }
        final String dayOfTheWeekStr = dayOpeningHours.substring(0, p);
        final String hourRangesStr = dayOpeningHours.substring(p + 1);
        return DayOfTheWeek.isValid(dayOfTheWeekStr) && HourRanges.isValid(hourRangesStr);
    }