public static javax . jcr . Node nodeForValue ( final Session session , final Value v ) throws RepositoryException { if ( v . getType ( ) == PATH ) { return session . getNode ( v . getString ( ) ) ; } else if ( v . getType ( ) == REFERENCE || v . getType ( ) == WEAKREFERENCE ) { return session . getNodeByIdentifier ( v . getString ( ) ) ; } else { throw new RepositoryRuntimeException ( "Cannot convert value of type " + PropertyType . nameFromValue ( v . getType ( ) ) + " to a node reference" ) ; } }
Get the node that a property value refers to .