Package org.gnome.webkit
Class WebExtensionMatchPattern
java.lang.Object
io.github.jwharm.javagi.base.ProxyInstance
org.gnome.webkit.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
-
Field Summary
Fields inherited from class io.github.jwharm.javagi.base.ProxyInstance
address
-
Constructor Summary
ConstructorsConstructorDescriptionWebExtensionMatchPattern
(MemorySegment address) Create a WebExtensionMatchPattern proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionstatic WebExtensionMatchPattern
Returns a newWebKitWebExtensionMatchPattern
that has*
for scheme, host, and path.static WebExtensionMatchPattern
allUrls()
Returns a newWebKitWebExtensionMatchPattern
for<all_urls>
.getHost()
Gets the host part of the pattern string, unlesswebkit_web_extension_match_pattern_get_matches_all_urls
istrue
.boolean
Gets whether the match pattern matches all host.boolean
Gets 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_urls
istrue
.Gets the original pattern string.static Type
getType()
Get the GType of the WebExtensionMatchPattern classboolean
matchesPattern
(WebExtensionMatchPattern pattern, Set<WebExtensionMatchPatternOptions> options) Matches the this WebExtensionMatchPattern against the specifiedpattern
with options.boolean
matchesPattern
(WebExtensionMatchPattern pattern, WebExtensionMatchPatternOptions... options) Matches the this WebExtensionMatchPattern against the specifiedpattern
with options.boolean
matchesUrl
(String url, Set<WebExtensionMatchPatternOptions> options) Matches the this WebExtensionMatchPattern against the specified URL with options.boolean
matchesUrl
(String url, WebExtensionMatchPatternOptions... options) Matches the this WebExtensionMatchPattern against the specified URL with options.ref()
Atomically acquires a reference on the given this WebExtensionMatchPattern.static void
registerCustomURLScheme
(String urlScheme) Registers a custom URL scheme that can be used in match patterns.void
unref()
Atomically releases a reference on the given this WebExtensionMatchPattern.static WebExtensionMatchPattern
withScheme
(String scheme, String host, String path) Returns a newWebKitWebExtensionMatchPattern
for the specifiedscheme
,host
, andpath
strings.static WebExtensionMatchPattern
withString
(String string) Returns a newWebKitWebExtensionMatchPattern
for the specifiedstring
.Methods inherited from class io.github.jwharm.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
-
allHostsAndSchemes
Returns a newWebKitWebExtensionMatchPattern
that has*
for scheme, host, and path.- Returns:
- a newly created
WebKitWebExtensionMatchPattern
- Throws:
UnsupportedPlatformException
- when run on a platform other than linux- Since:
- 2.48
-
allUrls
Returns a newWebKitWebExtensionMatchPattern
for<all_urls>
.- Returns:
- a newly created
WebKitWebExtensionMatchPattern
- Throws:
UnsupportedPlatformException
- when run on a platform other than linux- Since:
- 2.48
-
withScheme
public static WebExtensionMatchPattern withScheme(String scheme, String host, String path) throws GErrorException Returns a newWebKitWebExtensionMatchPattern
for the specifiedscheme
,host
, andpath
strings.- Parameters:
scheme
- A pattern URL schemehost
- A pattern URL hostpath
- A pattern URL path- Returns:
- a newly created
WebKitWebExtensionMatchPattern
, ornull
if any of the pattern strings are invalid. - Throws:
GErrorException
- seeGError
UnsupportedPlatformException
- when run on a platform other than linux- Since:
- 2.48
-
withString
Returns a newWebKitWebExtensionMatchPattern
for the specifiedstring
.- Parameters:
string
- A pattern string- Returns:
- a newly created
WebKitWebExtensionMatchPattern
, ornull
if the pattern string is invalid. - Throws:
GErrorException
- seeGError
UnsupportedPlatformException
- when run on a platform other than linux- 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- Throws:
UnsupportedPlatformException
- when run on a platform other than linux- Since:
- 2.48
-
getHost
Gets the host part of the pattern string, unlesswebkit_web_extension_match_pattern_get_matches_all_urls
istrue
.- 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_urls
istrue
.- 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 specifiedpattern
with options.- Parameters:
pattern
- TheWebKitWebExtensionMatchPattern
to match with this WebExtensionMatchPattern.options
- TheWebKitWebExtensionMatchPatternOptions
use 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 specifiedpattern
with options.- Parameters:
pattern
- TheWebKitWebExtensionMatchPattern
to match with this WebExtensionMatchPattern.options
- TheWebKitWebExtensionMatchPatternOptions
use 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
- TheWebKitWebExtensionMatchPatternOptions
use 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
- TheWebKitWebExtensionMatchPatternOptions
use while matching.- Returns:
- Whether the pattern matches the specified URL.
- Since:
- 2.48
-
ref
Atomically acquires a reference on the given this WebExtensionMatchPattern.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 given this WebExtensionMatchPattern.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
-