            (com.google.protobuf Descriptors$Descriptor Descriptors$FieldDescriptor CodedInputStream)
            (java.io InputStream OutputStream)))
 
-(defn protobuf? [obj]
+(defn protobuf?
+  "Is the given object a PersistentProtocolBufferMap?"
+  [obj]
   (instance? PersistentProtocolBufferMap obj))
 
-(defn protodef? [obj]
+(defn protodef?
+  "Is the given object a PersistentProtocolBufferMap$Def?"
+  [obj]
   (instance? PersistentProtocolBufferMap$Def obj))
 
-(defn protodef [class]
+(defn protodef
+  "Create a protodef from a string or protobuf class."
+  [class]
   (if (or (protodef? class) (nil? class))
     class
     (PersistentProtocolBufferMap$Def/create class)))
 
-(defmacro defprotobuf [sym & args]
+(defmacro defprotobuf
+  "Helper macro for defining a protodef object."
+  [sym & args]
   (let [class (apply str (interpose "$" (map name args)))]
     `(def ~sym (protodef ~class))))
 
 (defn protobuf
+  "Construct a protobuf of the given type."
   ([^PersistentProtocolBufferMap$Def type]
      (PersistentProtocolBufferMap/construct type {}))
   ([^PersistentProtocolBufferMap$Def type m]

  ([^PersistentProtocolBufferMap$Def type k v & kvs]
     (PersistentProtocolBufferMap/construct type (apply array-map k v kvs))))

(defn protodefault [type key]
  (let [type ^PersistentProtocolBufferMap$Def (protodef type)]
    (.defaultValue type key)))

(defn protofields [type]
  (let [type ^PersistentProtocolBufferMap$Def (protodef type)
        type ^Descriptors$Descriptor (.getMessageType type)]
    (into {}

          [field-name (when-not (empty? meta-string) (read-string meta-string))])))))

(defn protobuf-load
  "Load a protobuf of the given type from an array of bytes."
  ([^PersistentProtocolBufferMap$Def type ^bytes data]
     (when data
       (PersistentProtocolBufferMap/create type data)))
