Is there any way to surround cast with instance of or some similar technique to avoid typing
if (o instanceof Docket) { Docket d = (Docket)o; .... }
Only two features I know of to do with instanceof is : 1) the live template 'inst' which will create the if clause with a declared variable 2) an intention on an if (o instanceof Foo) { } clause which creates a variable declaration for you within the braces.
Unless there's anything else I'm missing, sounds like you've landed on a good idea for an intention for the case where you have an unchecked cast, and want to surround it with a check.
Alex Roytman wrote:
Only two features I know of to do with instanceof is :
1) the live template 'inst' which will create the if clause with a
declared variable
2) an intention on an if (o instanceof Foo) { } clause which creates a
variable declaration for you within the braces.
Unless there's anything else I'm missing, sounds like you've landed on a
good idea for an intention for the case where you have an unchecked
cast, and want to surround it with a check.
N.
Alex Roytman wrote:
Why not write your own template ?