Java Assert assertValidSwfValue(String value)

Here you can find the source of assertValidSwfValue(String value)

Description

Assert the value passes the constraints for SWF fields like name, version, domain, taskList, identifiers.

License

Open Source License

Parameter

Parameter Description
value to assert

Return

the parameter for method chaining

Declaration

public static String assertValidSwfValue(String value) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/* www  .j a  v  a 2  s.co m*/
     * Assert the value passes the constraints for SWF fields like name, version, domain, taskList, identifiers.
     *
     * @param value to assert
     *
     * @return the parameter for method chaining
     */
    public static String assertValidSwfValue(String value) {
        if (value != null) {
            if (value.length() == 0) {
                throw new AssertionError("Empty value not allowed");
            }
            if (value.matches("\\s.*|.*\\s")
                    || value.matches(".*[:/|\\u0000-\\u001f\\u007f-\\u009f].*")
                    || value.contains("arn")) {
                throw new AssertionError(
                        "Value contains one or more bad characters: '"
                                + value + "'");
            }
        }
        return value;
    }
}

Related

  1. assertValidBrowserType(int aBrowserType)
  2. assertValidColumnName(String name)
  3. assertValidItemName(String itemName)
  4. assertValidKeys(Iterable keys)
  5. assertValidRange(String name, double value, double min, double max)
  6. assertValueSize(final int expectedSize, final int got)
  7. assertXYPlanesCorrectlyOriented(final int[] dimIndices)