How about it?
--
To unsubscribe, reply using "remove me" as the subject.
Indicates that the annotated code must not be touched by ordinary
people. Only gurus, wizards and mythical explorers would be allowed to
touch it at his own peril.
@see http://en.wikipedia.org/wiki/Here_be_dragons
... or something like it.
Since dragons tend to inhabit unknown portions of maps, maybe the
example code should be:
@HereBeDragons
public static <K, V>
V getMember(Class<K> keyType, Map<? extends K, ? extends V> map,
Object location) {
return location != null && !keyType.isInstance(location) ?
map.get(location) : null;
}
and a useful piece of code that a client can use to provide some level
of protection from an API that exposes dragons:
private static void maybeSlayDragons(Map<?, ?> map) {
if (Locale.getDefault().equals(Locale.ENGLISH) &&
isStGeorgesDay(new Date())) {
map.clear();
Sorry, the getMember method should of course be called explore or sallyForth.
Love it. Can think of a million places we could use this in our codebase...
@HereBe(DRAGONS)
@HereBe(SEA_MONSTERS)
@HereBe(RAVENOUS_BUGBLATTER_BEASTS)
@HereBe(RODENTS_OF_UNUSUAL_SIZE)
Paul
On 07/04/10 03:52, Pablo J. Cabrera Muñoz wrote:
How about it?
Love it. Can think of a million places we could use this in our codebase...
@HereBe(DRAGONS)
@HereBe(SEA_MONSTERS)
@HereBe(RAVENOUS_BUGBLATTER_BEASTS)
@HereBe(RODENTS_OF_UNUSUAL_SIZE)
Paul