Skip to content

Commit

Permalink
implement attributes toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
spoltier committed Jan 30, 2024
1 parent f1d029c commit d5e4011
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions R/withAttributesFromJava.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@
#
# Utility function for converting XLConnect java objects with added attributes
# to R variables with the corresponding attributes.
# Sets the attributes if option XLConnect.mapAttributesFromJava is TRUE.
# Otherwise only unwraps the java object.
#
# Author: Simon Poltier, Mirai Solutions GmbH
#
#############################################################################

withAttributesFromJava <- function(jobj) {

# jni <- .jcall(jobj, "S", "jni")
# unwrapped <- .jcall(jobj, jni, "getValue")
unwrapped <- jobj$getValue()

allANames = .jcall(jobj, "[S", "getAttributeNames")
# allAValues = .jcall(jobj, "[S", "getAttributeValues")

for(i in seq(along = allANames)) {
attr(unwrapped, allANames[i]) <- jobj$getAttributeValue(allANames[i])
if(getOption("XLConnect.mapAttributesFromJava")){
for(i in seq(along = allANames)) {
attr(unwrapped, allANames[i]) <- jobj$getAttributeValue(allANames[i])
}
}
unwrapped
}

0 comments on commit d5e4011

Please sign in to comment.