public P load ( final BaseEntity < ? > ent , final LoadContext ctx ) { try { // The context needs to know the root entity for any given point ctx . setCurrentRoot ( Key . create ( ( com . google . cloud . datastore . Key ) ent . getKey ( ) ) ) ; final EntityValue entityValue = makeLoadEntityValue ( ent ) ; return translator . load ( entityValue , ctx , Path . root ( ) ) ; } catch ( LoadException ex ) { throw ex ; } catch ( Exception ex ) { throw new LoadException ( ent , ex . getMessage ( ) , ex ) ; } }
Converts an entity to an object of the appropriate type for this metadata structure . Does not check that the entity is appropriate ; that should be done when choosing which EntityMetadata to call .