Class Utilities


  • public class Utilities
    extends java.lang.Object
    Author:
    Collin Alpert
    • Constructor Summary

      Constructors 
      Constructor Description
      Utilities()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T extends BaseEntity>
      java.util.ArrayList<java.lang.reflect.Field>
      getAllFields​(T instance)  
      static <T extends BaseEntity>
      java.util.ArrayList<java.lang.reflect.Field>
      getAllFields​(T instance, boolean includeForeignKeys)  
      static <T extends BaseEntity>
      java.util.ArrayList<java.lang.reflect.Field>
      getAllFields​(T instance, java.lang.Class<?> delimiter)  
      static <T extends BaseEntity>
      java.util.ArrayList<java.lang.reflect.Field>
      getAllFields​(T instance, java.lang.Class<?> delimiter, boolean includeForeignKeys)
      Gets all fields of an entity including all base classes.
      static void log​(java.lang.Object text)
      Prints messages to the query, while considering the LOG_QUERIES constant.
      static void logf​(java.lang.String text, java.lang.Object... params)
      Prints formatted messages to the query, while considering the LOG_QUERIES constant.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Utilities

        public Utilities()
    • Method Detail

      • getAllFields

        public static <T extends BaseEntity> java.util.ArrayList<java.lang.reflect.Field> getAllFields​(T instance)
      • getAllFields

        public static <T extends BaseEntity> java.util.ArrayList<java.lang.reflect.Field> getAllFields​(T instance,
                                                                                                       boolean includeForeignKeys)
      • getAllFields

        public static <T extends BaseEntity> java.util.ArrayList<java.lang.reflect.Field> getAllFields​(T instance,
                                                                                                       java.lang.Class<?> delimiter)
      • getAllFields

        public static <T extends BaseEntity> java.util.ArrayList<java.lang.reflect.Field> getAllFields​(T instance,
                                                                                                       java.lang.Class<?> delimiter,
                                                                                                       boolean includeForeignKeys)
        Gets all fields of an entity including all base classes.
        Type Parameters:
        T - The type of the entity.
        Parameters:
        instance - The instance to get the fields of.
        delimiter - Up to which parent class to go to.
        includeForeignKeys - Decides if to include foreign key objects in this list, since they do not exist on the database.
        Returns:
        A list with all fields of this class and its parents, up to the delimiter class.
      • log

        public static void log​(java.lang.Object text)
        Prints messages to the query, while considering the LOG_QUERIES constant.
        Parameters:
        text - The message to print.
      • logf

        public static void logf​(java.lang.String text,
                                java.lang.Object... params)
        Prints formatted messages to the query, while considering the LOG_QUERIES constant.
        Parameters:
        text - The formatted text.
        params - The parameters to be inserted into the string.