I have class named Ipv4Address
. What would be idiomatic camel case name for it? By idiomatic I mean meeting Google Java Style and meeting Checkstyle AbbreviationAsWordInName check.
This question does not answer my question - I'm asking here specifically about what to do with letter "v" that is already lowercase in acronym.
Ipv
may suggest that there's word "ipv" or acronym "IPV". But actual acronym is "IPv", wich is made of two words: "IP" and "version"
Well, according to the first site:
Convert the phrase to plain ASCII and remove any apostrophes. For example, "Müller's algorithm" might become "Muellers algorithm"
Divide this result into words, splitting on spaces and any remaining punctuation (typically hyphens).
Recommended: if any word already has a conventional camel-case appearance in common usage, split this into its constituent parts (e.g., "AdWords" becomes "ad words"). Note that a word such as "iOS" is not really in camel case per se; it defies any convention, so this recommendation does not apply.
Now lowercase everything (including acronyms), then uppercase only the first character of:
... each word, to yield upper camel case, or
... each word except the first, to yield lower camel case
Finally, join all the words into a single identifier.
So:
IPv4 Address
IPv 4 Address
ipv 4 address
Ipv 4 Address
Ipv4Address
An example they give that includes IPv
:
"supports IPv6 on iOS?" -> supportsIpv6OnIos
So, it appears that Google does not care that the "v" stands for "version", and as such they treat it as part of a single word, "IPv".
If you are dead-set on making it clear that "v" is "version," you could probably get away with IpVersion4Address
, though I like the look of Ipv4Address
better.