FeatureTest.Rd
A test of the R6 generator templating
Version: 1.1.0
Generated: 2024-05-16T16:22:15.462768704
logMessage - a message which will be logged - (java expects a String)
The feature test should allow mathjax in javadoc
$$e = mc^2$$
this is a details comment
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()
instance = J$FeatureTest$new(logMessage);
doHelloWorld()
A hello world function
More detailed description
J = testRapi::JavaApi$get()
instance = J$FeatureTest$new(logMessage);
instance$doHelloWorld()
doSum()
Add some numbers (1).
The doSum function description = it adds two numerics
J = testRapi::JavaApi$get()
instance = J$FeatureTest$new(logMessage);
instance$doSum(a, b)
- (java expects a RNumeric)
- (java expects a RNumeric)
RNumeric: A+B of course, NAs in inputs are converted to null in Java. This catches the resulting NPE in java idiom and returns an explicit NA. This only matters if you care about the difference between NA_real_ and NaN in R.
doSum2()
Adds some numbers
Do sum 2 uses native ints rather than RNumerics It should throw an error if given something that cannot be coerced to an integer. This also demonstrated the use of the `@RDefault` annotation
J = testRapi::JavaApi$get()
instance = J$FeatureTest$new(logMessage);
instance$doSum2(a, b)
getMessage()
Get the message
message desciption
J = testRapi::JavaApi$get()
instance = J$FeatureTest$new(logMessage);
instance$getMessage()
fluentSetMessage()
Set a message in a fluent way
A fluent method which updates the message in this object, returning the same object. This is differentiated from factory methods which produce a new instance of the same class by checking to see if the returned Java object is equal to the calling Java object.
J = testRapi::JavaApi$get()
instance = J$FeatureTest$new(logMessage);
instance$fluentSetMessage(message)
factoryMethod()
A factory or builder method which constructs an object of another class from some parameters
J = testRapi::JavaApi$get()
instance = J$FeatureTest$new(logMessage);
instance$factoryMethod(a, b)
objectAsParameter()
no title
J = testRapi::JavaApi$get()
instance = J$FeatureTest$new(logMessage);
instance$objectAsParameter(otherObj)
doSomethingWithDataFrame()
Consumes a data frame and logs its length
J = testRapi::JavaApi$get()
instance = J$FeatureTest$new(logMessage);
instance$doSomethingWithDataFrame(dataframe)
generateDataFrame()
Creates a basic dataframe and returns it
J = testRapi::JavaApi$get()
instance = J$FeatureTest$new(logMessage);
instance$generateDataFrame()
errorThrower()
Throws an error
J = testRapi::JavaApi$get()
instance = J$FeatureTest$new(logMessage);
instance$errorThrower()
asyncCountdown()
no title
J = testRapi::JavaApi$get()
instance = J$FeatureTest$new(logMessage);
instance$asyncCountdown()
asyncRaceCountdown()
no title
J = testRapi::JavaApi$get()
instance = J$FeatureTest$new(logMessage);
instance$asyncRaceCountdown()
blockingCountdown()
no title
J = testRapi::JavaApi$get()
instance = J$FeatureTest$new(logMessage);
instance$blockingCountdown()
## -----------------------------------
## Construct new instance of FeatureTest
## -----------------------------------
library(roxygen2)
library(devtools)
#> Loading required package: usethis
#>
#> Attaching package: ‘devtools’
#> The following object is masked from ‘package:testRapi’:
#>
#> create
library(here)
#> here() starts at /home/vp22681/Dropbox/Git/r6-generator-docs
library(tidyverse)
#> ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
#> ✔ dplyr 1.1.4 ✔ readr 2.1.5
#> ✔ forcats 1.0.0 ✔ stringr 1.5.1
#> ✔ ggplot2 3.5.1 ✔ tibble 3.2.1
#> ✔ lubridate 1.9.3 ✔ tidyr 1.3.1
#> ✔ purrr 1.0.2
#> ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
#> ✖ dplyr::filter() masks stats::filter()
#> ✖ dplyr::lag() masks stats::lag()
#> ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(ggplot2)
library(readr)
library(dplyr)
library(tibble)
J = JavaApi$get()
#> Initialised testRapi
minExample = J$FeatureTest$new('Hello from Java constructor!')
#> Hello from Java constructor!
## -----------------------------------
## Method `FeatureTest$doHelloWorld()`
## -----------------------------------
library(roxygen2)
library(devtools)
library(here)
library(tidyverse)
library(ggplot2)
library(readr)
library(dplyr)
library(tibble)
J = JavaApi$get()
minExample = J$FeatureTest$new('Hello, R World!')
#> Hello, R World!
minExample$doHelloWorld()
#> [1] "Hello world from Java!"
## -----------------------------------
## Method `FeatureTest$doSum(a, b)`
## -----------------------------------
library(roxygen2)
library(devtools)
library(here)
library(tidyverse)
library(ggplot2)
library(readr)
library(dplyr)
library(tibble)
J = JavaApi$get()
library(testthat)
#>
#> Attaching package: ‘testthat’
#> The following object is masked from ‘package:dplyr’:
#>
#> matches
#> The following object is masked from ‘package:purrr’:
#>
#> is_null
#> The following objects are masked from ‘package:readr’:
#>
#> edition_get, local_edition
#> The following object is masked from ‘package:tidyr’:
#>
#> matches
#> The following object is masked from ‘package:devtools’:
#>
#> test_file
minExample = J$FeatureTest$new('Hello from Java constructor!')
#> Hello from Java constructor!
result = minExample$doSum(2,7.5)
testthat::expect_equal(result,9.5)
## -----------------------------------
## Method `FeatureTest$doSum2(a, b)`
## -----------------------------------
if (FALSE) {
# appropriate parameter values must be provided
instance$doSum2(a, b)
}
## -----------------------------------
## Method `FeatureTest$getMessage()`
## -----------------------------------
if (FALSE) {
# appropriate parameter values must be provided
instance$getMessage()
}
## -----------------------------------
## Method `FeatureTest$fluentSetMessage(message)`
## -----------------------------------
if (FALSE) {
# appropriate parameter values must be provided
instance$fluentSetMessage(message)
}
## -----------------------------------
## Method `FeatureTest$factoryMethod(a, b)`
## -----------------------------------
if (FALSE) {
# appropriate parameter values must be provided
instance$factoryMethod(a, b)
}
## -----------------------------------
## Method `FeatureTest$objectAsParameter(otherObj)`
## -----------------------------------
if (FALSE) {
# appropriate parameter values must be provided
instance$objectAsParameter(otherObj)
}
## -----------------------------------
## Method `FeatureTest$doSomethingWithDataFrame(dataframe)`
## -----------------------------------
if (FALSE) {
# appropriate parameter values must be provided
instance$doSomethingWithDataFrame(dataframe)
}
## -----------------------------------
## Method `FeatureTest$generateDataFrame()`
## -----------------------------------
if (FALSE) {
# appropriate parameter values must be provided
instance$generateDataFrame()
}
## -----------------------------------
## Method `FeatureTest$errorThrower()`
## -----------------------------------
if (FALSE) {
# appropriate parameter values must be provided
instance$errorThrower()
}
## -----------------------------------
## Method `FeatureTest$asyncCountdown()`
## -----------------------------------
if (FALSE) {
# appropriate parameter values must be provided
instance$asyncCountdown()
}
## -----------------------------------
## Method `FeatureTest$asyncRaceCountdown()`
## -----------------------------------
if (FALSE) {
# appropriate parameter values must be provided
instance$asyncRaceCountdown()
}
## -----------------------------------
## Method `FeatureTest$blockingCountdown()`
## -----------------------------------
if (FALSE) {
# appropriate parameter values must be provided
instance$blockingCountdown()
}