gpt4 book ai didi

com.googlecode.streamflyer.internal.thirdparty.ZzzValidate类的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 12:27:16 31 4
gpt4 key购买 nike

本文整理了Java中com.googlecode.streamflyer.internal.thirdparty.ZzzValidate类的一些代码示例,展示了ZzzValidate类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZzzValidate类的具体详情如下:
包路径:com.googlecode.streamflyer.internal.thirdparty.ZzzValidate
类名称:ZzzValidate

ZzzValidate介绍

[英]This class assists in validating arguments.

The class is based along the lines of JUnit. If an argument value is deemed invalid, an IllegalArgumentException is thrown. For example:

Validate.isTrue(i > 0, "The value must be greater than zero: ", i); 
Validate.notNull(surname, "The surname must not be null");

[中]此类帮助验证参数。
这个类是基于JUnit的。如果参数值被视为无效,则抛出IllegalArgumentException。例如:

Validate.isTrue(i > 0, "The value must be greater than zero: ", i); 
Validate.notNull(surname, "The surname must not be null");

代码示例

代码示例来源:origin: com.googlecode.streamflyer/streamflyer-core

public ModificationFactoryDecorator(ModificationFactory delegate) {
  super();
  ZzzValidate.notNull(delegate, "delegate must not be null");
  this.delegate = delegate;
}

代码示例来源:origin: com.googlecode.streamflyer/streamflyer-core

/**
 * @param minimumLengthOfLookBehind
 * @param newNumberOfChars
 */
public ModificationFactory(int minimumLengthOfLookBehind, int newNumberOfChars) {
  ZzzValidate.isGreaterThanZero(newNumberOfChars, "newNumberOfChars");
  ZzzValidate.isZeroOrPositiveNumber(minimumLengthOfLookBehind, "minimumLengthOfLookBehind");
  this.minimumLengthOfLookBehind = minimumLengthOfLookBehind;
  this.newNumberOfChars = newNumberOfChars;
}

代码示例来源:origin: com.googlecode.streamflyer/streamflyer-core

public TokenProcessor(List<Token> tokens) {
  super();
  ZzzValidate.isNotEmpty(tokens, "tokens");
  this.tokens = tokens;
}

代码示例来源:origin: com.googlecode.streamflyer/streamflyer-core

/**
 * Validates that the given collection is not empty.
 * 
 * @param collection
 * @param collectionName
 */
public static void isNotEmpty(Collection<?> collection, String collectionName) {
  notNull(collection, collectionName + " must not be null");
  isTrue(!collection.isEmpty(), collectionName + " must not be empty");
}

代码示例来源:origin: com.googlecode.streamflyer/streamflyer-core

/**
 * Use this method if you
 * <ul>
 * <li>either want to skip some characters (SKIP) or don't skip any characters as there are no modifiable characters
 * in the buffer left but the end of stream is not hit (SKIP), or
 * <li>don't skip any characters as there are no modifiable characters in the buffer left and the end of stream is
 * hit (STOP).
 * </ul>
 * 
 * @param numberOfCharactersToSkip
 *            the number of characters to skip. This must greater than zero unless the end of the stream is hit or
 *            the buffer does not contain modifiable characters.
 * @param characterBuffer
 * @param firstModifiableCharacterInBuffer
 * @param endOfStreamHit
 *            See parameter in {@link Modifier#modify(StringBuilder, int, boolean)}.
 * @return Returns a modification that skips some characters (SKIP), i.e. marks them as not modifiable, or returns a
 *         STOP.
 */
public AfterModification skipOrStop(int numberOfCharactersToSkip, StringBuilder characterBuffer,
    int firstModifiableCharacterInBuffer, boolean endOfStreamHit) {
  if (endOfStreamHit && characterBuffer.length() - firstModifiableCharacterInBuffer == 0) {
    ZzzValidate.isTrue(numberOfCharactersToSkip == 0, "numberOfCharactersToSkip must be zero");
    return stop(characterBuffer, firstModifiableCharacterInBuffer, endOfStreamHit);
  } else {
    return skip(numberOfCharactersToSkip, characterBuffer, firstModifiableCharacterInBuffer, endOfStreamHit);
  }
}

代码示例来源:origin: com.googlecode.streamflyer/streamflyer-core

protected void init(int numberOfCharactersToSkip_, boolean modifyAgainImmediately_,
    int newMinimumLengthOfLookBehind_, int newNumberOfChars_) {
  ZzzValidate.isZeroOrPositiveNumber(numberOfCharactersToSkip_, "numberOfCharactersToSkip");
  ZzzValidate.isZeroOrPositiveNumber(newMinimumLengthOfLookBehind_, "minimumLengthOfLookBehind");
  // (newNumberOfChars should not be zero if end of stream is
  // not hit but we cannot check this constraint here as in this method we
  // don't know whether the end of stream is hit.)
  ZzzValidate.isZeroOrPositiveNumber(newNumberOfChars_, "newNumberOfChars_");
  if (modifyAgainImmediately && numberOfCharactersToSkip_ != 0) {
    throw new IllegalArgumentException("if modify again immediately,"
        + " the number of characters to skip are ignored .. "
        + "so why is the number of characters to skip " + numberOfCharactersToSkip_ + " instead of zero?");
  }
  this.numberOfCharactersToSkip = numberOfCharactersToSkip_;
  this.modifyAgainImmediately = modifyAgainImmediately_;
  this.newMinimumLengthOfLookBehind = newMinimumLengthOfLookBehind_;
  this.newNumberOfChars = newNumberOfChars_;
}

代码示例来源:origin: com.googlecode.streamflyer/streamflyer-core

int firstModifiableCharacterInBuffer, boolean endOfStreamHit) {
ZzzValidate.isTrue(!endOfStreamHit, "endOfStreamHit must not be false");

代码示例来源:origin: com.googlecode.streamflyer/streamflyer-core

/**
 * <p>
 * Validate that the specified argument is not <code>null</code>; otherwise throwing an exception.
 * 
 * <pre>
 * Validate.notNull(myObject);
 * </pre>
 * <p>
 * The message of the exception is &quot;The validated object is null&quot;.
 * </p>
 * 
 * @param object
 *            the object to check
 * @throws IllegalArgumentException
 *             if the object is <code>null</code>
 */
public static void notNull(Object object) {
  notNull(object, "The validated object is null");
}

代码示例来源:origin: com.googlecode.streamflyer/streamflyer-core

/**
 * This token matches the given regex and the match will be processed with the given {@link MatchProcessor}.
 * 
 * @param name
 *            See {@link #name}
 * @param regex
 *            The regex describes how a token can be matched. Embed flags via {@link EmbeddedFlagUtil}.
 * @param matchProcessor
 */
public Token(String name, String regex, MatchProcessor matchProcessor) {
  super();
  ZzzValidate.notNull(matchProcessor, "matchProcessor must not be null");
  this.name = name;
  this.regex = regex;
  this.matchProcessor = matchProcessor;
  this.capturingGroupCount = Pattern.compile(regex).matcher("").groupCount();
}

代码示例来源:origin: com.googlecode.streamflyer/streamflyer-core

public XmlVersionModifier(String xmlVersion, int newNumberOfChars) {
  ZzzValidate.notNull(xmlVersion, "xmlVersion must not be null");
  this.factory = new ModificationFactory(0, newNumberOfChars);
  this.xmlVersion = xmlVersion;
}

代码示例来源:origin: com.googlecode.streamflyer/streamflyer-core

/**
 * @param replacement
 */
public ReplacingProcessor(String replacement) {
  super();
  // validate arguments
  ZzzValidate.notNull(replacement, "replacement must not be null");
  // parse replacement
  this.parts = parseReplacement(replacement);
  if (parts.size() == 1 && (parts.get(0) instanceof CharSequence)) {
    this.replacementWithoutGroupReferences = (CharSequence) parts.get(0);
  } else {
    this.replacementWithoutGroupReferences = null;
  }
}

代码示例来源:origin: com.googlecode.streamflyer/streamflyer-core

/**
 * @param newNumberOfChars
 * @param replacement
 *            the string that shall replace invalid XML characters. This string may contain "$0" which refers to the
 *            replaced character, see {@link Matcher#replaceAll(String)}
 * @param xmlVersion
 *            Must not be <code>null</code>.
 * @param dollarZero
 */
public InvalidXmlCharacterModifier(int newNumberOfChars, String replacement, String xmlVersion, boolean dollarZero) {
  ZzzValidate.notNull(replacement, "replacement must not be null");
  ZzzValidate.notNull(xmlVersion, "xmlVersion must not be null");
  this.factory = new ModificationFactory(0, newNumberOfChars);
  this.replacement = replacement;
  this.dollarZero = dollarZero;
  // initialize matcher
  Pattern pattern;
  if (XML_10_VERSION.equals(xmlVersion)) {
    pattern = Pattern.compile(getInvalidXmlCharacterRegex_Xml10());
  } else if (XML_11_VERSION.equals(xmlVersion)) {
    pattern = Pattern.compile(getInvalidXmlCharacterRegex_Xml11());
  } else {
    throw new IllegalArgumentException("xmlVersion has the illegal " + "(or unsupported) value " + xmlVersion);
  }
  this.matcher = pattern.matcher("");
}

代码示例来源:origin: com.googlecode.streamflyer/streamflyer-core

public PositionOrientedModifier(Map<Long, Change> modifications) {
  ZzzValidate.notNull(modifications, "modifications must not be null");
  this.modifications = modifications;
  this.factory = new PositionAwareModificationFactory(new ModificationFactory(3, 10));
}

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com