Class CriteriaBuilderHelper


  • public class CriteriaBuilderHelper
    extends Object
    This class is used to construct a criteria model based on the OpenNMS' model classes.
    Author:
    Christian Pape
    • Constructor Detail

      • CriteriaBuilderHelper

        public CriteriaBuilderHelper​(Class<?> entityType,
                                     Class<?>... aliasTypes)
        Constructor used to instantiate new objects.
        Parameters:
        entityType - the base entity class
        aliasTypes - the remaining "joined" model classes
    • Method Detail

      • parseCriteriaValue

        public Object parseCriteriaValue​(Class<?> clazz,
                                         String value)
        This method is used for parsing a criteria value.
        Parameters:
        clazz - the type class
        value - the value to be parsed
        Returns:
        a new instance representing the value
      • getTypeOfProperty

        public Class<?> getTypeOfProperty​(String property)
        Returns the type of a given property.
        Parameters:
        property - the property to search for
        Returns:
        the associated type
      • setCriteriaParser

        public void setCriteriaParser​(Class<?> clazz,
                                      CriteriaParser<?> criteriaParser)
        Sets a CriteriaParser for a given class.
        Parameters:
        clazz - the class to be used
        criteriaParser - the CriteriaParser to handle data for the class
      • parseConfiguration

        public void parseConfiguration​(CriteriaBuilder criteriaBuilder,
                                       String configurationString)
        This method parses a criteria configuration and adds the given restrictions to the CriteriaBuilder instance.
        Parameters:
        criteriaBuilder - the CriteriaBuilder to be used
        configurationString - the criteria configuration string
      • dump

        public void dump()
        Dumps all the entities data to System.out.
      • getEntities

        public Set<String> getEntities()
        Returns the entities used in this instance.
        Returns:
        the entities