Function: org-babel-java-val-to-type

org-babel-java-val-to-type is a byte-compiled function defined in ob-java.el.gz.

Signature

(org-babel-java-val-to-type VAL)

Documentation

Determine the type of VAL.

Return (BASETYPE . LISTTYPE), where BASETYPE is a symbol representing the type of the individual items in VAL, and LISTTYPE is a string name of the type parameter for a container for BASETYPE items.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ob-java.el.gz
(defun org-babel-java-val-to-type (val)
  "Determine the type of VAL.
Return (BASETYPE . LISTTYPE), where BASETYPE is a symbol
representing the type of the individual items in VAL, and
LISTTYPE is a string name of the type parameter for a container
for BASETYPE items."
  (let* ((basetype (org-babel-java-val-to-base-type val))
         (basetype-str (pcase basetype
                         (`integerp "Integer")
                         (`floatp "Double")
                         (`stringp "String")
                         (_ (error "Unknown type %S" basetype)))))
    (cond
     ((and (listp val) (listp (car val))) ; a table
      (cons basetype (format "List<List<%s>>" basetype-str)))
     ((or (listp val) (vectorp val))      ; a list declared in the source block header
      (cons basetype (format "List<%s>" basetype-str)))
     (t                                   ; return base type
      (cons basetype basetype-str)))))