Class InspectionManager


  • public class InspectionManager
    extends Object
    A class for managing the inspections
    Author:
    Tim Neumann
    • Constructor Detail

      • InspectionManager

        public InspectionManager()
        Create a new inspection manager.
    • Method Detail

      • getAttributeNamesOfEntity

        public List<String> getAttributeNamesOfEntity​(Entity entity)
        Get's all attribute names of the given entity.
        Parameters:
        entity - The entity to get the names for
        Returns:
        A List of attribute names.
      • getMethodNamesOfEntity

        public List<String> getMethodNamesOfEntity​(Entity entity)
        Get's all method names of the given entity.
        Parameters:
        entity - The entity to get the names for
        Returns:
        A List of method names.
      • isAttributeEditable

        public boolean isAttributeEditable​(Entity entity,
                                           String attributeName)
        Checks whether the attribute with the given name in the given entity is writable.
        Parameters:
        entity - The entity.
        attributeName - The name of the attribute
        Returns:
        Whether the attribute is writable.
      • getAttributeType

        public Class<?> getAttributeType​(Entity entity,
                                         String attributeName)
        Get's the type of the attribute with the given name in the given entity.
        Parameters:
        entity - The entity.
        attributeName - The name of the attribute
        Returns:
        The type of the attribute.
      • getAttributeValue

        public Object getAttributeValue​(Entity entity,
                                        String attributeName)
        Get the value of the attribute with the given name from the given entity
        Parameters:
        entity - The entity to get the value from
        attributeName - The name of the attribute to get the value from
        Returns:
        The value or null if it didn't work.
      • setAttributeValue

        public boolean setAttributeValue​(Entity entity,
                                         String attributeName,
                                         Object value)
        Set the value of the attribute with the given name in the given entity
        Parameters:
        entity - The entity to set the value in
        attributeName - The name of the attribute to set the value for.
        value - The value to set.
        Returns:
        Whether it worked.
      • getMethodDetail

        public Method getMethodDetail​(Entity entity,
                                      String methodName)
        Get the detail of the method with the given name of the given name.
        Parameters:
        entity - The entity to get the method of.
        methodName - The name of the method to get.
        Returns:
        The method detail.
      • invokeMethod

        public Object invokeMethod​(Entity entity,
                                   String methodName,
                                   Object... args)
        Invokes the method with the given name on the given entity. Uses the given arguments.
        Parameters:
        entity - The entity to invoke the method in.
        methodName - The name of the method to invoke.
        args - The arguments for the method invocation.
        Returns:
        The return value of the method.
        Throws:
        IllegalStateException - When anything goes wrong.