Package org.gnome.gio
Class FileAttributeMatcher
java.lang.Object
org.javagi.base.ProxyInstance
org.gnome.gio.FileAttributeMatcher
-
Constructor Summary
ConstructorsConstructorDescriptionFileAttributeMatcher(MemorySegment address) Create a FileAttributeMatcher proxy instance for the provided memory address.FileAttributeMatcher(String attributes) Creates a new file attribute matcher, which matches attributes against a given string. -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if the matcher will match all of the keys in a given namespace.@Nullable StringGets the next matched attribute from aGFileAttributeMatcher.static @Nullable TypegetType()Get the GType of the FileAttributeMatcher classbooleanChecks if an attribute will be matched by an attribute matcher.booleanmatchesOnly(String attribute) Checks if an attribute matcher only matches a given attribute.ref()References a file attribute matcher.@Nullable FileAttributeMatchersubtract(@Nullable FileAttributeMatcher subtract) Subtracts all attributes ofsubtractfrom this FileAttributeMatcher and returns a matcher that supports those attributes.toString()Prints what the matcher is matching against.voidunref()Unreferencesmatcher.If the reference count falls below 1, the this FileAttributeMatcher is automatically freed.Methods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
FileAttributeMatcher
Create a FileAttributeMatcher proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
FileAttributeMatcher
Creates a new file attribute matcher, which matches attributes against a given string.GFileAttributeMatchersare reference counted structures, and are created with a reference count of 1. If the number of references falls to 0, theGFileAttributeMatcheris automatically destroyed.The
attributesstring should be formatted with specific keys separated from namespaces with a double colon. Several "namespace::key" strings may be concatenated with a single comma (e.g. "standard::type,standard::is-hidden"). The wildcard "*" may be used to match all keys and namespaces, or "namespace::*" will match all keys in a given namespace.Examples of file attribute matcher strings and results
"*": matches all attributes."standard::is-hidden": matches only the key is-hidden in the standard namespace."standard::type,unix::*": matches the type key in the standard namespace and all keys in the unix namespace.
- Parameters:
attributes- an attribute string to match.
-
-
Method Details
-
getType
Get the GType of the FileAttributeMatcher class- Returns:
- the GType
-
enumerateNamespace
Checks if the matcher will match all of the keys in a given namespace. This will always returntrueif a wildcard character is in use (e.g. if matcher was created with "standard::*" andnsis "standard", or if matcher was created using "*" and namespace is anything.)TODO: this is awkwardly worded.
- Parameters:
ns- a string containing a file attribute namespace.- Returns:
trueif the matcher matches all of the entries in the givenns,falseotherwise.
-
enumerateNext
Gets the next matched attribute from aGFileAttributeMatcher.- Returns:
- a string containing the next attribute or,
nullif no more attribute exist.
-
matches
Checks if an attribute will be matched by an attribute matcher. If the matcher was created with the "*" matching string, this function will always returntrue.- Parameters:
attribute- a file attribute key.- Returns:
trueifattributematchesmatcher.falseotherwise.
-
matchesOnly
Checks if an attribute matcher only matches a given attribute. Always returnsfalseif "*" was used when creating the matcher.- Parameters:
attribute- a file attribute key.- Returns:
trueif the matcher only matchesattribute.falseotherwise.
-
ref
References a file attribute matcher.- Returns:
- a
GFileAttributeMatcher.
-
subtract
Subtracts all attributes ofsubtractfrom this FileAttributeMatcher and returns a matcher that supports those attributes.Note that currently it is not possible to remove a single attribute when the this FileAttributeMatcher matches the whole namespace - or remove a namespace or attribute when the matcher matches everything. This is a limitation of the current implementation, but may be fixed in the future.
- Parameters:
subtract- The matcher to subtract- Returns:
- A file attribute matcher matching all attributes of
this FileAttributeMatcher that are not matched by
subtract
-
toString
Prints what the matcher is matching against. The format will be equal to the format passed to g_file_attribute_matcher_new(). The output however, might not be identical, as the matcher may decide to use a different order or omit needless parts. -
unref
public void unref()Unreferencesmatcher.If the reference count falls below 1, the this FileAttributeMatcher is automatically freed.
-