type checking for method and attribute.