Class QueryUtility
java.lang.Object
io.github.eggy03.ferrumx.windows.shell.query.QueryUtility
A utility class that provides helper methods that use Java reflection
For internal use only
- Since:
- 4.1.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> @NotNull StringgetClassNameFromWmiClassAnnotation(@NonNull Class<T> tClass) Retrieves aWmiClassvalue declared on the specified class, at class level.static <T> @NotNull StringgetPropertiesFromSerializedNameAnnotation(@NonNull Class<T> tClass) Retrieves allSerializedNamevalues declared on the fields of the specified class and returns them as a comma-separated string.
-
Constructor Details
-
QueryUtility
public QueryUtility()
-
-
Method Details
-
getClassNameFromWmiClassAnnotation
@NotNull public static <T> @NotNull String getClassNameFromWmiClassAnnotation(@NonNull @NonNull Class<T> tClass) Retrieves a
WmiClassvalue declared on the specified class, at class level.- Type Parameters:
T- the type of the class- Parameters:
tClass- the class having the annotation- Returns:
- the annotation value
- Throws:
AnnotationNotFoundException- if the class to be inspected does not have theWmiClassannotation
-
getPropertiesFromSerializedNameAnnotation
@NotNull public static <T> @NotNull String getPropertiesFromSerializedNameAnnotation(@NonNull @NonNull Class<T> tClass) Retrieves allSerializedNamevalues declared on the fields of the specified class and returns them as a comma-separated string.If a field does not declare a
SerializedNameannotation, its actual field name is used instead.The method inspects only fields declared directly within the provided class; inherited fields are not included.
- Type Parameters:
T- the type of the class- Parameters:
tClass- the class whose fields should be inspected- Returns:
- a comma-separated string containing either the "Value" of each
SerializedNameannotation or the field name if the annotation is absent, in alphabetical order
-