Package org.webkitgtk
Class WebExtensionMatchPattern
java.lang.Object
org.javagi.base.ProxyInstance
org.webkitgtk.WebExtensionMatchPattern
- All Implemented Interfaces:
Proxy
Represents a way to specify a group of URLs for use in WebExtensions.
All match patterns are specified as strings. Apart from the special <all_urls> pattern, match patterns
consist of three parts: scheme, host, and path.
Generally, match patterns are returned from a WebKitWebExtension.
- Since:
- 2.48
-
Constructor Summary
ConstructorsConstructorDescriptionWebExtensionMatchPattern(MemorySegment address) Create a WebExtensionMatchPattern proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionstatic WebExtensionMatchPatternReturns a newWebKitWebExtensionMatchPatternthat has*for scheme, host, and path.static WebExtensionMatchPatternallUrls()Returns a newWebKitWebExtensionMatchPatternfor<all_urls>.getHost()Gets the host part of the pattern string, unlesswebkit_web_extension_match_pattern_get_matches_all_urlsistrue.booleanGets whether the match pattern matches all host.booleanGets whether the match pattern matches all URLs, in other words, whether the pattern is<all_urls>.getPath()Gets the path part of the pattern string, unlessgetMatchesAllUrls()istrue.Gets the scheme part of the pattern string, unlesswebkit_web_extension_match_pattern_get_matches_all_urlsistrue.Gets the original pattern string.static @Nullable TypegetType()Get the GType of the WebExtensionMatchPattern classbooleanmatchesPattern(WebExtensionMatchPattern pattern, Set<WebExtensionMatchPatternOptions> options) Matches the this WebExtensionMatchPattern against the specifiedpatternwith options.booleanmatchesPattern(WebExtensionMatchPattern pattern, WebExtensionMatchPatternOptions... options) Matches the this WebExtensionMatchPattern against the specifiedpatternwith options.booleanmatchesUrl(String url, Set<WebExtensionMatchPatternOptions> options) Matches the this WebExtensionMatchPattern against the specified URL with options.booleanmatchesUrl(String url, WebExtensionMatchPatternOptions... options) Matches the this WebExtensionMatchPattern against the specified URL with options.ref()Atomically acquires a reference on the givenmatchPattern.static voidregisterCustomURLScheme(String urlScheme) Registers a custom URL scheme that can be used in match patterns.voidunref()Atomically releases a reference on the givenmatchPattern.static WebExtensionMatchPatternwithScheme(String scheme, String host, String path) Returns a newWebKitWebExtensionMatchPatternfor the specifiedscheme,host,andpathstrings.static WebExtensionMatchPatternwithString(String string) Returns a newWebKitWebExtensionMatchPatternfor the specifiedstring.Methods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
WebExtensionMatchPattern
Create a WebExtensionMatchPattern proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
-
Method Details
-
getType
Get the GType of the WebExtensionMatchPattern class- Returns:
- the GType
-
allHostsAndSchemes
Returns a newWebKitWebExtensionMatchPatternthat has*for scheme, host, and path.- Returns:
- a newly created
WebKitWebExtensionMatchPattern - Since:
- 2.48
-
allUrls
Returns a newWebKitWebExtensionMatchPatternfor<all_urls>.- Returns:
- a newly created
WebKitWebExtensionMatchPattern - Since:
- 2.48
-
withScheme
public static WebExtensionMatchPattern withScheme(String scheme, String host, String path) throws GErrorException Returns a newWebKitWebExtensionMatchPatternfor the specifiedscheme,host,andpathstrings.- Parameters:
scheme- A pattern URL schemehost- A pattern URL hostpath- A pattern URL path- Returns:
- a newly created
WebKitWebExtensionMatchPattern, ornullif any of the pattern strings are invalid. - Throws:
GErrorException- seeGError- Since:
- 2.48
-
withString
Returns a newWebKitWebExtensionMatchPatternfor the specifiedstring.- Parameters:
string- A pattern string- Returns:
- a newly created
WebKitWebExtensionMatchPattern, ornullif the pattern string is invalid. - Throws:
GErrorException- seeGError- Since:
- 2.48
-
registerCustomURLScheme
Registers a custom URL scheme that can be used in match patterns.This method should be used to register any custom URL schemes used by the app for the extension base URLs, other than
webkit-extension, or if extensions should have access to other supported URL schemes when using<all_urls>.- Parameters:
urlScheme- The custom URL scheme to register- Since:
- 2.48
-
getHost
Gets the host part of the pattern string, unlesswebkit_web_extension_match_pattern_get_matches_all_urlsistrue.- Returns:
- The host string.
- Since:
- 2.48
-
getMatchesAllHosts
public boolean getMatchesAllHosts()Gets whether the match pattern matches all host. This happens when the pattern is<all_urls>, or if*is set as the host string.- Returns:
- Whether this match pattern matches all hosts.
- Since:
- 2.48
-
getMatchesAllUrls
public boolean getMatchesAllUrls()Gets whether the match pattern matches all URLs, in other words, whether the pattern is<all_urls>.- Returns:
- Whether this match pattern matches all URLs.
- Since:
- 2.48
-
getPath
Gets the path part of the pattern string, unlessgetMatchesAllUrls()istrue.- Returns:
- The path string.
- Since:
- 2.48
-
getScheme
Gets the scheme part of the pattern string, unlesswebkit_web_extension_match_pattern_get_matches_all_urlsistrue.- Returns:
- The scheme string.
- Since:
- 2.48
-
getString
Gets the original pattern string.- Returns:
- The original pattern string.
- Since:
- 2.48
-
matchesPattern
public boolean matchesPattern(WebExtensionMatchPattern pattern, Set<WebExtensionMatchPatternOptions> options) Matches the this WebExtensionMatchPattern against the specifiedpatternwith options.- Parameters:
pattern- TheWebKitWebExtensionMatchPatternto match withmatchPattern.options- TheWebKitWebExtensionMatchPatternOptionsuse while matching.- Returns:
- Whether the pattern matches the specified
pattern. - Since:
- 2.48
-
matchesPattern
public boolean matchesPattern(WebExtensionMatchPattern pattern, WebExtensionMatchPatternOptions... options) Matches the this WebExtensionMatchPattern against the specifiedpatternwith options.- Parameters:
pattern- TheWebKitWebExtensionMatchPatternto match withmatchPattern.options- TheWebKitWebExtensionMatchPatternOptionsuse while matching.- Returns:
- Whether the pattern matches the specified
pattern. - Since:
- 2.48
-
matchesUrl
Matches the this WebExtensionMatchPattern against the specified URL with options.- Parameters:
url- The URL to match against the pattern.options- TheWebKitWebExtensionMatchPatternOptionsuse while matching.- Returns:
- Whether the pattern matches the specified URL.
- Since:
- 2.48
-
matchesUrl
Matches the this WebExtensionMatchPattern against the specified URL with options.- Parameters:
url- The URL to match against the pattern.options- TheWebKitWebExtensionMatchPatternOptionsuse while matching.- Returns:
- Whether the pattern matches the specified URL.
- Since:
- 2.48
-
ref
Atomically acquires a reference on the givenmatchPattern.This function is MT-safe and may be called from any thread.
- Returns:
- The same this WebExtensionMatchPattern with an additional reference.
- Since:
- 2.48
-
unref
public void unref()Atomically releases a reference on the givenmatchPattern.If the reference was the last, the resources associated to the this WebExtensionMatchPattern are freed. This function is MT-safe and may be called from any thread.
- Since:
- 2.48
-