当前位置: 首页>>代码示例>>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;未经允许,请勿转载。