Class TriggerTypeIdResolver

  • All Implemented Interfaces:
    com.fasterxml.jackson.databind.jsontype.TypeIdResolver

    public class TriggerTypeIdResolver
    extends java.lang.Object
    implements com.fasterxml.jackson.databind.jsontype.TypeIdResolver
    Jackson TypeIdResolver (works out which class to create for different JSON file IDs) which understands curator triggers. We use this to make the JSON config file look a bit nicer (remove common suffixes) and to load different classes depending on the context.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private com.fasterxml.jackson.databind.JavaType baseType
      A Jackson object we need to store from the init method to use later in typeFromId) - Not really sure what it's for.
      private static java.lang.String CLASS_SUFFIX
      Standard suffix (stripped in config files) for the Trigger class names
      private static java.lang.String TRIGGER_IMPLEMENTATION_PACKAGE
      Triggers in pubilcui-web - To support triggers which require pulicui-web dependencies these are loaded in preference.
      private static java.lang.String TRIGGER_PACKAGE
      Triggers in pubilcui-core - In some cases these cannot be run because they lack publicui-web dependencies
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getDescForKnownTypeIds()  
      com.fasterxml.jackson.annotation.JsonTypeInfo.Id getMechanism()  
      java.lang.String idFromBaseType()  
      java.lang.String idFromValue​(java.lang.Object value)
      Tell Jackson what 'ID' to put in the file for a given object
      java.lang.String idFromValueAndType​(java.lang.Object value, java.lang.Class<?> suggestedType)
      Tell Jackson what 'ID' to put in the file for a given object and it's type
      void init​(com.fasterxml.jackson.databind.JavaType baseType)  
      com.fasterxml.jackson.databind.JavaType typeFromId​(com.fasterxml.jackson.databind.DatabindContext context, java.lang.String id)
      Tell Jackson what class to instantiate for a given ID form a JSON file
      • Methods inherited from class java.lang.Object

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

      • TRIGGER_PACKAGE

        private static final java.lang.String TRIGGER_PACKAGE
        Triggers in pubilcui-core - In some cases these cannot be run because they lack publicui-web dependencies
        See Also:
        Constant Field Values
      • TRIGGER_IMPLEMENTATION_PACKAGE

        private static final java.lang.String TRIGGER_IMPLEMENTATION_PACKAGE
        Triggers in pubilcui-web - To support triggers which require pulicui-web dependencies these are loaded in preference.
        See Also:
        Constant Field Values
      • CLASS_SUFFIX

        private static final java.lang.String CLASS_SUFFIX
        Standard suffix (stripped in config files) for the Trigger class names
        See Also:
        Constant Field Values
      • baseType

        private com.fasterxml.jackson.databind.JavaType baseType
        A Jackson object we need to store from the init method to use later in typeFromId) - Not really sure what it's for.
    • Constructor Detail

      • TriggerTypeIdResolver

        public TriggerTypeIdResolver()
    • Method Detail

      • init

        public void init​(com.fasterxml.jackson.databind.JavaType baseType)
        Specified by:
        init in interface com.fasterxml.jackson.databind.jsontype.TypeIdResolver
      • idFromValue

        public java.lang.String idFromValue​(java.lang.Object value)
        Tell Jackson what 'ID' to put in the file for a given object
        Specified by:
        idFromValue in interface com.fasterxml.jackson.databind.jsontype.TypeIdResolver
      • idFromValueAndType

        public java.lang.String idFromValueAndType​(java.lang.Object value,
                                                   java.lang.Class<?> suggestedType)
        Tell Jackson what 'ID' to put in the file for a given object and it's type
        Specified by:
        idFromValueAndType in interface com.fasterxml.jackson.databind.jsontype.TypeIdResolver
      • typeFromId

        public com.fasterxml.jackson.databind.JavaType typeFromId​(com.fasterxml.jackson.databind.DatabindContext context,
                                                                  java.lang.String id)
        Tell Jackson what class to instantiate for a given ID form a JSON file
        Specified by:
        typeFromId in interface com.fasterxml.jackson.databind.jsontype.TypeIdResolver
      • getMechanism

        public com.fasterxml.jackson.annotation.JsonTypeInfo.Id getMechanism()
        Specified by:
        getMechanism in interface com.fasterxml.jackson.databind.jsontype.TypeIdResolver
      • idFromBaseType

        public java.lang.String idFromBaseType()
        Specified by:
        idFromBaseType in interface com.fasterxml.jackson.databind.jsontype.TypeIdResolver
      • getDescForKnownTypeIds

        public java.lang.String getDescForKnownTypeIds()
        Specified by:
        getDescForKnownTypeIds in interface com.fasterxml.jackson.databind.jsontype.TypeIdResolver