本文整理匯總了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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());
}
}
示例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());
}
}
示例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());
}
示例9: getTextFor
import java.util.regex.Pattern; //導入方法依賴的package包/類
protected String getTextFor ( final Pattern pattern )
{
if ( pattern == null )
{
return null;
}
else
{
return pattern.toString ();
}
}
示例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;
}
示例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;
}
}
示例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;
}