@ SuppressWarnings ( "unchecked" ) public static < S > Value < S > getIdValue ( final IncompleteKey key ) { if ( key instanceof com . google . cloud . datastore . Key ) { final com . google . cloud . datastore . Key completeKey = ( com . google . cloud . datastore . Key ) key ; if ( completeKey . hasId ( ) ) return ( Value < S > ) LongValue . of ( completeKey . getId ( ) ) ; else return ( Value < S > ) StringValue . of ( completeKey . getName ( ) ) ; } else { return null ; } }
Gets the String or Long id from the key as a Value or null if incomplete