Class TeamAppsJacksonTypeIdResolver

java.lang.Object
org.teamapps.dto.TeamAppsJacksonTypeIdResolver
All Implemented Interfaces:
com.fasterxml.jackson.databind.jsontype.TypeIdResolver

public class TeamAppsJacksonTypeIdResolver
extends java.lang.Object
implements com.fasterxml.jackson.databind.jsontype.TypeIdResolver
This TypeIdResolver provides type ids for all TeamApps UI API classes. Additionally it also provides type ids for all classes that get serialized, so they can be deserialized in the future.

Ratio: Components are allowed to send and receive.

On the sending side, this enables app developers to send arbitrary data for templates. E.g., a MustacheTemplate might be filled using a list of deep json structures.

On the receiving side, this is technically not necessary, since all data that comes from UiComponents might be defined as UiObjects. However, component developers might decide to send back arbitrary object (in original or changed state) that were previously sent to the client. This approach is not recommended but possible. Since only classes that have ever been serialized can be deserialized, there is no security risk in technically allowing Object values (unless developers send security critical classes, which we regard as very unlikely).

  • Constructor Summary

    Constructors 
    Constructor Description
    TeamAppsJacksonTypeIdResolver()  
  • Method Summary

    Modifier and Type Method Description
    java.lang.String getDescForKnownTypeIds()  
    com.fasterxml.jackson.annotation.JsonTypeInfo.Id getMechanism()  
    java.lang.String idFromBaseType()  
    java.lang.String idFromClass​(java.lang.Class clazz)  
    java.lang.String idFromValue​(java.lang.Object obj)  
    java.lang.String idFromValueAndType​(java.lang.Object obj, java.lang.Class<?> clazz)  
    void init​(com.fasterxml.jackson.databind.JavaType baseType)  
    static java.lang.String registerPojoClass​(java.lang.Class clazz)  
    com.fasterxml.jackson.databind.JavaType typeFromId​(com.fasterxml.jackson.databind.DatabindContext context, java.lang.String id)  

    Methods inherited from class java.lang.Object

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

  • Method Details

    • registerPojoClass

      public static java.lang.String registerPojoClass​(java.lang.Class clazz)
    • init

      public void init​(com.fasterxml.jackson.databind.JavaType baseType)
      Specified by:
      init 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
    • idFromClass

      public java.lang.String idFromClass​(java.lang.Class clazz)
    • idFromValue

      public java.lang.String idFromValue​(java.lang.Object obj)
      Specified by:
      idFromValue in interface com.fasterxml.jackson.databind.jsontype.TypeIdResolver
    • idFromValueAndType

      public java.lang.String idFromValueAndType​(java.lang.Object obj, java.lang.Class<?> clazz)
      Specified by:
      idFromValueAndType 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
    • typeFromId

      public com.fasterxml.jackson.databind.JavaType typeFromId​(com.fasterxml.jackson.databind.DatabindContext context, java.lang.String id)
      Specified by:
      typeFromId 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