當前位置: 首頁>>代碼示例>>Java>>正文


Java Pattern.toString方法代碼示例

本文整理匯總了Java中java.util.regex.Pattern.toString方法的典型用法代碼示例。如果您正苦於以下問題:Java Pattern.toString方法的具體用法?Java Pattern.toString怎麽用?Java Pattern.toString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.util.regex.Pattern的用法示例。


在下文中一共展示了Pattern.toString方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getStyledText

import java.util.regex.Pattern; //導入方法依賴的package包/類
/**
 * This returns the label styled text for the adapted class.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public Object getStyledText ( Object object )
{
    Pattern labelValue = ( (Include)object ).getPattern ();
    String label = labelValue == null ? null : labelValue.toString ();
    StyledString styledLabel = new StyledString ();
    if ( label == null || label.length () == 0 )
    {
        styledLabel.append ( getString ( "_UI_Include_type" ), StyledString.Style.QUALIFIER_STYLER ); //$NON-NLS-1$
    }
    else
    {
        styledLabel.append ( getString ( "_UI_Include_type" ), StyledString.Style.QUALIFIER_STYLER ).append ( " " + label ); //$NON-NLS-1$ //$NON-NLS-2$
    }
    return styledLabel;
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:23,代碼來源:IncludeItemProvider.java

示例2: getStyledText

import java.util.regex.Pattern; //導入方法依賴的package包/類
/**
 * This returns the label styled text for the adapted class.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public Object getStyledText ( Object object )
{
    Pattern labelValue = ( (PatternFilter)object ).getPattern ();
    String label = labelValue == null ? null : labelValue.toString ();
    StyledString styledLabel = new StyledString ();
    if ( label == null || label.length () == 0 )
    {
        styledLabel.append ( getString ( "_UI_PatternFilter_type" ), StyledString.Style.QUALIFIER_STYLER ); //$NON-NLS-1$
    }
    else
    {
        styledLabel.append ( getString ( "_UI_PatternFilter_type" ), StyledString.Style.QUALIFIER_STYLER ).append ( " " + label ); //$NON-NLS-1$ //$NON-NLS-2$
    }
    return styledLabel;
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:23,代碼來源:PatternFilterItemProvider.java

示例3: getStyledText

import java.util.regex.Pattern; //導入方法依賴的package包/類
/**
 * This returns the label styled text for the adapted class.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public Object getStyledText ( Object object )
{
    Pattern labelValue = ( (Exclude)object ).getPattern ();
    String label = labelValue == null ? null : labelValue.toString ();
    StyledString styledLabel = new StyledString ();
    if ( label == null || label.length () == 0 )
    {
        styledLabel.append ( getString ( "_UI_Exclude_type" ), StyledString.Style.QUALIFIER_STYLER ); //$NON-NLS-1$
    }
    else
    {
        styledLabel.append ( getString ( "_UI_Exclude_type" ), StyledString.Style.QUALIFIER_STYLER ).append ( " " + label ); //$NON-NLS-1$ //$NON-NLS-2$
    }
    return styledLabel;
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:23,代碼來源:ExcludeItemProvider.java

示例4: getStyledText

import java.util.regex.Pattern; //導入方法依賴的package包/類
/**
 * This returns the label styled text for the adapted class.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public Object getStyledText ( Object object )
{
    Pattern labelValue = ( (ExpressionNodeMappingEntry)object ).getPattern ();
    String label = labelValue == null ? null : labelValue.toString ();
    StyledString styledLabel = new StyledString ();
    if ( label == null || label.length () == 0 )
    {
        styledLabel.append ( getString ( "_UI_ExpressionNodeMappingEntry_type" ), StyledString.Style.QUALIFIER_STYLER ); //$NON-NLS-1$
    }
    else
    {
        styledLabel.append ( getString ( "_UI_ExpressionNodeMappingEntry_type" ), StyledString.Style.QUALIFIER_STYLER ).append ( " " + label ); //$NON-NLS-1$ //$NON-NLS-2$
    }
    return styledLabel;
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:23,代碼來源:ExpressionNodeMappingEntryItemProvider.java

示例5: getStyledText

import java.util.regex.Pattern; //導入方法依賴的package包/類
/**
 * This returns the label styled text for the adapted class.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public Object getStyledText ( Object object )
{
    Pattern labelValue = ( (AknProxy)object ).getPattern ();
    String label = labelValue == null ? null : labelValue.toString ();
    StyledString styledLabel = new StyledString ();
    if ( label == null || label.length () == 0 )
    {
        styledLabel.append ( getString ( "_UI_AknProxy_type" ), StyledString.Style.QUALIFIER_STYLER ); //$NON-NLS-1$
    }
    else
    {
        styledLabel.append ( getString ( "_UI_AknProxy_type" ), StyledString.Style.QUALIFIER_STYLER ).append ( " " + label ); //$NON-NLS-1$ //$NON-NLS-2$
    }
    return styledLabel;
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:23,代碼來源:AknProxyItemProvider.java

示例6: testAllCapsFilter

import java.util.regex.Pattern; //導入方法依賴的package包/類
@Test
public void testAllCapsFilter() throws Exception {
    Pattern pattern = AllCapsFilter.getBasePattern(2);

    for (int i = 0; i < TEST_ITERATIONS; i++) {
        for (int j = 0; j < WORDS_PER_SENTENCE; j++) {
            for (int k = 0; k < UNIQUE_CHARACTERS_PER_WORD; k++) {
                for (int l = 0; l < MIN_CHARACTERS_PER_CHARACTER; l++) {
                    char c = (char) (random.nextInt(26) + 'A');

                    this.builder.append(c);
                }
            }

            builder.append(j == WORDS_PER_SENTENCE - 1 ? "" : " ");
        }

        String errorMessage = "testAllCapsFilter() failed with [" + builder.toString() + "] and pattern [" + pattern.toString() + "]";
        assertTrue(errorMessage, pattern.matcher(builder.toString()).find());
    }
}
 
開發者ID:OvercastNetwork,項目名稱:ChatModerator,代碼行數:22,代碼來源:AllCapsTest.java

示例7: testRepeatedCharactersFilter

import java.util.regex.Pattern; //導入方法依賴的package包/類
@Test
public void testRepeatedCharactersFilter() throws Exception {
    Pattern pattern = RepeatedCharactersFilter.generatePattern(RepeatedCharacterTest.MIN_CHARACTERS);

    for (int i = 0; i < RepeatedCharacterTest.TEST_ITERATIONS; i++) {
        for (int j = 0; j < WORDS_PER_SENTENCE; j++) {
            for (int k = 0; k < UNIQUE_CHARACTERS_PER_WORD; k++) {
                char c = (char) (random.nextInt(26) + 'a');

                for (int l = 0; l < OCCURRENCES_PER_CHARACTER; l++) {
                    builder.append(c);
                }
            }

            builder.append(j == WORDS_PER_SENTENCE - 1 ? "" : " ");
        }

        String errorMessage = "testRepeatedCharactersFilter() failed with [" + builder.toString() + "] and pattern [" + pattern.toString() + "]";
        assertTrue(errorMessage, pattern.matcher(builder.toString()).find());
    }
}
 
開發者ID:OvercastNetwork,項目名稱:ChatModerator,代碼行數:22,代碼來源:RepeatedCharacterTest.java

示例8: serialize

import java.util.regex.Pattern; //導入方法依賴的package包/類
@Override
public JsonElement serialize(Pattern src, Type typeOfSrc, JsonSerializationContext context) {
    if (src == null) {
        return null;
    }
    return new JsonPrimitive(src.toString());
}
 
開發者ID:Chikachi,項目名稱:DiscordIntegrationCore,代碼行數:8,代碼來源:PatternAdapter.java

示例9: getTextFor

import java.util.regex.Pattern; //導入方法依賴的package包/類
protected String getTextFor ( final Pattern pattern )
{
    if ( pattern == null )
    {
        return null;
    }
    else
    {
        return pattern.toString ();
    }
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:12,代碼來源:RuleItemProvider.java

示例10: CustomObjectInputStream

import java.util.regex.Pattern; //導入方法依賴的package包/類
/**
 * Construct a new instance of CustomObjectInputStream with filtering of
 * deserialized classes.
 *
 * @param stream The input stream we will read from
 * @param classLoader The class loader used to instantiate objects
 * @param log The logger to use to report any issues. It may only be null if
 *            the filterMode does not require logging
 * @param allowedClassNamePattern The regular expression to use to filter
 *                                deserialized classes. The fully qualified
 *                                class name must match this pattern for
 *                                deserialization to be allowed if filtering
 *                                is enabled.
 * @param warnOnFailure Should any failures be logged?
 *
 * @exception IOException if an input/output error occurs
 */
public CustomObjectInputStream(InputStream stream, ClassLoader classLoader,
        Log log, Pattern allowedClassNamePattern, boolean warnOnFailure)
        throws IOException {
    super(stream);
    if (log == null && allowedClassNamePattern != null && warnOnFailure) {
        throw new IllegalArgumentException(
                sm.getString("customObjectInputStream.logRequired"));
    }
    this.classLoader = classLoader;
    this.log = log;
    this.allowedClassNamePattern = allowedClassNamePattern;
    if (allowedClassNamePattern == null) {
        this.allowedClassNameFilter = null;
    } else {
        this.allowedClassNameFilter = allowedClassNamePattern.toString();
    }
    this.warnOnFailure = warnOnFailure;

    Set<String> reportedClasses;
    synchronized (reportedClassCache) {
        reportedClasses = reportedClassCache.get(classLoader);
        if (reportedClasses == null) {
            reportedClasses = Collections.newSetFromMap(new ConcurrentHashMap<String,Boolean>());
            reportedClassCache.put(classLoader, reportedClasses);
        }
    }
    this.reportedClasses = reportedClasses;
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:46,代碼來源:CustomObjectInputStream.java

示例11: parse

import java.util.regex.Pattern; //導入方法依賴的package包/類
@Override
public String parse(Grammar rules, String source)
    throws FormatException {
    Pattern pattern =
        Pattern.compile("^https?\\://[a-zA-Z0-9\\-\\.]+(\\.[a-zA-Z]{2,3})?\\:[0-9]{4}(/\\S*)?$");
    Matcher matcher = pattern.matcher(source);
    if (!matcher.find()) {
        throw new FormatException("Bad host name '%s': %s", source,
            "Should match pattern: " + pattern.toString());
    } else {
        return source;
    }
}
 
開發者ID:meteoorkip,項目名稱:JavaGraph,代碼行數:14,代碼來源:EncodedHostName.java

示例12: CustomObjectInputStream

import java.util.regex.Pattern; //導入方法依賴的package包/類
/**
 * Construct a new instance of CustomObjectInputStream with filtering of
 * deserialized classes.
 *
 * @param stream
 *            The input stream we will read from
 * @param classLoader
 *            The class loader used to instantiate objects
 * @param log
 *            The logger to use to report any issues. It may only be null if
 *            the filterMode does not require logging
 * @param allowedClassNamePattern
 *            The regular expression to use to filter deserialized classes.
 *            The fully qualified class name must match this pattern for
 *            deserialization to be allowed if filtering is enabled.
 * @param warnOnFailure
 *            Should any failures be logged?
 *
 * @exception IOException
 *                if an input/output error occurs
 */
public CustomObjectInputStream(InputStream stream, ClassLoader classLoader, Log log,
		Pattern allowedClassNamePattern, boolean warnOnFailure) throws IOException {
	super(stream);
	if (log == null && allowedClassNamePattern != null && warnOnFailure) {
		throw new IllegalArgumentException(sm.getString("customObjectInputStream.logRequired"));
	}
	this.classLoader = classLoader;
	this.log = log;
	this.allowedClassNamePattern = allowedClassNamePattern;
	if (allowedClassNamePattern == null) {
		this.allowedClassNameFilter = null;
	} else {
		this.allowedClassNameFilter = allowedClassNamePattern.toString();
	}
	this.warnOnFailure = warnOnFailure;

	Set<String> reportedClasses;
	synchronized (reportedClassCache) {
		reportedClasses = reportedClassCache.get(classLoader);
		if (reportedClasses == null) {
			reportedClasses = Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>());
			reportedClassCache.put(classLoader, reportedClasses);
		}
	}
	this.reportedClasses = reportedClasses;
}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:48,代碼來源:CustomObjectInputStream.java


注:本文中的java.util.regex.Pattern.toString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。