Class QueryUtility

java.lang.Object
io.github.eggy03.ferrumx.windows.shell.query.QueryUtility

public class QueryUtility extends Object
A utility class that provides helper methods that use Java reflection

For internal use only

Since:
4.1.0
  • Constructor Details

    • QueryUtility

      public QueryUtility()
  • Method Details

    • getClassNameFromWmiClassAnnotation

      @NotNull public static <T> @NotNull String getClassNameFromWmiClassAnnotation(@NonNull @NonNull Class<T> tClass)

      Retrieves a WmiClass value 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 the WmiClass annotation
    • getPropertiesFromSerializedNameAnnotation

      @NotNull public static <T> @NotNull String getPropertiesFromSerializedNameAnnotation(@NonNull @NonNull Class<T> tClass)
      Retrieves all SerializedName values declared on the fields of the specified class and returns them as a comma-separated string.

      If a field does not declare a SerializedName annotation, 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 SerializedName annotation or the field name if the annotation is absent, in alphabetical order