private Object onAutoGenerator ( EntityMetadata m , Client < ? > client , Object e ) { Object autogenerator = getAutoGenClazz ( client ) ; if ( autogenerator instanceof AutoGenerator ) { Object generatedId = ( ( AutoGenerator ) autogenerator ) . generate ( client , m . getIdAttribute ( ) . getJavaType ( ) . getSimpleName ( ) ) ; try { generatedId = PropertyAccessorHelper . fromSourceToTargetClass ( m . getIdAttribute ( ) . getJavaType ( ) , generatedId . getClass ( ) , generatedId ) ; PropertyAccessorHelper . setId ( e , m , generatedId ) ; return generatedId ; } catch ( IllegalArgumentException iae ) { log . error ( "Unknown data type for ids : " + m . getIdAttribute ( ) . getJavaType ( ) ) ; throw new KunderaException ( "Unknown data type for ids : " + m . getIdAttribute ( ) . getJavaType ( ) , iae ) ; } } throw new IllegalArgumentException ( GenerationType . class . getSimpleName ( ) + "." + GenerationType . AUTO + " Strategy not supported by this client :" + client . getClass ( ) . getName ( ) ) ; }
Generate Id when given auto generation strategy .