private T createOrThrow ( String name ) { T constant = constants . get ( name ) ; if ( constant == null ) { final T tempConstant = newConstant ( nextId ( ) , name ) ; constant = constants . putIfAbsent ( name , tempConstant ) ; if ( constant == null ) { return tempConstant ; } } throw new IllegalArgumentException ( String . format ( "'%s' is already in use" , name ) ) ; }
Creates constant by name or throws exception . Threadsafe