Skip to content

Instantly share code, notes, and snippets.

@gfredericks
Created July 24, 2011 15:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gfredericks/1102703 to your computer and use it in GitHub Desktop.
Save gfredericks/1102703 to your computer and use it in GitHub Desktop.
(defn static-field-map
[class]
(->>
class
(.getFields)
(seq)
(map (juxt #(-> % .getName .toLowerCase (.replaceAll "_" "-") keyword)
#(.get % class)))
(into {})))
;; user=> (static-field-map ShortMessage)
{:midi-time-code 241,
:note-off 128,
:song-select 243,
:start 250,
:system-reset 255,
:end-of-exclusive 247,
:stop 252,
:song-position-pointer 242,
:tune-request 246,
:timing-clock 248,
:control-change 176,
:channel-pressure 208,
:pitch-bend 224,
:poly-pressure 160,
:note-on 144,
:continue 251,
:program-change 192,
:active-sensing 254}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment