[groovy] extract findDeclaredDetachedValue() to utility file