type conversion in jave api's getAs method