Variable named interface
Asked Answered
M

2

6

I need a variable that represents an interface. I was wondering if there is a "standard" name for such a variable, like for example the clazz for a Class variable. I was thinking of naming it aInterface, but I don't realy like this name...

Mcclary answered 20/2, 2012 at 9:8 Comment(5)
what do u mean by that clazz? like Class clazz = yourObj.getClass() ???Babbittry
what's the type of the variable?Upswell
@Uko: yes that's what I mean.Mcclary
@Liviu: Well it's a bit more complicated. I'm using Xtext for some code generation and the variable just models a generated interface.Mcclary
@Uko: Here clazz is just a name of the variable of type java.lang.Class. In general, although it is a bad practice people tend to use String string for declaring a String variable quickly. The same way clazz is used as we cannot use class which is a restricted key word in Java. This is generally used when one tries to load classes programatically.Lumumba
T
2

In general my interface names start with I, like, IMyInterface. And I use 'i' as prefix for variable name where I need to indicate the variable is interface, like iMyInterfaceVar. But no such restriction or standard rule.

Just for sake of completeness, here is The Java Code Convention Guide

Treblinka answered 20/2, 2012 at 9:15 Comment(0)
L
6

In the lines of clazz, you could use interfaze!

Lumumba answered 20/2, 2012 at 9:10 Comment(1)
Funny, but I hope Deelazee doesn't take this too seriously.Textualism
T
2

In general my interface names start with I, like, IMyInterface. And I use 'i' as prefix for variable name where I need to indicate the variable is interface, like iMyInterfaceVar. But no such restriction or standard rule.

Just for sake of completeness, here is The Java Code Convention Guide

Treblinka answered 20/2, 2012 at 9:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.