Class ParamSpec
- All Implemented Interfaces:
Proxy
- Direct Known Subclasses:
ParamArray,ParamFraction,ParamSpec.ParamSpec$Impl,ParamSpecBoolean,ParamSpecBoxed,ParamSpecChar,ParamSpecDouble,ParamSpecEnum,ParamSpecExpression,ParamSpecFlags,ParamSpecFloat,ParamSpecGType,ParamSpecInt,ParamSpecInt64,ParamSpecLong,ParamSpecObject,ParamSpecOverride,ParamSpecParam,ParamSpecPointer,ParamSpecString,ParamSpecUChar,ParamSpecUInt,ParamSpecUInt64,ParamSpecULong,ParamSpecUnichar,ParamSpecValueArray,ParamSpecVariant
GParamSpec encapsulates the metadata required to specify parameters, such as GObject properties.
Parameter names
A property name consists of one or more segments consisting of ASCII letters
and digits, separated by either the - or _ character. The first
character of a property name must be a letter. These are the same rules as
for signal naming (see GObjects.signalNew(java.lang.String, org.gnome.glib.Type, java.util.Set<org.gnome.gobject.SignalFlags>, int, org.gnome.gobject.SignalAccumulator, org.gnome.gobject.SignalCMarshaller, org.gnome.glib.Type, int, java.lang.Object...)).
When creating and looking up a GParamSpec, either separator can be
used, but they cannot be mixed. Using - is considerably more
efficient, and is the ‘canonical form’. Using _ is discouraged.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThe ParamSpec$Impl type represents a native instance of the abstract ParamSpec class.static classThe class structure for the GParamSpec type. -
Constructor Summary
ConstructorsConstructorDescriptionParamSpec(MemorySegment address) Create a ParamSpec proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected ParamSpecasParent()Returns this instance as if it were its parent type.protected voidThe instance finalization function (optional), should chain up to the finalize method of the parent class.@Nullable StringgetBlurb()Get the short description of aGParamSpec.Gets the default value of this ParamSpec as a pointer to aGValue.static MemoryLayoutThe memory layout of the native struct.getName()Get the name of aGParamSpec.Gets the GQuark for the name.getNick()Get the nickname of aGParamSpec.@Nullable MemorySegmentGets back user data pointers stored via g_param_spec_set_qdata().@Nullable ParamSpecIf the paramspec redirects operations to another paramspec, returns that paramspec.static TypegetType()Get the GType of the GParamSpec class.static ParamSpecinternal(Type paramType, String name, @Nullable String nick, @Nullable String blurb, Set<ParamFlags> flags) Creates a newGParamSpecinstance.static ParamSpecinternal(Type paramType, String name, @Nullable String nick, @Nullable String blurb, ParamFlags... flags) Creates a newGParamSpecinstance.static booleanisValidName(String name) Validate a property name for aGParamSpec.ref()Increments the reference count ofpspec.refSink()Convenience function to ref and sink aGParamSpec.voidsetQdata(Quark quark, @Nullable MemorySegment data) Sets an opaque, named pointer on aGParamSpec.voidsetQdataFull(Quark quark, @Nullable MemorySegment data) This function works like g_param_spec_set_qdata(), but in addition, avoid (*destroy) (gpointer)function may be specified which is called withdataas argument when the this ParamSpec is finalized, or the data is being overwritten by a call to g_param_spec_set_qdata() with the samequark.voidsink()The initial reference count of a newly createdGParamSpecis 1, even though no one has explicitly called g_param_spec_ref() on it yet.@Nullable MemorySegmentstealQdata(Quark quark) Gets back user data pointers stored via g_param_spec_set_qdata() and removes thedatafrom this ParamSpec without invoking its destroy() function (if any was set).voidunref()Decrements the reference count of apspec.protected booleanvalueIsValid(Value value) Checks if contents ofvaluecomply with the specifications set out by this type, without modifying the value.protected intComparesvalue1withvalue2according to this type (recommended, the default is memcmp()), see g_param_values_cmp().protected voidvalueSetDefault(Value value) Resets avalueto the default value for this type (recommended, the default is g_value_reset()), see g_param_value_set_default().protected booleanvalueValidate(Value value) Ensures that the contents ofvaluecomply with the specifications set out by this type (optional), see g_param_value_validate().Methods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
ParamSpec
Create a ParamSpec proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuperkeyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName(). This will call the native function pointer of this virtual method in the typeclass of the parent type. -
internal
public static ParamSpec internal(Type paramType, String name, @Nullable String nick, @Nullable String blurb, Set<ParamFlags> flags) Creates a newGParamSpecinstance.See
GObject.ParamSpec#parameter-namesfor details of the rules forname.Names which violate these rules lead to undefined behaviour.Beyond the name,
GParamSpecshave two more descriptive strings, thenickandblurb,which may be used as a localized label and description. For GTK and related libraries these are considered deprecated and may be omitted, while for other libraries such as GStreamer and its plugins they are essential. When in doubt, follow the conventions used in the surrounding code and supporting libraries.- Parameters:
paramType- theGTypefor the property; must be derived fromG_TYPE_PARAMname- the canonical name of the propertynick- the nickname of the propertyblurb- a short description of the propertyflags- a combination ofGParamFlags- Returns:
- (transfer floating): a newly allocated
GParamSpecinstance, which is initially floating
-
internal
public static ParamSpec internal(Type paramType, String name, @Nullable String nick, @Nullable String blurb, ParamFlags... flags) Creates a newGParamSpecinstance.See
GObject.ParamSpec#parameter-namesfor details of the rules forname.Names which violate these rules lead to undefined behaviour.Beyond the name,
GParamSpecshave two more descriptive strings, thenickandblurb,which may be used as a localized label and description. For GTK and related libraries these are considered deprecated and may be omitted, while for other libraries such as GStreamer and its plugins they are essential. When in doubt, follow the conventions used in the surrounding code and supporting libraries.- Parameters:
paramType- theGTypefor the property; must be derived fromG_TYPE_PARAMname- the canonical name of the propertynick- the nickname of the propertyblurb- a short description of the propertyflags- a combination ofGParamFlags- Returns:
- (transfer floating): a newly allocated
GParamSpecinstance, which is initially floating
-
isValidName
Validate a property name for aGParamSpec. This can be useful for dynamically-generated properties which need to be validated at run-time before actually trying to create them.See
GObject.ParamSpec#parameter-namesfor details of the rules for valid names.- Parameters:
name- the canonical name of the property- Returns:
trueifnameis a valid property name,falseotherwise.- Since:
- 2.66
-
getBlurb
Get the short description of aGParamSpec.- Returns:
- the short description of
pspec.
-
getDefaultValue
Gets the default value of this ParamSpec as a pointer to aGValue.The
GValuewill remain valid for the life ofpspec.- Returns:
- a pointer to a
GValuewhich must not be modified - Since:
- 2.38
-
getName
Get the name of aGParamSpec.The name is always an "interned" string (as per g_intern_string()). This allows for pointer-value comparisons.
- Returns:
- the name of
pspec.
-
getNameQuark
Gets the GQuark for the name.- Returns:
- the GQuark for
pspec>name. - Since:
- 2.46
-
getNick
-
getQdata
Gets back user data pointers stored via g_param_spec_set_qdata().- Parameters:
quark- aGQuark, naming the user data pointer- Returns:
- the user data pointer set, or
null
-
getRedirectTarget
If the paramspec redirects operations to another paramspec, returns that paramspec. Redirect is used typically for providing a new implementation of a property in a derived type while preserving all the properties from the parent type. Redirection is established by creating a property of typeGParamSpecOverride. See g_object_class_override_property() for an example of the use of this capability.- Returns:
- paramspec to which requests on this
paramspec should be redirected, or
nullif none. - Since:
- 2.4
-
ref
Increments the reference count ofpspec.- Returns:
- the
GParamSpecthat was passed into this function
-
refSink
Convenience function to ref and sink aGParamSpec.- Returns:
- the
GParamSpecthat was passed into this function - Since:
- 2.10
-
setQdata
Sets an opaque, named pointer on aGParamSpec. The name is specified through aGQuark(retrieved e.g. via g_quark_from_static_string()), and the pointer can be gotten back from the this ParamSpec with g_param_spec_get_qdata(). Setting a previously set user data pointer, overrides (frees) the old pointer set, usingnullas pointer essentially removes the data stored.- Parameters:
quark- aGQuark, naming the user data pointerdata- an opaque user data pointer
-
setQdataFull
This function works like g_param_spec_set_qdata(), but in addition, avoid (*destroy) (gpointer)function may be specified which is called withdataas argument when the this ParamSpec is finalized, or the data is being overwritten by a call to g_param_spec_set_qdata() with the samequark.- Parameters:
quark- aGQuark, naming the user data pointerdata- an opaque user data pointer
-
sink
public void sink()The initial reference count of a newly createdGParamSpecis 1, even though no one has explicitly called g_param_spec_ref() on it yet. So the initial reference count is flagged as "floating", until someone callsg_param_spec_ref (pspec); g_param_spec_sink (pspec);in sequence on it, taking over the initial reference count (thus ending up with a this ParamSpec that has a reference count of 1 still, but is not flagged "floating" anymore). -
stealQdata
Gets back user data pointers stored via g_param_spec_set_qdata() and removes thedatafrom this ParamSpec without invoking its destroy() function (if any was set). Usually, calling this function is only required to update user data pointers with a destroy notifier.- Parameters:
quark- aGQuark, naming the user data pointer- Returns:
- the user data pointer set, or
null
-
unref
public void unref()Decrements the reference count of apspec. -
finalize_
protected void finalize_()The instance finalization function (optional), should chain up to the finalize method of the parent class. -
valueIsValid
Checks if contents ofvaluecomply with the specifications set out by this type, without modifying the value. This vfunc is optional. If it isn't set, GObject will usevalueValidate.Since 2.74 -
valueSetDefault
Resets avalueto the default value for this type (recommended, the default is g_value_reset()), see g_param_value_set_default(). -
valueValidate
Ensures that the contents ofvaluecomply with the specifications set out by this type (optional), see g_param_value_validate(). -
valuesCmp
-