JavaApi.Rd
Documents the features of the 'r6-generator-maven-plugin' by providing an example of an R package automatically generated from Java code by the plugin. It is not intended to be useful beyond testing, demonstrating and documenting the features of the r6 generator plugin.
Version: 1.1.0
Generated: 2024-05-16T16:22:15.382427434
J = testRapi::JavaApi$get(logLevel)
optional - the slf4j log level as a string - one of OFF (most specific, no logging), FATAL (most specific, little data), ERROR, WARN, INFO, DEBUG, TRACE (least specific, a lot of data), ALL (least specific, all data)
JavaApi$installDependencies()
This package level method checks for, and installs any dependencies needed for the running of the package. It is called automatically on first package load and so in general does not need to be used directly.
testRapi::JavaApi$installDependencies()
JavaApi$rebuildDependencies()
This package level method removes existing dependencies and re-installs dependencies needed for the running of the package. It is called automatically on first package load and so in general does not need to be called.
testRapi::JavaApi$rebuildDependencies()
JavaApi$versionInformation()
This package level method returns debugging version information for the package
testRapi::JavaApi$versionInformation()
JavaApi$get()
This is the main entry point for the package and the root of the Java API in this package. All classes defined in the package are made available as items under this root. The JavaApi object manages the communication between R and Java.
J = testRapi::JavaApi$get()
# package classes and functions are nested under the `J` api object.
J$changeLogLevel(logLevel)
Once the package is initialised the log level can be changed to increase the level of messages from the api.
J = testRapi::JavaApi$get()
J$changeLogLevel("DEBUG")
J$reconfigureLog(log4jproperties)
Experimental / Advanced use: Once the package is initialised the log configureation can be changed to log to an external file for example.
J = testRapi::JavaApi$get()
prp = fs::path(getwd(),"log4j.properties")
if (fs::file_exists(prp)) {
J$changeLogLevel(prp)
}
J$printMessages()
Experimental / Internal use: Messages from Java to R are queued and printed after each function call. It is unlikely that any will be not printed so in normal circumstances this function should do nothing.
J = testRapi::JavaApi$get()
J$printMessages()
MinimalExample$new()
the default no-args constructor
J = testRapi::JavaApi$get()
J$MinimalExample$new()
BounceTest$new()
the default no-args constructor
J = testRapi::JavaApi$get()
J$BounceTest$new()
FeatureTest$new()
A maximum of one constructor of any signature can be used.
If different constructors are needed then they may be used but not included in the R Api (i.e. not annotated with @RMethod.)
Static factory methods can be used instead.
J = testRapi::JavaApi$get()
J$FeatureTest$new(logMessage)
FeatureTest$demoStatic()
Static methods are also supported.
These are accessed through the root of the R api, and as a functional interface
J = testRapi::JavaApi$get()
J$FeatureTest$demoStatic(message)
# this method is also exposed as a package function:
testRapi::demo_static(message)
J = JavaApi$get()
J$FeatureTest$demoStatic('Ola, el mundo')
demo_static('Bonjour, le monde')
FeatureTest$diamonds()
The ggplot2::diamonds dataframe
A copy serialised into java, using RObject.writeRDS, saved within the jar file of the package, and exposed here using RObject.readRDS.
FeatureTest$collider()
no title
J = testRapi::JavaApi$get()
J$FeatureTest$collider(message1, message2)
# this method is also exposed as a package function:
testRapi::collider.feature_test(message1, message2)
FeatureTest$asyncStaticCountdown()
no title
J = testRapi::JavaApi$get()
J$FeatureTest$asyncStaticCountdown(label, rtimer)
# this method is also exposed as a package function:
testRapi::async_static_countdown(label, rtimer)
FeatureTest$asyncFactory()
no title
J = testRapi::JavaApi$get()
J$FeatureTest$asyncFactory()
# this method is also exposed as a package function:
testRapi::async_factory()
MoreFeatureTest$new()
the first constructor is used if there are none annotated
J = testRapi::JavaApi$get()
J$MoreFeatureTest$new(message1, message2)
MoreFeatureTest$create()
A static object constructor
MoreFeatureTest$collider()
no title
J = testRapi::JavaApi$get()
J$MoreFeatureTest$collider(message1, message2)
# this method is also exposed as a package function:
testRapi::collider.more_feature_test(message1, message2)
library(testthat)
tmp = collider.more_feature_test('should ','work')
expect_equal(tmp,'more feature test: should work')
FactoryTest$new()
the default no-args constructor
J = testRapi::JavaApi$get()
J$FactoryTest$new()
Serialiser$new()
the default no-args constructor
J = testRapi::JavaApi$get()
J$Serialiser$new()
Serialiser$serialiseDataframe()
no title
J = testRapi::JavaApi$get()
J$Serialiser$serialiseDataframe(dataframe, filename)
# this method is also exposed as a package function:
testRapi::serialise_dataframe(dataframe, filename)
Serialiser$deserialiseDataframe()
no title
J = testRapi::JavaApi$get()
J$Serialiser$deserialiseDataframe(filename)
# this method is also exposed as a package function:
testRapi::deserialise_dataframe(filename)
Serialiser$serialiseList()
no title
J = testRapi::JavaApi$get()
J$Serialiser$serialiseList(dataframe, filename)
# this method is also exposed as a package function:
testRapi::serialise_list(dataframe, filename)
Serialiser$deserialiseList()
no title
J = testRapi::JavaApi$get()
J$Serialiser$deserialiseList(filename)
# this method is also exposed as a package function:
testRapi::deserialise_list(filename)
Serialiser$serialiseNamedList()
no title
J = testRapi::JavaApi$get()
J$Serialiser$serialiseNamedList(dataframe, filename)
# this method is also exposed as a package function:
testRapi::serialise_named_list(dataframe, filename)
Serialiser$deserialiseNamedList()
no title
J = testRapi::JavaApi$get()
J$Serialiser$deserialiseNamedList(filename)
# this method is also exposed as a package function:
testRapi::deserialise_named_list(filename)
## -----------------------------------
## Check library dependencies for testRapi
## -----------------------------------
testRapi::JavaApi$installDependencies()
## -----------------------------------
## Construct a testRapi Java API instance
## -----------------------------------
J = testRapi::JavaApi$get()
# or a more verbose configuration
# J = testRapi::JavaApi$get("DEBUG")
## -----------------------------------
## Method `J$MinimalExample$new(...)`
## -----------------------------------
if (FALSE) {
# no example given - appropriate parameter values must be provided:
J$MinimalExample$new()
# or alternatively:
testRapi::new()
}
## -----------------------------------
## Method `J$BounceTest$new(...)`
## -----------------------------------
if (FALSE) {
# no example given - appropriate parameter values must be provided:
J$BounceTest$new()
# or alternatively:
testRapi::new()
}
## -----------------------------------
## Method `J$FeatureTest$new(...)`
## -----------------------------------
minExample = J$FeatureTest$new('Hello from Java constructor!')
#> Hello from Java constructor!
## -----------------------------------
## Method `J$FeatureTest$demoStatic(...)`
## Aliased as `testRapi::demo_static(...)`
## -----------------------------------
J = JavaApi$get()
J$FeatureTest$demoStatic('Ola, el mundo')
#> Ola, el mundo
demo_static('Bonjour, le monde')
#> Bonjour, le monde
## -----------------------------------
## Method `J$FeatureTest$diamonds(...)`
## Aliased as `testRapi::diamonds(...)`
## -----------------------------------
dplyr::glimpse( diamonds() )
#> Rows: 53,940
#> Columns: 10
#> $ carat <dbl> 0.23, 0.21, 0.23, 0.29, 0.31, 0.24, 0.24, 0.26, 0.22, 0.23, 0.…
#> $ cut <ord> Ideal, Premium, Good, Premium, Good, Very Good, Very Good, Ver…
#> $ color <ord> E, E, E, I, J, J, I, H, E, H, J, J, F, J, E, E, I, J, J, J, I,…
#> $ clarity <ord> SI2, SI1, VS1, VS2, SI2, VVS2, VVS1, SI1, VS2, VS1, SI1, VS1, …
#> $ depth <dbl> 61.5, 59.8, 56.9, 62.4, 63.3, 62.8, 62.3, 61.9, 65.1, 59.4, 64…
#> $ table <dbl> 55, 61, 65, 58, 58, 57, 57, 55, 61, 61, 55, 56, 61, 54, 62, 58…
#> $ price <int> 326, 326, 327, 334, 335, 336, 336, 337, 337, 338, 339, 340, 34…
#> $ x <dbl> 3.95, 3.89, 4.05, 4.20, 4.34, 3.94, 3.95, 4.07, 3.87, 4.00, 4.…
#> $ y <dbl> 3.98, 3.84, 4.07, 4.23, 4.35, 3.96, 3.98, 4.11, 3.78, 4.05, 4.…
#> $ z <dbl> 2.43, 2.31, 2.31, 2.63, 2.75, 2.48, 2.47, 2.53, 2.49, 2.39, 2.…
## -----------------------------------
## Method `J$FeatureTest$collider(...)`
## Aliased as `testRapi::collider.feature_test(...)`
## -----------------------------------
if (FALSE) {
# no example given - appropriate parameter values must be provided:
J$FeatureTest$collider(message1, message2)
# or alternatively:
testRapi::collider.feature_test(message1, message2)
}
## -----------------------------------
## Method `J$FeatureTest$asyncStaticCountdown(...)`
## Aliased as `testRapi::async_static_countdown(...)`
## -----------------------------------
if (FALSE) {
# no example given - appropriate parameter values must be provided:
J$FeatureTest$asyncStaticCountdown(label, rtimer)
# or alternatively:
testRapi::async_static_countdown(label, rtimer)
}
## -----------------------------------
## Method `J$FeatureTest$asyncFactory(...)`
## Aliased as `testRapi::async_factory(...)`
## -----------------------------------
if (FALSE) {
# no example given - appropriate parameter values must be provided:
J$FeatureTest$asyncFactory()
# or alternatively:
testRapi::async_factory()
}
## -----------------------------------
## Method `J$MoreFeatureTest$new(...)`
## -----------------------------------
if (FALSE) {
# no example given - appropriate parameter values must be provided:
J$MoreFeatureTest$new(message1, message2)
# or alternatively:
testRapi::new(message1, message2)
}
## -----------------------------------
## Method `J$MoreFeatureTest$create(...)`
## Aliased as `testRapi::create(...)`
## -----------------------------------
J = JavaApi$get()
J$MoreFeatureTest$create('Hello,',' World')
#> constuctor: Hello,, World
#> [1] "toString: World"
## -----------------------------------
## Method `J$MoreFeatureTest$concat(...)`
## Aliased as `testRapi::concat(...)`
## -----------------------------------
if (FALSE) {
# no example given - appropriate parameter values must be provided:
J$MoreFeatureTest$concat(message1, message2)
# or alternatively:
testRapi::concat(message1, message2)
}
## -----------------------------------
## Method `J$MoreFeatureTest$collider(...)`
## Aliased as `testRapi::collider.more_feature_test(...)`
## -----------------------------------
library(testthat)
tmp = collider.more_feature_test('should ','work')
expect_equal(tmp,'more feature test: should work')
## -----------------------------------
## Method `J$FactoryTest$new(...)`
## -----------------------------------
if (FALSE) {
# no example given - appropriate parameter values must be provided:
J$FactoryTest$new()
# or alternatively:
testRapi::new()
}
## -----------------------------------
## Method `J$Serialiser$new(...)`
## -----------------------------------
if (FALSE) {
# no example given - appropriate parameter values must be provided:
J$Serialiser$new()
# or alternatively:
testRapi::new()
}
## -----------------------------------
## Method `J$Serialiser$serialiseDataframe(...)`
## Aliased as `testRapi::serialise_dataframe(...)`
## -----------------------------------
if (FALSE) {
# no example given - appropriate parameter values must be provided:
J$Serialiser$serialiseDataframe(dataframe, filename)
# or alternatively:
testRapi::serialise_dataframe(dataframe, filename)
}
## -----------------------------------
## Method `J$Serialiser$deserialiseDataframe(...)`
## Aliased as `testRapi::deserialise_dataframe(...)`
## -----------------------------------
if (FALSE) {
# no example given - appropriate parameter values must be provided:
J$Serialiser$deserialiseDataframe(filename)
# or alternatively:
testRapi::deserialise_dataframe(filename)
}
## -----------------------------------
## Method `J$Serialiser$serialiseList(...)`
## Aliased as `testRapi::serialise_list(...)`
## -----------------------------------
if (FALSE) {
# no example given - appropriate parameter values must be provided:
J$Serialiser$serialiseList(dataframe, filename)
# or alternatively:
testRapi::serialise_list(dataframe, filename)
}
## -----------------------------------
## Method `J$Serialiser$deserialiseList(...)`
## Aliased as `testRapi::deserialise_list(...)`
## -----------------------------------
if (FALSE) {
# no example given - appropriate parameter values must be provided:
J$Serialiser$deserialiseList(filename)
# or alternatively:
testRapi::deserialise_list(filename)
}
## -----------------------------------
## Method `J$Serialiser$serialiseNamedList(...)`
## Aliased as `testRapi::serialise_named_list(...)`
## -----------------------------------
if (FALSE) {
# no example given - appropriate parameter values must be provided:
J$Serialiser$serialiseNamedList(dataframe, filename)
# or alternatively:
testRapi::serialise_named_list(dataframe, filename)
}
## -----------------------------------
## Method `J$Serialiser$deserialiseNamedList(...)`
## Aliased as `testRapi::deserialise_named_list(...)`
## -----------------------------------
if (FALSE) {
# no example given - appropriate parameter values must be provided:
J$Serialiser$deserialiseNamedList(filename)
# or alternatively:
testRapi::deserialise_named_list(filename)
}