javax.annotation.RegEx.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(200)

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

RegEx.<init>介绍

暂无

代码示例

代码示例来源:origin: davidmoten/rxjava2-jdbc

static String camelCaseToUnderscore(String camelCased) {
  // guava has best solution for this with CaseFormat class
  // but don't want to add dependency just for this method
  final @RegEx String regex = "([a-z])([A-Z]+)";
  final String replacement = "$1_$2";
  return camelCased.replaceAll(regex, replacement);
}

代码示例来源:origin: com.github.davidmoten/rxjava2-jdbc

static String camelCaseToUnderscore(String camelCased) {
  // guava has best solution for this with CaseFormat class
  // but don't want to add dependency just for this method
  final @RegEx String regex = "([a-z])([A-Z]+)";
  final String replacement = "$1_$2";
  return camelCased.replaceAll(regex, replacement);
}

代码示例来源:origin: com.phloc/phloc-commons-jdk5

@Nonnull
@Nonempty
@RegEx
public String getRegEx ()
{
 return m_sRegEx;
}

代码示例来源:origin: com.helger/ph-validation

@Nonnull
@Nonempty
@RegEx
public String getRegEx ()
{
 return m_sRegEx;
}

代码示例来源:origin: com.phloc/phloc-commons-jdk5

public RegExPattern (@Nonnull @Nonempty @RegEx final String sRegEx) throws IllegalArgumentException
{
 // Default: no options
 this (sRegEx, 0);
}

代码示例来源:origin: com.helger/ph-validation

public StringRegExValidator (@Nonnull @Nonempty @RegEx final String sRegEx)
{
 this (sRegEx, null);
}

代码示例来源:origin: com.phloc/phloc-commons-jdk5

@Nonnull
public static String stringReplacePattern (@Nonnull @RegEx final String sRegEx,
                      @Nonnegative final int nOptions,
                      @Nonnull final String sValue,
                      @Nullable final String sReplacement)
{
 // Avoid NPE on invalid replacement parameter
 return getMatcher (sRegEx, nOptions, sValue).replaceAll (StringHelper.getNotNull (sReplacement));
}

代码示例来源:origin: com.phloc/phloc-commons-jdk5

/**
 * A shortcut helper method to determine whether a string matches a certain
 * regular expression or not.
 * 
 * @param sRegEx
 *        The regular expression to be used. The compiled regular expression
 *        pattern is cached. May neither be <code>null</code> nor empty.
 * @param sValue
 *        The string value to compare against the regular expression.
 * @return <code>true</code> if the string matches the regular expression,
 *         <code>false</code> otherwise.
 */
public static boolean stringMatchesPattern (@Nonnull @RegEx final String sRegEx, @Nonnull final String sValue)
{
 return getMatcher (sRegEx, sValue).matches ();
}

代码示例来源:origin: com.phloc/phloc-commons-jdk5

@Override
@Nullable
@IsLocked (ELockType.WRITE)
protected Pattern getValueToCache (@Nullable @RegEx final RegExPattern aRegEx)
{
 return aRegEx == null ? null : aRegEx.getAsPattern ();
}

代码示例来源:origin: com.phloc/phloc-commons-jdk5

/**
 * Get the Java Matcher object for the passed pair of regular expression and
 * value.
 * 
 * @param sRegEx
 *        The regular expression to use. May neither be <code>null</code> nor
 *        empty.
 * @param sValue
 *        The value to create the matcher for. May not be <code>null</code>.
 * @return A non-<code>null</code> matcher.
 */
@Nonnull
public static Matcher getMatcher (@Nonnull @RegEx final String sRegEx, @Nonnull final String sValue)
{
 ValueEnforcer.notNull (sValue, "Value");
 return RegExPool.getPattern (sRegEx).matcher (sValue);
}

代码示例来源:origin: com.helger/ph-validation

/**
 * Constructor with custom error message.
 *
 * @param sRegEx
 *        Regular expression to use. May neither be <code>null</code> nor
 *        empty.
 * @param aErrorText
 *        Optional error text. May be <code>null</code>.
 */
public StringRegExValidator (@Nonnull @Nonempty @RegEx final String sRegEx,
               @Nullable final IHasDisplayText aErrorText)
{
 ValueEnforcer.notEmpty (sRegEx, "RegEx");
 m_sRegEx = sRegEx;
 m_aErrorText = aErrorText;
}

代码示例来源:origin: com.phloc/phloc-commons-jdk5

/**
 * Split the passed text with the given regular expression. If you do not need
 * a regular expression, {@link StringHelper#getExploded(String, String)} is a
 * faster option.
 * 
 * @param sText
 *        The text to be split. May be <code>null</code>.
 * @param sRegEx
 *        The regular expression to use for splitting. May neither be
 *        <code>null</code> nor empty.
 * @return An empty list if the text is <code>null</code>, a non-
 *         <code>null</code> list otherwise. If both text and regular
 *         expression are <code>null</code> an empty list is returned as well
 *         since the text parameter is checked first.
 */
@Nonnull
public static List <String> getSplitToList (@Nullable final CharSequence sText, @Nonnull @RegEx final String sRegEx)
{
 return ContainerHelper.newList (getSplitToArray (sText, sRegEx));
}

代码示例来源:origin: com.phloc/phloc-commons-jdk5

/**
 * Get the cached regular expression pattern.
 * 
 * @param sRegEx
 *        The regular expression to retrieve. May neither be <code>null</code>
 *        nor empty.
 * @param nOptions
 *        The options used for Pattern.compile
 * @return The compiled regular expression pattern and never <code>null</code>
 *         .
 * @see Pattern#compile(String, int)
 * @throws IllegalArgumentException
 *         If the passed regular expression has an illegal syntax
 */
@Nonnull
public static Pattern getPattern (@Nonnull @Nonempty @RegEx final String sRegEx, @Nonnegative final int nOptions)
{
 return s_aInstance.getFromCache (new RegExPattern (sRegEx, nOptions));
}

代码示例来源:origin: com.phloc/phloc-commons-jdk5

/**
 * Get the cached regular expression pattern.
 * 
 * @param sRegEx
 *        The regular expression to retrieve. May neither be <code>null</code>
 *        nor empty.
 * @return The compiled regular expression pattern and never <code>null</code>
 *         .
 * @throws IllegalArgumentException
 *         If the passed regular expression has an illegal syntax
 */
@Nonnull
public static Pattern getPattern (@Nonnull @Nonempty @RegEx final String sRegEx)
{
 return s_aInstance.getFromCache (new RegExPattern (sRegEx));
}

代码示例来源:origin: neuhalje/bouncy-gpg

public static Matcher<PGPPublicKeyRing> pubKeyRingForUidRegexp(@RegEx final String uidRegexp) {
 return PublicKeyringWithUserIdMatcher.regexp(uidRegexp);
}

代码示例来源:origin: com.phloc/phloc-commons-jdk5

public RegExPattern (@Nonnull @Nonempty @RegEx final String sRegEx, @Nonnegative final int nOptions) throws IllegalArgumentException
{
 ValueEnforcer.notEmpty (sRegEx, "RegEx");
 ValueEnforcer.isGE0 (nOptions, "Options");
 m_sRegEx = sRegEx;
 m_nOptions = nOptions;
 if (areDebugConsistencyChecksEnabled ())
  checkPatternConsistency (sRegEx);
 try
 {
  m_aPattern = Pattern.compile (m_sRegEx, m_nOptions);
 }
 catch (final PatternSyntaxException ex)
 {
  throw new IllegalArgumentException ("Regular expression '" +
                    m_sRegEx +
                    "' is illegal" +
                    (m_nOptions == 0 ? "" : " with options " + m_nOptions), ex);
 }
}

代码示例来源:origin: neuhalje/bouncy-gpg

static PublicKeyringWithUserIdMatcher regexp(@RegEx final String uidRegexp) {
 return new PublicKeyringWithUserIdMatcher(Pattern.compile(uidRegexp));
}

代码示例来源:origin: neuhalje/bouncy-gpg

static SecretKeyringWithUserIdMatcher regexp(@RegEx final String uidRegexp) {
 return new SecretKeyringWithUserIdMatcher(Pattern.compile(uidRegexp));
}

代码示例来源:origin: neuhalje/bouncy-gpg

public static Matcher<PGPSecretKeyRing> secretKeyRingForUidRegexp(@RegEx final String uidRegexp) {
 return SecretKeyringWithUserIdMatcher.regexp(uidRegexp);
}

代码示例来源:origin: com.phloc/phloc-masterdata

public VATINStructure (@Nonnull final String sCountry,
            @Nonnull @RegEx final String sRegEx,
            @Nonnull final Collection <String> aExamples)
{
 ValueEnforcer.notNull (sCountry, "Country");
 ValueEnforcer.notNull (sRegEx, "RegEx");
 ValueEnforcer.notEmpty (aExamples, "Example");
 m_aCountry = CountryCache.getCountry (sCountry);
 if (m_aCountry == null)
  throw new IllegalArgumentException ("country");
 m_sPattern = sRegEx;
 m_aPattern = RegExPool.getPattern (sRegEx);
 m_aExamples = ContainerHelper.newList (aExamples);
 if (GlobalDebug.isDebugMode ())
  for (final String s : m_aExamples)
   if (!isValid (s))
    throw new IllegalArgumentException ("Example VATIN " + s + " does not match " + sRegEx);
}

相关文章

RegEx类方法