protected final BeanJsonMapperInfo getMapperInfo ( JClassType beanType ) throws UnableToCompleteException { BeanJsonMapperInfo mapperInfo = typeOracle . getBeanJsonMapperInfo ( beanType ) ; if ( null != mapperInfo ) { return mapperInfo ; } boolean samePackage = true ; String packageName = beanType . getPackage ( ) . getName ( ) ; // We can't create classes in the java package so we prefix it. if ( packageName . startsWith ( "java." ) ) { packageName = "gwtjackson." + packageName ; samePackage = false ; } // Retrieve the informations on the beans and its properties. BeanInfo beanInfo = BeanProcessor . processBean ( logger , typeOracle , configuration , beanType ) ; PropertiesContainer properties = PropertyProcessor . findAllProperties ( configuration , logger , typeOracle , beanInfo , samePackage ) ; beanInfo = BeanProcessor . processProperties ( configuration , logger , typeOracle , beanInfo , properties ) ; // We concatenate the name of all the enclosing classes. StringBuilder builder = new StringBuilder ( beanType . getSimpleSourceName ( ) ) ; JClassType enclosingType = beanType . getEnclosingType ( ) ; while ( null != enclosingType ) { builder . insert ( 0 , enclosingType . getSimpleSourceName ( ) + "_" ) ; enclosingType = enclosingType . getEnclosingType ( ) ; } // If the type is specific to the mapper, we concatenate the name and hash of the mapper to it. boolean isSpecificToMapper = configuration . isSpecificToMapper ( beanType ) ; if ( isSpecificToMapper ) { JClassType rootMapperClass = configuration . getRootMapperClass ( ) ; builder . insert ( 0 , ' ' ) . insert ( 0 , configuration . getRootMapperHash ( ) ) . insert ( 0 , ' ' ) . insert ( 0 , rootMapperClass . getSimpleSourceName ( ) ) ; } String simpleSerializerClassName = builder . toString ( ) + "BeanJsonSerializerImpl" ; String simpleDeserializerClassName = builder . toString ( ) + "BeanJsonDeserializerImpl" ; mapperInfo = new BeanJsonMapperInfo ( beanType , packageName , samePackage , simpleSerializerClassName , simpleDeserializerClassName , beanInfo , properties . getProperties ( ) ) ; typeOracle . addBeanJsonMapperInfo ( beanType , mapperInfo ) ; return mapperInfo ; }
Returns the mapper information for the given type . The result is cached .