Class CriteriaBuilderHelper


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

      Constructors 
      Constructor Description
      CriteriaBuilderHelper​(java.lang.Class<?> entityType, java.lang.Class<?>... aliasTypes)
      Constructor used to instantiate new objects.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String decode​(java.lang.String string)  
      void dump()
      Dumps all the entities data to System.out.
      static java.lang.String encode​(java.lang.String string)  
      java.util.Set<java.lang.String> getEntities()
      Returns the entities used in this instance.
      java.lang.Class<?> getTypeOfProperty​(java.lang.String property)
      Returns the type of a given property.
      void parseConfiguration​(CriteriaBuilder criteriaBuilder, java.lang.String configurationString)
      This method parses a criteria configuration and adds the given restrictions to the CriteriaBuilder instance.
      java.lang.Object parseCriteriaValue​(java.lang.Class<?> clazz, java.lang.String value)
      This method is used for parsing a criteria value.
      void setCriteriaParser​(java.lang.Class<?> clazz, CriteriaParser<?> criteriaParser)
      Sets a CriteriaParser for a given class.
      • Methods inherited from class java.lang.Object

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

      • CriteriaBuilderHelper

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

      • parseCriteriaValue

        public java.lang.Object parseCriteriaValue​(java.lang.Class<?> clazz,
                                                   java.lang.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 java.lang.Class<?> getTypeOfProperty​(java.lang.String property)
        Returns the type of a given property.
        Parameters:
        property - the property to search for
        Returns:
        the associated type
      • setCriteriaParser

        public void setCriteriaParser​(java.lang.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,
                                       java.lang.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
      • decode

        public static java.lang.String decode​(java.lang.String string)
      • encode

        public static java.lang.String encode​(java.lang.String string)
      • dump

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

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