本文整理汇总了Java中org.intellij.lang.annotations.RegExp类的典型用法代码示例。如果您正苦于以下问题:Java RegExp类的具体用法?Java RegExp怎么用?Java RegExp使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RegExp类属于org.intellij.lang.annotations包,在下文中一共展示了RegExp类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: log4jColumnizer
import org.intellij.lang.annotations.RegExp; //导入依赖的package包/类
private static Columnizer log4jColumnizer() {
ObservableList<ColumnDefinition> columns = FXCollections.observableArrayList();
columns.add(new ColumnDefinition("Date/Time", "datetime", Description.Server.DATE, Width.DATE));
columns.add(new ColumnDefinition("Thread ID", "thread", Description.Server.THREAD_ID));
columns.add(new ColumnDefinition("Severity", "severity", Description.Server.SEVERITY, Width.SEVERITY));
columns.add(new ColumnDefinition("Class", "class", Description.Server.CLASS, Width.CLASS));
columns.add(new ColumnDefinition("Message", "msg", Description.Server.MSG, Width.MSG));
@RegExp
String regex = "(?<datetime>\\S+)" //
+ " \\[(?<thread>[^]]*?)]" //
+ " (?<severity>\\S+)" //
+ "\\s+(?<class>\\S+)" //
+ " - (?<msg>.*)";
@RegExp
String defaultToMsg = "(?<msg>.*)";
ObservableList<String> regexps = FXCollections.observableArrayList(regex, defaultToMsg);
return new Columnizer("Log4j / Logback", columns, regexps);
}
示例2: accessLogColumnizer
import org.intellij.lang.annotations.RegExp; //导入依赖的package包/类
private static Columnizer accessLogColumnizer() {
ObservableList<ColumnDefinition> columnDefinitions = FXCollections.observableArrayList();
columnDefinitions.add(new ColumnDefinition("Client", "client", Description.Access.CLIENT, Width.DOMAIN));
columnDefinitions.add(new ColumnDefinition("Indentity", "identd", Description.Access.IDENTD));
columnDefinitions.add(new ColumnDefinition("User ID", "userid", Description.Access.USERID));
columnDefinitions.add(new ColumnDefinition("Date/Time", "datetime", Description.Access.DATE, Width.DATE));
columnDefinitions.add(new ColumnDefinition("Request", "request", Description.Access.REQUEST, Width.MSG));
columnDefinitions.add(new ColumnDefinition("Rsp. Code", "rstatus", Description.Access.STATUS));
columnDefinitions.add(new ColumnDefinition("Rsp. Size (B)", "rsize", Description.Access.RSIZE));
columnDefinitions.add(new ColumnDefinition("Referer", "referer", Description.Access.REFERER));
columnDefinitions.add(new ColumnDefinition("User-Agent", "useragent", Description.Access.USERAGENT));
@RegExp
String regex = "(?<client>\\S+)" //
+ " (?<identd>\\S+)" //
+ " (?<userid>\\S+)" //
+ " \\[(?<datetime>[^\\]]*?)\\]" //
+ " \"(?<request>[^\"]*?)\"" //
+ " (?<rstatus>\\S+)" //
+ " (?<rsize>\\S+)" //
+ "( \"(?<referer>[^\"]*?)\" \"(?<useragent>[^\"]*?)\")?";
ObservableList<String> regexps = FXCollections.observableArrayList(regex);
return new Columnizer("Common/Combined Log Format (access)", columnDefinitions, regexps);
}
示例3: apacheErrorColumnizer
import org.intellij.lang.annotations.RegExp; //导入依赖的package包/类
private static Columnizer apacheErrorColumnizer() {
ObservableList<ColumnDefinition> columnDefinitions = FXCollections.observableArrayList();
columnDefinitions.add(new ColumnDefinition("Date/Time", "datetime", Width.DATE));
columnDefinitions.add(new ColumnDefinition("Severity", "severity", Width.SEVERITY));
columnDefinitions.add(new ColumnDefinition("Client", "client", Width.DOMAIN));
columnDefinitions.add(new ColumnDefinition("Message", "msg", Width.MSG));
@RegExp
String full = "\\[(?<datetime>[^]]*?)] \\[(?<severity>[^]]*?)] \\[(?<client>[^]]*?)] (?<msg>.*)";
@RegExp
String noClient = "\\[(?<datetime>[^]]*?)] \\[(?<severity>[^]]*?)] (?<msg>.*)";
@RegExp
String noClientNoSev = "\\[(?<datetime>[^]]*?)] (?<msg>.*)";
@RegExp
String defaultToMsg = "(?<msg>.*)";
ObservableList<String> regexps = FXCollections.observableArrayList(full, noClient, noClientNoSev, defaultToMsg);
return new Columnizer("Apache Error Log", columnDefinitions, regexps);
}
示例4: parseActionHint
import org.intellij.lang.annotations.RegExp; //导入依赖的package包/类
@NotNull
public static Pair<String, Boolean> parseActionHint(@NotNull PsiFile file,
@NotNull String contents,
@NotNull @NonNls @RegExp String actionPattern) {
PsiFile hostFile = InjectedLanguageManager.getInstance(file.getProject()).getTopLevelFile(file);
final Commenter commenter = LanguageCommenters.INSTANCE.forLanguage(hostFile.getLanguage());
String comment = commenter.getLineCommentPrefix();
if (comment == null) {
comment = commenter.getBlockCommentPrefix();
}
// "quick fix action text to perform" "should be available"
assert comment != null : commenter;
Pattern pattern = Pattern.compile("^" + comment.replace("*", "\\*") + actionPattern, Pattern.DOTALL);
Matcher matcher = pattern.matcher(contents);
assertTrue("No comment found in "+file.getVirtualFile(), matcher.matches());
final String text = matcher.group(1);
final Boolean actionShouldBeAvailable = Boolean.valueOf(matcher.group(2));
return Pair.create(text, actionShouldBeAvailable);
}
示例5: setValuePattern
import org.intellij.lang.annotations.RegExp; //导入依赖的package包/类
public void setValuePattern(@RegExp @Nullable String pattern) {
try {
if (pattern != null && pattern.length() > 0) {
myValuePattern = pattern;
myCompiledValuePattern = Pattern.compile(pattern, Pattern.DOTALL);
}
else {
myValuePattern = "";
myCompiledValuePattern = null;
}
}
catch (Exception e1) {
myCompiledValuePattern = null;
Logger.getInstance(getClass().getName()).info("Invalid pattern", e1);
}
}
示例6: registerPlayer
import org.intellij.lang.annotations.RegExp; //导入依赖的package包/类
/**
* Adds a player to PlayerManager to handle the given URI pattern.
*
* @param uriPattern the pattern to register with the PlayerManager.
* @param player the player associated with the pattern.
*/
public void registerPlayer(@RegExp String uriPattern, Player player) {
if (players.containsKey(uriPattern)) {
IllegalStateException exception =
new IllegalStateException("Can't have two players registered to the same URI.");
if (QLog.shouldIgnoreIllegalStates()) {
QLog.e(exception, this.getClass().getSimpleName(), exception.getMessage());
} else {
throw exception;
}
} else {
log("Registered to play tracks with URI: " + uriPattern);
players.put(uriPattern, player);
}
}
示例7: unregisterPlayer
import org.intellij.lang.annotations.RegExp; //导入依赖的package包/类
/**
* Removes a player from the PlayerManager that matches the given URI.
*
* @param uriPattern the URI pattern that should no longer be associated with the PlayerManager.
*/
public void unregisterPlayer(@RegExp String uriPattern) {
if (players.containsKey(uriPattern)) {
log(String.format("Player unregistered. URI: %s Name: %s", uriPattern,
players.get(uriPattern).getClass().getSimpleName()));
players.get(uriPattern).release();
players.remove(uriPattern);
} else {
IllegalStateException exception = new IllegalStateException("Player was never registered.");
if (QLog.shouldIgnoreIllegalStates()) {
QLog.e(exception, this.getClass().getSimpleName(), exception.getMessage());
} else {
throw exception;
}
}
}
示例8: parseActionHint
import org.intellij.lang.annotations.RegExp; //导入依赖的package包/类
@NotNull
public static Pair<String, Boolean> parseActionHint(@NotNull PsiFile file, @NotNull String contents, @NotNull @NonNls @RegExp String actionPattern) {
PsiFile hostFile = InjectedLanguageManager.getInstance(file.getProject()).getTopLevelFile(file);
final Commenter commenter = LanguageCommenters.INSTANCE.forLanguage(hostFile.getLanguage());
String comment = commenter.getLineCommentPrefix();
if (comment == null) {
comment = commenter.getBlockCommentPrefix();
}
// "quick fix action text to perform" "should be available"
assert comment != null : commenter;
Pattern pattern = Pattern.compile("^" + comment.replace("*", "\\*") + actionPattern, Pattern.DOTALL);
Matcher matcher = pattern.matcher(contents);
assertTrue("No comment found in "+file.getVirtualFile(), matcher.matches());
final String text = matcher.group(1);
final Boolean actionShouldBeAvailable = Boolean.valueOf(matcher.group(2));
return Pair.create(text, actionShouldBeAvailable);
}
示例9: parseActionHint
import org.intellij.lang.annotations.RegExp; //导入依赖的package包/类
public static Pair<String, Boolean> parseActionHint(final PsiFile file, String contents, @NonNls @RegExp String actionPattern) {
PsiFile hostFile = InjectedLanguageManager.getInstance(LightPlatformTestCase.getProject()).getTopLevelFile(file);
final Commenter commenter = LanguageCommenters.INSTANCE.forLanguage(hostFile.getLanguage());
String comment = commenter.getLineCommentPrefix();
if (comment == null) {
comment = commenter.getBlockCommentPrefix();
}
// "quick fix action text to perform" "should be available"
assert comment != null : commenter;
Pattern pattern = Pattern.compile("^" + comment.replace("*", "\\*") + actionPattern, Pattern.DOTALL);
Matcher matcher = pattern.matcher(contents);
assertTrue("No comment found in "+file.getVirtualFile(), matcher.matches());
final String text = matcher.group(1);
final Boolean actionShouldBeAvailable = Boolean.valueOf(matcher.group(2));
return Pair.create(text, actionShouldBeAvailable);
}
示例10: weblogicEasyTraceColumnizer
import org.intellij.lang.annotations.RegExp; //导入依赖的package包/类
private static Columnizer weblogicEasyTraceColumnizer() {
ObservableList<ColumnDefinition> columns = FXCollections.observableArrayList();
columns.add(new ColumnDefinition("Date/Time", "datetime", Description.Server.DATE, Width.DATE));
columns.add(new ColumnDefinition("Severity", "severity", Description.Server.SEVERITY, Width.SEVERITY));
columns.add(new ColumnDefinition("Subsystem", "subsystem", Description.Server.SUBSYSTEM, false));
columns.add(new ColumnDefinition("Machine Name", "machine", Description.Server.MACHINE_NAME, false));
columns.add(new ColumnDefinition("Server Name", "server", Description.Server.SERVER_NAME, false));
columns.add(new ColumnDefinition("Thread ID", "thread", Description.Server.THREAD_ID, false));
columns.add(new ColumnDefinition("Class", "class", Description.Server.CLASS, Width.CLASS));
columns.add(new ColumnDefinition("Message", "msg", Description.Server.MSG, Width.MSG));
columns.add(new ColumnDefinition("JSessionID", "sessionid", Description.Server.JSESSIONID,
Width.SESSION_ID));
@RegExp
String logStart = "<(?<datetime>[^>]*?)>" //
+ " ?<(?<severity>[^>]*?)>" //
+ " ?<(?<subsystem>[^>]*?)>" //
+ " ?<(?<machine>[^>]*?)>" //
+ " ?<(?<server>[^>]*?)>" //
+ " ?<(?<thread>[^>]*?)>" //
+ "( ?<(?<class>[^>]*?)>)?" //
+ " ?<(?<msg>.*?)" // message start
+ "(;jsessionid=(?<sessionid>[^>]*))?" // optional session id
+ ">?\\s*"; // optional end of message
@RegExp
String logEnd = "(?<msg>.*?)(;jsessionid=(?<sessionid>[^>]*))?>\\s*"; // end of msg and optional session id
@RegExp
String logCenter = "(?<msg>.*)";
ObservableList<String> regexps = FXCollections.observableArrayList(logStart, logEnd, logCenter);
return new Columnizer("Weblogic (processed by EasyTrace)", columns, regexps);
}
示例11: amadeusInputLog
import org.intellij.lang.annotations.RegExp; //导入依赖的package包/类
private static Columnizer amadeusInputLog() {
ObservableList<ColumnDefinition> columnDefinitions = FXCollections.observableArrayList();
columnDefinitions.add(new ColumnDefinition("Date/Time", "date", Width.DATE));
columnDefinitions.add(new ColumnDefinition("Domain", "domain", Width.URL));
columnDefinitions.add(new ColumnDefinition("Action", "action", Width.ENDPOINT));
columnDefinitions.add(new ColumnDefinition("Parameters", "params", Width.PARAMETER_LIST));
@RegExp
String regex = "(?<date>[0-9]{17}).*?(?<domain>http.*)/(?<action>.*?)\\?(?<params>.*)";
ObservableList<String> regexps = FXCollections.observableArrayList(regex);
return new Columnizer("Amadeus input.out", columnDefinitions, regexps);
}
示例12: pregMatch
import org.intellij.lang.annotations.RegExp; //导入依赖的package包/类
@Nullable
private String pregMatch(@Nullable String content, @RegExp String regular) {
if(content == null) {
return null;
}
Matcher matcher = Pattern.compile(regular, Pattern.MULTILINE).matcher(content);
if(matcher.find()){
return matcher.group(1);
}
return null;
}
示例13: NumericPropertyAction
import org.intellij.lang.annotations.RegExp; //导入依赖的package包/类
public NumericPropertyAction(String name, String operation, @RegExp String... pattern)
{
super(name, pattern);
this.operation = operation;
}
示例14: weblogicColumnizer
import org.intellij.lang.annotations.RegExp; //导入依赖的package包/类
private static Columnizer weblogicColumnizer() {
ObservableList<ColumnDefinition> columns = FXCollections.observableArrayList();
columns.add(new ColumnDefinition("Date/Time", "datetime", Description.Server.DATE, Width.DATE));
columns.add(new ColumnDefinition("Severity", "severity", Description.Server.SEVERITY, Width.SEVERITY));
columns.add(new ColumnDefinition("Subsystem", "subsystem", Description.Server.SUBSYSTEM, false));
columns.add(new ColumnDefinition("Machine Name", "machine", Description.Server.MACHINE_NAME, false));
columns.add(new ColumnDefinition("Server Name", "server", Description.Server.SERVER_NAME, false));
columns.add(new ColumnDefinition("Thread ID", "thread", Description.Server.THREAD_ID, false));
columns.add(new ColumnDefinition("User ID", "userId", Description.Server.USER_ID, false));
columns.add(new ColumnDefinition("Transaction ID", "transaction", Description.Server.TRANSACTION, false));
columns.add(new ColumnDefinition("Diagnostic Context ID", "context", Description.Server.DIAGNOSTIC_CTX_ID,
false));
columns.add(new ColumnDefinition("Timestamp", "timestamp", Description.Server.TIMESTAMP, false));
columns.add(new ColumnDefinition("Message ID", "msgId", Description.Server.MSG_ID, false));
columns.add(new ColumnDefinition("Class", "class", Description.Server.CLASS, Width.CLASS));
columns.add(new ColumnDefinition("Message", "msg", Description.Server.MSG, Width.MSG));
columns.add(new ColumnDefinition("JSessionID", "sessionid", Description.Server.JSESSIONID,
Width.SESSION_ID));
@RegExp
String logStart = "####" //
+ "<(?<datetime>[^>]*?)>" //
+ " ?<(?<severity>[^>]*?)>" //
+ " ?<(?<subsystem>[^>]*?)>" //
+ " ?<(?<machine>[^>]*?)>" //
+ " ?<(?<server>[^>]*?)>" //
+ " ?<(?<thread>[^>]*?)>" //
+ " ?<(?<userId>.*?)>" //
+ " ?<(?<transaction>[^>]*?)>" //
+ " ?<(?<context>[^>]*?)>" //
+ " ?<(?<timestamp>[^>]*?)>" //
+ " ?<(?<msgId>[^>]*?)>" //
+ "( ?<(?<class>[^>]*?)>)?" //
+ " ?<(?<msg>.*?)" // message start
+ "(;jsessionid=(?<sessionid>[^>]*))?" // optional session id
+ ">?\\s*"; // optional end of message
@RegExp
String logEnd = "(?<msg>.*?)(;jsessionid=(?<sessionid>[^>]*))?>\\s*"; // end of msg and optional session id
@RegExp
String logCenter = "(?<msg>.*)";
ObservableList<String> regexps = FXCollections.observableArrayList(logStart, logEnd, logCenter);
return new Columnizer("Weblogic Server Log", columns, regexps);
}
示例15: convertAntToRegexp
import org.intellij.lang.annotations.RegExp; //导入依赖的package包/类
@RegExp
@NotNull
public static String convertAntToRegexp(@NotNull String antPattern) {
return convertAntToRegexp(antPattern, true);
}