diff --git a/packages/jsii-calc-base-of-base/package.json b/packages/jsii-calc-base-of-base/package.json index 6a5b346eea..5aca0e446d 100644 --- a/packages/jsii-calc-base-of-base/package.json +++ b/packages/jsii-calc-base-of-base/package.json @@ -48,8 +48,7 @@ "python": { "distName": "scope.jsii-calc-base-of-base", "module": "scope.jsii_calc_base_of_base" - }, - "sphinx": {} + } }, "versionFormat": "short" } diff --git a/packages/jsii-calc-base-of-base/test/assembly.jsii b/packages/jsii-calc-base-of-base/test/assembly.jsii index f99384e311..8409268a18 100644 --- a/packages/jsii-calc-base-of-base/test/assembly.jsii +++ b/packages/jsii-calc-base-of-base/test/assembly.jsii @@ -36,8 +36,7 @@ "python": { "distName": "scope.jsii-calc-base-of-base", "module": "scope.jsii_calc_base_of_base" - }, - "sphinx": {} + } }, "types": { "@scope/jsii-calc-base-of-base.IVeryBaseInterface": { @@ -112,5 +111,5 @@ } }, "version": "0.19.0", - "fingerprint": "7MB5loMgQMPSUAigsYezONp1ouq1gGrVQPD2TZteJlY=" + "fingerprint": "Vlx00ifa2hokcWUTvyArHMvCacQmjgyYtwy0zEWGZo0=" } diff --git a/packages/jsii-calc-base/package.json b/packages/jsii-calc-base/package.json index 1199816bec..d5402c4bd1 100644 --- a/packages/jsii-calc-base/package.json +++ b/packages/jsii-calc-base/package.json @@ -54,8 +54,7 @@ "python": { "distName": "scope.jsii-calc-base", "module": "scope.jsii_calc_base" - }, - "sphinx": {} + } }, "versionFormat": "short" } diff --git a/packages/jsii-calc-base/test/assembly.jsii b/packages/jsii-calc-base/test/assembly.jsii index fa01990928..2cce0a3b34 100644 --- a/packages/jsii-calc-base/test/assembly.jsii +++ b/packages/jsii-calc-base/test/assembly.jsii @@ -27,8 +27,7 @@ "python": { "distName": "scope.jsii-calc-base-of-base", "module": "scope.jsii_calc_base_of_base" - }, - "sphinx": {} + } }, "version": "0.19.0" } @@ -53,8 +52,7 @@ "python": { "distName": "scope.jsii-calc-base-of-base", "module": "scope.jsii_calc_base_of_base" - }, - "sphinx": {} + } }, "version": "0.19.0" } @@ -88,8 +86,7 @@ "python": { "distName": "scope.jsii-calc-base", "module": "scope.jsii_calc_base" - }, - "sphinx": {} + } }, "types": { "@scope/jsii-calc-base.Base": { @@ -177,5 +174,5 @@ } }, "version": "0.19.0", - "fingerprint": "UzDw4nRR+4fhd01t0ybeUo6SmdnWdfKbE+pTzl/6voQ=" + "fingerprint": "N9LvPVtN5Azr2Ip3FMatwqceL+70AEYPqZk+T7qC/bc=" } diff --git a/packages/jsii-calc-lib/package.json b/packages/jsii-calc-lib/package.json index bf35469b57..fbe1848a64 100644 --- a/packages/jsii-calc-lib/package.json +++ b/packages/jsii-calc-lib/package.json @@ -58,8 +58,7 @@ "python": { "distName": "scope.jsii-calc-lib", "module": "scope.jsii_calc_lib" - }, - "sphinx": {} + } }, "versionFormat": "short" } diff --git a/packages/jsii-calc-lib/test/assembly.jsii b/packages/jsii-calc-lib/test/assembly.jsii index 684d6bdabd..3ce44f8214 100644 --- a/packages/jsii-calc-lib/test/assembly.jsii +++ b/packages/jsii-calc-lib/test/assembly.jsii @@ -27,8 +27,7 @@ "python": { "distName": "scope.jsii-calc-base", "module": "scope.jsii_calc_base" - }, - "sphinx": {} + } }, "version": "0.19.0" } @@ -53,8 +52,7 @@ "python": { "distName": "scope.jsii-calc-base", "module": "scope.jsii_calc_base" - }, - "sphinx": {} + } }, "version": "0.19.0" }, @@ -77,8 +75,7 @@ "python": { "distName": "scope.jsii-calc-base-of-base", "module": "scope.jsii_calc_base_of_base" - }, - "sphinx": {} + } }, "version": "0.19.0" } @@ -118,8 +115,7 @@ "python": { "distName": "scope.jsii-calc-lib", "module": "scope.jsii_calc_lib" - }, - "sphinx": {} + } }, "types": { "@scope/jsii-calc-lib.EnumFromScopedModule": { @@ -543,5 +539,5 @@ } }, "version": "0.19.0", - "fingerprint": "fTZVmFlDa7uoeJF41GTcIhD33vnnyxZOgxCeZ1hIvSk=" + "fingerprint": "rS2rGvy6Ma6wo/1JfCpR21CQsx8P5YmdtrxJ5EjgXxs=" } diff --git a/packages/jsii-calc/package.json b/packages/jsii-calc/package.json index 0341178549..0df9d20e9e 100644 --- a/packages/jsii-calc/package.json +++ b/packages/jsii-calc/package.json @@ -63,8 +63,7 @@ "python": { "distName": "jsii-calc", "module": "jsii_calc" - }, - "sphinx": {} + } }, "metadata": { "jsii:boolean": true, diff --git a/packages/jsii-calc/test/assembly.jsii b/packages/jsii-calc/test/assembly.jsii index 24a1fc2261..c42118335e 100644 --- a/packages/jsii-calc/test/assembly.jsii +++ b/packages/jsii-calc/test/assembly.jsii @@ -53,8 +53,7 @@ "python": { "distName": "scope.jsii-calc-base", "module": "scope.jsii_calc_base" - }, - "sphinx": {} + } }, "version": "0.19.0" }, @@ -77,8 +76,7 @@ "python": { "distName": "scope.jsii-calc-base-of-base", "module": "scope.jsii_calc_base_of_base" - }, - "sphinx": {} + } }, "version": "0.19.0" }, @@ -103,8 +101,7 @@ "python": { "distName": "scope.jsii-calc-lib", "module": "scope.jsii_calc_lib" - }, - "sphinx": {} + } }, "version": "0.19.0" } @@ -129,8 +126,7 @@ "python": { "distName": "scope.jsii-calc-base", "module": "scope.jsii_calc_base" - }, - "sphinx": {} + } }, "version": "0.19.0" }, @@ -153,8 +149,7 @@ "python": { "distName": "scope.jsii-calc-base-of-base", "module": "scope.jsii_calc_base_of_base" - }, - "sphinx": {} + } }, "version": "0.19.0" }, @@ -179,8 +174,7 @@ "python": { "distName": "scope.jsii-calc-lib", "module": "scope.jsii_calc_lib" - }, - "sphinx": {} + } }, "version": "0.19.0" } @@ -228,8 +222,7 @@ "python": { "distName": "jsii-calc", "module": "jsii_calc" - }, - "sphinx": {} + } }, "types": { "jsii-calc.AbstractClass": { @@ -9617,5 +9610,5 @@ } }, "version": "0.19.0", - "fingerprint": "z0M8ATIlYi8ohIQB7KR90oh4pKmIb3EdBoPgS3/lyHM=" + "fingerprint": "nQMF6ipA96E38PvG3NsgKOJIb3ZEit4jNrxZAkgRlbs=" } diff --git a/packages/jsii-kernel/test/kernel.test.ts b/packages/jsii-kernel/test/kernel.test.ts index 8b10df40c8..7360b13d81 100644 --- a/packages/jsii-kernel/test/kernel.test.ts +++ b/packages/jsii-kernel/test/kernel.test.ts @@ -213,7 +213,6 @@ defineTest('naming allows returns the module name for different languages', (san }, js: { npm: 'jsii-calc' }, python: { distName: 'jsii-calc', module: 'jsii_calc' }, - sphinx: {}, }); expect(sandbox.naming({ assembly: '@scope/jsii-calc-lib' }).naming).toEqual({ dotnet: { @@ -227,7 +226,6 @@ defineTest('naming allows returns the module name for different languages', (san }, js: { npm: '@scope/jsii-calc-lib' }, python: { distName: 'scope.jsii-calc-lib', module: 'scope.jsii_calc_lib' }, - sphinx: {}, }); }); diff --git a/packages/jsii-pacmak/bin/jsii-pacmak.ts b/packages/jsii-pacmak/bin/jsii-pacmak.ts index 1aeb410cb8..969d7dd4f6 100644 --- a/packages/jsii-pacmak/bin/jsii-pacmak.ts +++ b/packages/jsii-pacmak/bin/jsii-pacmak.ts @@ -1,19 +1,15 @@ #!/usr/bin/env node -import fs = require('fs-extra'); -import reflect = require('jsii-reflect'); -import spec = require('jsii-spec'); -import os = require('os'); import path = require('path'); import process = require('process'); import yargs = require('yargs'); import logging = require('../lib/logging'); -import { Target } from '../lib/target'; import { Timers } from '../lib/timer'; -import { resolveDependencyDirectory, shell } from '../lib/util'; import { VERSION_DESC } from '../lib/version'; +import { findJsiiModules, updateAllNpmIgnores } from '../lib/npm-modules'; +import { JsiiModule } from '../lib/packaging'; +import { ALL_BUILDERS, TargetName } from '../lib/targets'; (async function main() { - const targetConstructors = await Target.findAll(); const argv = yargs .usage('Usage: jsii-pacmak [-t target,...] [-o outdir] [package-dir]') .env('JSII_PACMAK') @@ -22,7 +18,7 @@ import { VERSION_DESC } from '../lib/version'; type: 'array', desc: 'target languages for which to generate bindings', defaultDescription: 'all targets defined in `package.json` will be generated', - choices: Object.keys(targetConstructors), + choices: Object.keys(ALL_BUILDERS), required: false }) .option('outdir', { @@ -54,6 +50,11 @@ import { VERSION_DESC } from '../lib/version'; desc: 'force generation into a target-named subdirectory, even in single-target mode', default: true, }) + .option('force-target', { + type: 'boolean', + desc: 'force generation of the given targets, even if the source package.json doesnt declare it', + default: false, + }) .option('recurse', { alias: 'R', type: 'boolean', @@ -78,192 +79,138 @@ import { VERSION_DESC } from '../lib/version'; default: true }) .version(VERSION_DESC) + .strict() .argv; logging.level = argv.verbose !== undefined ? argv.verbose : 0; + // Default to 4 threads in case of concurrency, good enough for most situations logging.debug('command line arguments:', argv); - const rootDir = path.resolve(process.cwd(), argv._[0] || '.'); - - const visited = new Set(); - await buildPackage(rootDir, true /* isRoot */, argv['force-subdirectory']); - - async function buildPackage(packageDir: string, isRoot: boolean, forceSubdirectory: boolean) { - if (visited.has(packageDir)) { - return; // already built - } + const timers = new Timers(); - visited.add(packageDir); + const modulesToPackage = await findJsiiModules(argv._, argv.recurse); + logging.info(`Found ${modulesToPackage.length} modules to package`); + if (modulesToPackage.length === 0) { + logging.warn('Nothing to do'); + return; + } - // read package.json and extract the "jsii" configuration from it. - const pkg = await fs.readJson(path.join(packageDir, 'package.json')); - if (!pkg.jsii || !pkg.jsii.outdir || !pkg.jsii.targets) { - if (isRoot) { - throw new Error(`Invalid "jsii" section in ${packageDir}. Expecting "outdir" and "targets"`); - } else { - return; // just move on, this is not a jsii package - } + if (argv.outdir) { + for (const module of modulesToPackage) { + module.outputDirectory = path.resolve(argv.outdir); } - // if --recurse is set, find dependency dirs and build them. - if (argv.recurse) { - for (const dep of Object.keys(pkg.dependencies || {})) { - const depDir = resolveDependencyDirectory(packageDir, dep); - /* eslint-disable no-await-in-loop */ - await buildPackage(depDir, /* isRoot */ false, forceSubdirectory); - /* eslint-enable no-await-in-loop */ - } - } + } else if (argv.npmignore) { + // if outdir is coming from package.json, verify it is excluded by .npmignore. if it is explicitly + // defined via --out, don't perform this verification. + await updateAllNpmIgnores(modulesToPackage); + } - // outdir is either by package.json/jsii.outdir (relative to package root) or via command line (relative to cwd) - const outDir = argv.outdir !== undefined ? path.resolve(process.cwd(), argv.outdir) : path.resolve(packageDir, pkg.jsii.outdir); - const targets = argv.targets || [...Object.keys(pkg.jsii.targets), 'js']; // "js" is an implicit target. + await timers.recordAsync('npm pack', () => { + logging.info('Packaging NPM bundles'); + return Promise.all(modulesToPackage + .map(m => m.npmPack())); + }); - logging.info(`Building ${pkg.name} (${targets.join(',')}) into ${path.relative(process.cwd(), outDir)}`); + await timers.recordAsync('load jsii', () => { + logging.info('Loading jsii assemblies'); + return Promise.all(modulesToPackage + .map(m => m.load())); + }); - if (argv.npmignore) { - // if outdir is coming from package.json, verify it is excluded by .npmignore. if it is explicitly - // defined via --out, don't perform this verification. - const npmIgnoreExclude = argv.outdir ? undefined : outDir; + try { + const requestedTargets = argv.targets && argv.targets.map(t => `${t}`) + const targetSets = sliceTargets(modulesToPackage, requestedTargets, argv['force-target']); - // updates .npmignore to exclude the output directory and include the .jsii file - await updateNpmIgnore(packageDir, npmIgnoreExclude); + if (targetSets.every(s => s.modules.length === 0)) { + throw new Error(`None of the requested packages had any targets to build for '${requestedTargets}' (use --force-target to force)`); } - const timers = new Timers(); - - const tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), 'npm-pack')); - try { - const tarball = await timers.recordAsync('npm pack', () => { - return npmPack(packageDir, tmpdir); - }); - - const ts = new reflect.TypeSystem(); - const assembly = await ts.loadModule(packageDir); + const perLanguageDirectory = targetSets.length > 1 || argv['force-subdirectory']; - await Promise.all(targets.map(targetName => { - // if we are targeting a single language, output to outdir, otherwise outdir/ - const targetOutputDir = targets.length > 1 || forceSubdirectory - ? path.join(outDir, targetName.toString()) - : outDir; - logging.debug(`Building ${pkg.name}/${targetName}: ${targetOutputDir}`); + // We run all target sets in parallel for minimal wall clock time + await Promise.all(targetSets.map(async targetSet => { + // for (const targetSet of targetSets) { + logging.info(`Packaging '${targetSet.targetType}' for ${describePackages(targetSet)}`); + await timers.recordAsync(targetSet.targetType, () => + buildTargetsForLanguage(targetSet.targetType, targetSet.modules, perLanguageDirectory) + ); + logging.info(`${targetSet.targetType} finished`); + })); - return timers.recordAsync(targetName.toString(), () => - generateTarget(assembly, packageDir, targetName.toString(), targetOutputDir, tarball) - ); - })); - } finally { - if (argv.clean) { - logging.debug(`Removing ${tmpdir}`); - } else { - logging.debug(`Temporary directory retained (--no-clean): ${tmpdir}`); - } - await fs.remove(tmpdir); + } finally { + if (argv.clean) { + logging.debug('Cleaning up'); + await timers.recordAsync('cleanup', () => + Promise.all(modulesToPackage + .map(m => m.cleanup())) + ); + } else { + logging.debug('Temporary directories retained (--no-clean)'); } - - logging.info(`Packaged. ${timers.display()}`); } - async function generateTarget(assembly: reflect.Assembly, packageDir: string, targetName: string, targetOutputDir: string, tarball: string) { + logging.info(`Packaged. ${timers.display()}`); + + async function buildTargetsForLanguage(targetLanguage: string, modules: JsiiModule[], perLanguageDirectory: boolean) { // ``argv.target`` is guaranteed valid by ``yargs`` through the ``choices`` directive. - const targetConstructor = targetConstructors[targetName]; - if (!targetConstructor) { - throw new Error(`Unsupported target: "${targetName}"`); + const builder = ALL_BUILDERS[targetLanguage as TargetName]; + if (!builder) { + throw new Error(`Unsupported target: '${targetLanguage}'`); } - const target = new targetConstructor({ - targetName, - packageDir, - assembly, - fingerprint: argv.fingerprint, + await builder.buildModules(modules, { + clean: argv.clean, + codeOnly: argv['code-only'], force: argv.force, - arguments: argv + fingerprint: argv.fingerprint, + arguments: argv, + languageSubdirectory: perLanguageDirectory, }); - - const codeDir = argv.codeOnly ? targetOutputDir : await fs.mkdtemp(path.join(os.tmpdir(), 'jsii-pacmak-code')); - - logging.debug(`Generating ${targetName} code into ${codeDir}`); - - await target.generateCode(codeDir, tarball); - - if (argv.codeOnly) { return; } - - logging.debug(`Building into ${targetOutputDir}`); - await target.build(codeDir, targetOutputDir); - - if (argv.clean) { - await fs.remove(codeDir); - } else { - logging.info(`Generated code for ${targetName} retained at: ${codeDir}`); - } } - })().catch(err => { process.stderr.write(`${err.stack}\n`); process.exit(1); }); -async function npmPack(packageDir: string, tmpdir: string): Promise { - logging.debug(`Running "npm pack ${packageDir}" in ${tmpdir}`); - const args = ['pack', packageDir]; - if (logging.level >= logging.LEVEL_VERBOSE) { - args.push('--loglevel=verbose'); - } - const out = await shell('npm', args, { cwd: tmpdir }); - // Take only the last line of npm pack which should contain the - // tarball name. otherwise, there can be a lot of extra noise there - // from scripts that emit to STDOUT. - const lines = out.trim().split(os.EOL); - return path.resolve(tmpdir, lines[lines.length - 1].trim()); +/** + * A set of packages (targets) translated into the same language + */ +interface TargetSet { + targetType: string; + modules: JsiiModule[]; } -async function updateNpmIgnore(packageDir: string, excludeOutdir: string | undefined) { - const npmIgnorePath = path.join(packageDir, '.npmignore'); - let lines = new Array(); - let modified = false; - if (await fs.pathExists(npmIgnorePath)) { - lines = (await fs.readFile(npmIgnorePath)).toString().split('\n'); +function sliceTargets(modules: JsiiModule[], requestedTargets: string[] | undefined, force: boolean) { + if (requestedTargets === undefined) { + requestedTargets = allAvailableTargets(modules); } - // if this is a fresh .npmignore, we can be a bit more opinionated - // otherwise, we add just add stuff that's critical - if (lines.length === 0) { - excludePattern('Exclude typescript source and config', '*.ts', 'tsconfig.json'); - includePattern('Include javascript files and typescript declarations', '*.js', '*.d.ts'); - } - - if (excludeOutdir) { - excludePattern('Exclude jsii outdir', path.relative(packageDir, excludeOutdir)); + const ret = new Array(); + for (const target of requestedTargets) { + ret.push({ + targetType: target, + modules: modules.filter(m => force || m.availableTargets.includes(target)) + }); } - includePattern('Include .jsii', spec.SPEC_FILE_NAME); - - if (modified) { - await fs.writeFile(npmIgnorePath, `${lines.join('\n')}\n`); - logging.info('Updated .npmignore'); - } + return ret; +} - function includePattern(comment: string, ...patterns: string[]) { - excludePattern(comment, ...patterns.map(p => `!${p}`)); +function allAvailableTargets(modules: JsiiModule[]) { + const ret = new Set(); + for (const module of modules) { + for (const target of module.availableTargets) { + ret.add(target) + } } + return Array.from(ret); +} - function excludePattern(comment: string, ...patterns: string[]) { - let first = true; - for (const pattern of patterns) { - if (lines.includes(pattern)) { - return; // already in .npmignore - } - - modified = true; - - if (first) { - lines.push(''); - lines.push(`# ${comment}`); - first = false; - } - - lines.push(pattern); - } +function describePackages(target: TargetSet) { + if (target.modules.length > 0 && target.modules.length < 5) { + return target.modules.map(m => m.name).join(', '); } + return `${target.modules.length} modules`; } diff --git a/packages/jsii-pacmak/lib/builder.ts b/packages/jsii-pacmak/lib/builder.ts new file mode 100644 index 0000000000..19d3c140f8 --- /dev/null +++ b/packages/jsii-pacmak/lib/builder.ts @@ -0,0 +1,123 @@ +import path = require('path'); +import logging = require('./logging'); +import { JsiiModule } from './packaging'; +import { TargetConstructor, Target } from './target'; +import { Scratch } from './util'; + +export interface BuildOptions { + /** + * Whether to fingerprint the produced artifacts. + * @default true + */ + fingerprint?: boolean; + + /** + * Whether artifacts should be re-build even if their fingerprints look up-to-date. + * @default false + */ + force?: boolean; + + /** + * Arguments provided by the user (how they are used is target-dependent) + */ + arguments: { [name: string]: any }; + + /** + * Only generate code, don't build + */ + codeOnly?: boolean; + + /** + * Whether or not to clean + */ + clean?: boolean; + + /** + * Whether to add an additional subdirectory for the target language + */ + languageSubdirectory?: boolean; +} + +/** + * Interface for classes that can build language targets + * + * Building can happen one target at a time, or multiple targets at a time. + */ +export interface TargetBuilder { + buildModules(modules: JsiiModule[], options: BuildOptions): Promise; +} + +/** + * Return the output directory if all modules have the same directory + */ +export function allOutputDirectoriesTheSame(modules: JsiiModule[]): boolean { + if (modules.length === 0) { return true; } + const ret = modules[0].outputDirectory; + return modules.every(m => m.outputDirectory === ret); +} + +/** + * Builds the targets for the given language sequentially + */ +export class OneByOneBuilder implements TargetBuilder { + public constructor(private readonly targetName: string, private readonly targetConstructor: TargetConstructor) { + + } + + public async buildModules(modules: JsiiModule[], options: BuildOptions): Promise { + for (const module of modules) { + if (options.codeOnly) { + await this.generateModuleCode(module, options); + } else { + await this.buildModule(module, options); + } + } + } + + private async generateModuleCode(module: JsiiModule, options: BuildOptions) { + const outputDir = this.finalOutputDir(module, options); + logging.debug(`Generating ${this.targetName} code into ${outputDir}`); + await this.makeTarget(module, options).generateCode(outputDir, module.tarball); + } + + private async buildModule(module: JsiiModule, options: BuildOptions) { + const target = this.makeTarget(module, options); + const outputDir = this.finalOutputDir(module, options); + + const src = await Scratch.make(tmpdir => { + logging.debug(`Generating ${this.targetName} code into ${tmpdir}`); + return target.generateCode(tmpdir, module.tarball); + }); + + try { + logging.debug(`Building ${src.directory} into ${outputDir}`); + await target.build(src.directory, outputDir); + + } finally { + if (options.clean) { + logging.debug(`Cleaning ${src.directory}`); + await src.cleanup(); + } else { + logging.info(`Generated code for ${this.targetName} retained at ${src.directory}`); + } + } + } + + private makeTarget(module: JsiiModule, options: BuildOptions): Target { + return new this.targetConstructor({ + targetName: this.targetName, + packageDir: module.moduleDirectory, + assembly: module.assembly, + fingerprint: options.fingerprint, + force: options.force, + arguments: options.arguments + }); + } + + private finalOutputDir(module: JsiiModule, options: BuildOptions): string { + if (options.languageSubdirectory) { + return path.join(module.outputDirectory, this.targetName); + } + return module.outputDirectory; + } +} \ No newline at end of file diff --git a/packages/jsii-pacmak/lib/npm-modules.ts b/packages/jsii-pacmak/lib/npm-modules.ts new file mode 100644 index 0000000000..f42e3e668f --- /dev/null +++ b/packages/jsii-pacmak/lib/npm-modules.ts @@ -0,0 +1,115 @@ +import fs = require('fs-extra'); +import path = require('path'); +import spec = require('jsii-spec'); +import { resolveDependencyDirectory } from './util'; + +import logging = require('../lib/logging'); +import { JsiiModule } from './packaging'; + + +/** + * Find all modules that need to be packagerd + * + * If the input list is empty, include the current directory. The result + * is NOT topologically sorted. + */ +export async function findJsiiModules(directories: string[], recurse: boolean) { + const ret: JsiiModule[] = []; + const visited = new Set(); + for (const dir of directories.length > 0 ? directories : ['.']) { + await visitPackage(dir, true); + } + return ret; + + async function visitPackage(dir: string, isRoot: boolean) { + const realPath = await fs.realpath(dir); + if (visited.has(realPath)) { return; } // Already visited + visited.add(realPath); + + const pkg = await fs.readJson(path.join(realPath, 'package.json')); + if (!pkg.jsii || !pkg.jsii.outdir || !pkg.jsii.targets) { + if (isRoot) { + throw new Error(`Invalid "jsii" section in ${realPath}. Expecting "outdir" and "targets"`); + } else { + return; // just move on, this is not a jsii package + } + } + + // if --recurse is set, find dependency dirs and build them. + if (recurse) { + for (const dep of Object.keys(pkg.dependencies || {})) { + const depDir = resolveDependencyDirectory(realPath, dep); + await visitPackage(depDir, false); + } + } + + // outdir is either by package.json/jsii.outdir (relative to package root) or via command line (relative to cwd) + const outputDirectory = pkg.jsii.outdir && path.resolve(realPath, pkg.jsii.outdir); + const targets = [...Object.keys(pkg.jsii.targets), 'js']; // "js" is an implicit target. + + ret.push(new JsiiModule({ + name: pkg.name, + moduleDirectory: realPath, + defaultOutputDirectory: outputDirectory, + availableTargets: targets + })); + } + +} + +export async function updateAllNpmIgnores(packages: JsiiModule[]) { + for (const pkg of packages) { + // updates .npmignore to exclude the output directory and include the .jsii file + await updateNpmIgnore(pkg.moduleDirectory, pkg.outputDirectory); + } +} + +async function updateNpmIgnore(packageDir: string, excludeOutdir: string | undefined) { + const npmIgnorePath = path.join(packageDir, '.npmignore'); + let lines = new Array(); + let modified = false; + if (await fs.pathExists(npmIgnorePath)) { + lines = (await fs.readFile(npmIgnorePath)).toString().split('\n'); + } + + // if this is a fresh .npmignore, we can be a bit more opinionated + // otherwise, we add just add stuff that's critical + if (lines.length === 0) { + excludePattern('Exclude typescript source and config', '*.ts', 'tsconfig.json'); + includePattern('Include javascript files and typescript declarations', '*.js', '*.d.ts'); + } + + if (excludeOutdir) { + excludePattern('Exclude jsii outdir', path.relative(packageDir, excludeOutdir)); + } + + includePattern('Include .jsii', spec.SPEC_FILE_NAME); + + if (modified) { + await fs.writeFile(npmIgnorePath, `${lines.join('\n')}\n`); + logging.info('Updated .npmignore'); + } + + function includePattern(comment: string, ...patterns: string[]) { + excludePattern(comment, ...patterns.map(p => `!${p}`)); + } + + function excludePattern(comment: string, ...patterns: string[]) { + let first = true; + for (const pattern of patterns) { + if (lines.includes(pattern)) { + return; // already in .npmignore + } + + modified = true; + + if (first) { + lines.push(''); + lines.push(`# ${comment}`); + first = false; + } + + lines.push(pattern); + } + } +} \ No newline at end of file diff --git a/packages/jsii-pacmak/lib/packaging.ts b/packages/jsii-pacmak/lib/packaging.ts new file mode 100644 index 0000000000..11e60abcb2 --- /dev/null +++ b/packages/jsii-pacmak/lib/packaging.ts @@ -0,0 +1,88 @@ +import { Scratch, shell } from './util'; +import logging = require('../lib/logging'); +import reflect = require('jsii-reflect'); +import os = require('os'); +import path = require('path'); + +const SHARED_TS = new reflect.TypeSystem(); + +export interface JsiiModuleOptions { + /** + * Name of the module + */ + name: string; + + /** + * The module directory + */ + moduleDirectory: string; + + /** + * Identifier of the targets to build + */ + availableTargets: string[]; + + /** + * Output directory where to package everything + */ + defaultOutputDirectory: string; +} +export class JsiiModule { + public readonly name: string; + public readonly moduleDirectory: string; + public readonly availableTargets: string[]; + public outputDirectory: string; + + private _tarball?: Scratch; + public _assembly?: reflect.Assembly; + + public constructor(options: JsiiModuleOptions) { + this.name = options.name; + this.moduleDirectory = options.moduleDirectory; + this.availableTargets = options.availableTargets; + this.outputDirectory = options.defaultOutputDirectory; + } + + /** + * Prepare an NPM package from this source module + */ + public async npmPack() { + this._tarball = await Scratch.make(async tmpdir => { + logging.debug(`Running "npm pack ${this.moduleDirectory}" in ${tmpdir}`); + const args = ['pack', this.moduleDirectory]; + if (logging.level >= logging.LEVEL_VERBOSE) { + args.push('--loglevel=verbose'); + } + const out = await shell('npm', args, { cwd: tmpdir }); + // Take only the last line of npm pack which should contain the + // tarball name. otherwise, there can be a lot of extra noise there + // from scripts that emit to STDOUT. + const lines = out.trim().split(os.EOL); + return path.resolve(tmpdir, lines[lines.length - 1].trim()); + }); + } + + public get tarball(): string { + if (!this._tarball) { + throw new Error('Tarball not available yet, call npmPack() first'); + } + return this._tarball.object; + } + + public async load() { + this._assembly = await SHARED_TS.loadModule(this.moduleDirectory); + } + + public get assembly(): reflect.Assembly { + if (!this._assembly) { + throw new Error('Assembly not available yet, call load() first'); + } + return this._assembly; + } + + public async cleanup() { + if (this._tarball) { + await this._tarball.cleanup(); + } + } +} \ No newline at end of file diff --git a/packages/jsii-pacmak/lib/target.ts b/packages/jsii-pacmak/lib/target.ts index 3e84a105a3..43100b2010 100644 --- a/packages/jsii-pacmak/lib/target.ts +++ b/packages/jsii-pacmak/lib/target.ts @@ -7,25 +7,8 @@ import { IGenerator } from './generator'; import logging = require('./logging'); import { resolveDependencyDirectory } from './util'; -export abstract class Target { - public static async findAll() { - return new Promise<{ [name: string]: TargetConstructor }>((ok, ko) => { - const targetDir = path.join(__dirname, 'targets'); - fs.readdir(targetDir).then(names => { - try { - const result: { [name: string]: TargetConstructor } = {}; - for (const name of names) { - if (!name.endsWith('.js')) { continue; } - result[path.basename(name, '.js')] = require(path.join(targetDir, name)).default; - } - ok(result); - } catch (e) { - ko(e); - } - }).catch(ko); - }); - } +export abstract class Target { protected readonly packageDir: string; protected readonly fingerprint: boolean; protected readonly force: boolean; @@ -143,7 +126,7 @@ export interface TargetConstructor { * @return the native reference for the target for each supported language (there can be multiple languages * supported by a given target: typescript & javascript, java & scala & clojure & kotlin, ...) */ - toNativeReference?: (type: spec.Type, options: any) => { [language: string]: string }; + toNativeReference?: (type: spec.Type, options: any) => { [language: string]: string | undefined }; new(options: TargetOptions): Target; } diff --git a/packages/jsii-pacmak/lib/targets/dotnet.ts b/packages/jsii-pacmak/lib/targets/dotnet.ts index 302baddb49..54729e328e 100644 --- a/packages/jsii-pacmak/lib/targets/dotnet.ts +++ b/packages/jsii-pacmak/lib/targets/dotnet.ts @@ -68,7 +68,7 @@ export default class Dotnet extends Target { // into the same output. NuGet throws an error if a source directory doesn't exist, so we check // before adding it to the list. if (await fs.pathExists(currentOutputDirectory)) { - localRepos.push(currentOutputDirectory); + localRepos.push(path.resolve(process.cwd(), currentOutputDirectory)); } // If dotnet-jsonmodel is checked-out and we can find a local repository, add it to the list. diff --git a/packages/jsii-pacmak/lib/targets/index.ts b/packages/jsii-pacmak/lib/targets/index.ts new file mode 100644 index 0000000000..263a9d405d --- /dev/null +++ b/packages/jsii-pacmak/lib/targets/index.ts @@ -0,0 +1,19 @@ +import { OneByOneBuilder, TargetBuilder } from '../builder'; + +import Dotnet from './dotnet'; +import { JavaBuilder } from './java'; +import JavaScript from './js'; +import Python from './python'; +import Ruby from './ruby'; + +export type TargetName = 'dotnet' | 'java' | 'js' | 'python' | 'ruby'; + +export const ALL_BUILDERS: {[key in TargetName]: TargetBuilder} = { + dotnet: new OneByOneBuilder('dotnet', Dotnet), + java: new JavaBuilder(), + js: new OneByOneBuilder('js', JavaScript), + python: new OneByOneBuilder('python', Python), + ruby: new OneByOneBuilder('ruby', Ruby), +}; + + diff --git a/packages/jsii-pacmak/lib/targets/java.ts b/packages/jsii-pacmak/lib/targets/java.ts index d74ee354bf..39e2c6392a 100644 --- a/packages/jsii-pacmak/lib/targets/java.ts +++ b/packages/jsii-pacmak/lib/targets/java.ts @@ -9,13 +9,132 @@ import { Generator } from '../generator'; import logging = require('../logging'); import { md2html } from '../markdown'; import { PackageInfo, Target } from '../target'; -import { shell } from '../util'; +import { shell, Scratch } from '../util'; import { VERSION, VERSION_DESC } from '../version'; +import { TargetBuilder, BuildOptions, allOutputDirectoriesTheSame, OneByOneBuilder } from '../builder'; +import { JsiiModule } from '../packaging'; /* eslint-disable @typescript-eslint/no-var-requires */ const spdxLicenseList = require('spdx-license-list'); /* eslint-enable @typescript-eslint/no-var-requires */ +/** + * Build Java packages in parallel, by generating an aggregate POM + */ +export class JavaBuilder implements TargetBuilder { + private readonly targetName = 'java'; + + public async buildModules(modules: JsiiModule[], options: BuildOptions): Promise { + if (modules.length === 0) { return; } + + // We can only do the optimized build if '-o' was specified, which we will notice + // as all module outputdirectories being the same. (Maybe we can build to per-package + // dist dirs as well, but this is the smallest delta from what we had and we will + // always specify the output dir anyway). + if (!allOutputDirectoriesTheSame(modules)) { + logging.warn('Single output directory not specified, doing (slower) one-by-one build for Java'); + await new OneByOneBuilder(this.targetName, Java).buildModules(modules, options); + return; + } + + const singleOutputDir = this.finalOutputDir(modules[0], options); + + const moduleDirectories = []; + + for (const module of modules) { + moduleDirectories.push(await this.generateModuleCode(module, options, options.codeOnly)); + } + + if (!options.codeOnly && modules.length > 0) { + // Need a module to get a target + const pomDirectory = await this.generateAggregatePom(moduleDirectories); + const target = this.makeTarget(modules[0], options); + + await target.build(pomDirectory, singleOutputDir); + } + } + + private async generateModuleCode(module: JsiiModule, options: BuildOptions, finalDirectory?: boolean): Promise> { + const target = this.makeTarget(module, options); + + const srcDir = finalDirectory + ? Scratch.fake(this.finalOutputDir(module, options), undefined) + : await Scratch.make(_ => undefined); + + logging.debug(`Generating ${this.targetName} code into ${srcDir.directory}`); + await target.generateCode(srcDir.directory, module.tarball); + + return srcDir; + } + + private async generateAggregatePom(sourceDirectories: Array>) { + const parentDir = this.findSharedParentDirectory(sourceDirectories.map(s => s.directory)); + + const aggregatePom = xmlbuilder.create({ + project: { + '@xmlns': 'http://maven.apache.org/POM/4.0.0', + '@xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance', + '@xsi:schemaLocation': 'http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd', + '#comment': [ + `Generated by jsii-pacmak@${VERSION_DESC} on ${new Date().toISOString()}`, + ], + + 'modelVersion': '4.0.0', + 'packaging': 'pom', + + 'groupId': 'software.amazon.jsii', + 'artifactId': 'aggregatepom', + 'version': '1.0.0', + + 'modules': { + module: sourceDirectories.map(s => path.relative(parentDir, s.directory)) + } + } + }, { encoding: 'UTF-8' }).end({ pretty: true }); + + logging.debug(`Generated ${parentDir}/pom.xml`); + await fs.writeFile(path.join(parentDir, 'pom.xml'), aggregatePom); + return parentDir; + } + + /** + * Find the longest shared given a set of directories + */ + private findSharedParentDirectory(dirs: string[]) { + if (dirs.length === 0) { return ''; } + const dirParts = dirs.map(dir => dir.split(path.sep)); + + return dirParts.reduce(longestPrefix).join(path.sep); + + function longestPrefix(accumulator: string[], current: string[]) { + const len = Math.min(accumulator.length, current.length); + let i = 0; + while (i < len && accumulator[i] === current[i]) { + i++; + } + return accumulator.slice(0, i); + } + } + + private makeTarget(module: JsiiModule, options: BuildOptions): Target { + return new Java({ + targetName: this.targetName, + packageDir: module.moduleDirectory, + assembly: module.assembly, + fingerprint: options.fingerprint, + force: options.force, + arguments: options.arguments + }); + } + + private finalOutputDir(module: JsiiModule, options: BuildOptions): string { + if (options.languageSubdirectory) { + return path.join(module.outputDirectory, this.targetName); + } + return module.outputDirectory; + } +} + export default class Java extends Target { public static toPackageInfos(assm: spec.Assembly): { [language: string]: PackageInfo } { @@ -205,9 +324,9 @@ class JavaGenerator extends Generator { if (JavaGenerator.RESERVED_KEYWORDS.includes(propertyName)) { return `${propertyName}Value`; - } + } return propertyName; - + } /** @@ -221,9 +340,9 @@ class JavaGenerator extends Generator { if (JavaGenerator.RESERVED_KEYWORDS.includes(methodName)) { return `do${toPascalCase(methodName)}`; - } + } return methodName; - + } /** If false, @Generated will not include generator version nor timestamp */ @@ -1208,9 +1327,9 @@ class JavaGenerator extends Generator { const types = this.toJavaTypes(type, forMarshalling); if (types.length > 1) { return 'java.lang.Object'; - } + } return types[0]; - + } private toJavaTypes(typeref: spec.TypeReference, forMarshalling = false): string[] { @@ -1228,9 +1347,9 @@ class JavaGenerator extends Generator { } } return types; - } + } throw new Error(`Invalid type reference: ${JSON.stringify(typeref)}`); - + } private toJavaCollection(ref: spec.CollectionTypeReference, forMarshalling: boolean) { @@ -1271,9 +1390,9 @@ class JavaGenerator extends Generator { ? `java.util.stream.Stream.concat(${valuesStream}, ${restStream})` : restStream; return `, ${fullStream}.toArray(Object[]::new)`; - } + } return `, ${valueStr}`; - + function _renderParameter(param: spec.Parameter) { const safeName = JavaGenerator.safeJavaPropertyName(param.name); @@ -1312,9 +1431,9 @@ class JavaGenerator extends Generator { if (method.returns) { return `return ${statement};`; - } + } return `${statement};`; - + } /** diff --git a/packages/jsii-pacmak/lib/targets/sphinx.ts b/packages/jsii-pacmak/lib/targets/sphinx.ts deleted file mode 100644 index 136b03f1cb..0000000000 --- a/packages/jsii-pacmak/lib/targets/sphinx.ts +++ /dev/null @@ -1,779 +0,0 @@ -import fs = require('fs-extra'); -import reflect = require('jsii-reflect'); -import spec = require('jsii-spec'); -import path = require('path'); -import { Generator } from '../generator'; -import { Target, TargetConstructor } from '../target'; - -export default class Sphinx extends Target { - protected readonly generator = new SphinxDocsGenerator(); - - public async build(sourceDir: string, outDir: string) { - return this.copyFiles(sourceDir, outDir); - } -} - -// ################## -// # CODE GENERATOR # -// ################## - -type NamespaceStackEntry = { name: string, underClass: boolean }; - -// Those MUST match what M2R uses (which is hard-coded in M2R), otherwise -// .. mdinclude: markdown files will produce inconsistent rendering. -const HMARKS = ['=', '-', '^', '~', '"', '#']; - -class SphinxDocsGenerator extends Generator { - private assemblyName?: string; - private readonly namespaceStack = new Array(); - private tocPath = new Array(); - private targets: { [name: string]: TargetConstructor } = {}; - - private get topNamespace(): NamespaceStackEntry { - return this.namespaceStack.length > 0 - ? this.namespaceStack[this.namespaceStack.length - 1] - : { name: '', underClass: false }; - } - - public constructor() { - super({ expandUnionProperties: false }); - - this.code.openBlockFormatter = s => s || ''; - this.code.closeBlockFormatter = _ => ''; - this.code.indentation = 3; - } - - public async load(packageRoot: string, assembly: reflect.Assembly) { - await super.load(packageRoot, assembly); - this.targets = await Target.findAll(); - } - - public async upToDate(outDir: string): Promise { - const mainFile = path.join(outDir, `${fsSafeName(this.assembly.name)}.rst`); - try { - if (!await fs.pathExists(mainFile)) { return false; } - const data = await fs.readFile(mainFile, { encoding: 'utf-8' }); - const matches = /^\.\. @jsii-pacmak:meta@ (.+)$/m.exec(data); - if (!matches) { return false; } - const meta = JSON.parse(matches[1]); - return meta.fingerprint === this.metadata.fingerprint; - } catch { - return false; - } - } - - // - // Assembly - - protected getAssemblyOutputPath(_mod: spec.Assembly): string | undefined { - return undefined; - } - - protected onBeginAssembly(assm: spec.Assembly, fingerprint: boolean) { - this.tocPath = new Array(); // As a safety measure, in case previous assembly somehow didn't get it back to 0. - - const { readmeFile, readmeHeader } = this.emitReadme(assm); - - this.code.openFile(`${fsSafeName(assm.name)}.rst`); - - if (fingerprint) { - this.code.line(`.. @jsii-pacmak:meta@ ${JSON.stringify(this.metadata)}`); - this.code.line(); - } - - // use the readme header if defined or the assembly name otherwise - this.openSection(readmeHeader || assm.name); - this.code.line(); - - if (readmeFile) { - this.code.line(`.. mdinclude:: ./${readmeFile}`); - this.code.line(); - } - this.openSection('Reference'); - this.code.line(); - - if (assm.targets) { - this.code.openBlock('.. tabs::'); - this.code.line(); - for (const targetName of Object.keys(assm.targets).sort()) { - const target = this.targets[targetName]; - if (!target || !target.toPackageInfos) { continue; } - const packageInfos = target.toPackageInfos(assm); - for (const language of Object.keys(packageInfos).sort()) { - const packageInfo = packageInfos[language]; - this.code.openBlock(`.. group-tab:: ${formatLanguage(language)}`); - this.code.line(); - - this.code.line(`View in \`${packageInfo.repository} <${packageInfo.url}>\`_`); - this.code.line(); - - for (const mgrName of Object.keys(packageInfo.usage).sort()) { - const mgr = packageInfo.usage[mgrName]; - this.code.line(`**${mgrName}**:`); - this.code.line(); - if (typeof mgr === 'string') { - this.code.openBlock('.. code-block:: none'); - this.code.line(); - mgr.split('\n').forEach(s => this.code.line(s)); - this.code.closeBlock(); - } else { - this.code.openBlock(`.. code-block:: ${mgr.language}`); - this.code.line(); - mgr.code.split('\n').forEach(s => this.code.line(s)); - this.code.closeBlock(); - } - } - - this.code.closeBlock(); - } - } - this.code.closeBlock(); - } - - this.assemblyName = assm.name; - } - - protected onEndAssembly(assm: spec.Assembly) { - this.closeSection(); - this.code.closeFile(`${fsSafeName(assm.name)}.rst`); - - delete this.assemblyName; - } - - // - // Namespaces - - protected onBeginNamespace(ns: string) { - const nativeName = this.toNativeFqn(ns); - - this.namespaceStack.push({ name: nativeName, underClass: this.topNamespace.underClass }); - - if (nativeName !== this.assemblyName) { - const assemblyPrefix = `${this.assemblyName}.`; - const conciseName = nativeName.startsWith(assemblyPrefix) - ? nativeName.slice(assemblyPrefix.length) - : nativeName; - - if (!conciseName.includes('.')) { - this.code.line(); - this.openSection(conciseName); - } - } - - this.code.line(`.. py:module:: ${nativeName}`); - this.code.line(); - } - - protected onEndNamespace(ns: string) { - this.namespaceStack.pop(); - - const nativeName = this.toNativeFqn(ns); - if (nativeName !== this.assemblyName) { - const assemblyPrefix = `${this.assemblyName}.`; - const conciseName = nativeName.startsWith(assemblyPrefix) - ? nativeName.slice(assemblyPrefix.length) - : nativeName; - - if (!conciseName.includes('.')) { - this.closeSection(); - } - } else { - this.closeSection(); - } - - // set current module to the one at the tip of the stack - if (this.namespaceStack.length > 0) { - const curr = this.namespaceStack[this.namespaceStack.length - 1]; - this.code.line(); - this.code.line(`.. py:currentmodule:: ${curr.name}`); - this.code.line(); - } - } - - // - // Classes - - protected onBeginClass(cls: spec.ClassType, abstract: boolean) { - const className = cls.name; - - if (!this.topNamespace.underClass) { - this.openSection(className); - this.code.line(); - } - - let sig = ''; - if (cls.initializer) { - sig = this.renderMethodSignature(cls.initializer); - } - - this.code.openBlock(`.. py:class:: ${className}${sig}`); - this.renderNames(cls); - this.renderDocsLine(cls); - this.code.line(); - - if (cls.base) { - this.code.line(`:extends: ${this.renderTypeRef(this.findType(cls.base)).ref}`); - } - - for (const ifc of cls.interfaces || []) { - this.code.line(`:implements: ${this.renderTypeRef(this.findType(ifc)).ref}`); - } - - if (abstract) { - this.code.line(':abstract: Yes'); - } - - if (cls.initializer) { - this.renderMethodParameters(cls.initializer); - } - - this.namespaceStack.push({ name: className, underClass: true }); - } - - protected onEndClass(cls: spec.ClassType) { - this.renderInheritedMembers(cls); - this.code.closeBlock(); - this.namespaceStack.pop(); - if (!this.topNamespace.underClass) { this.closeSection(); } - } - - // - // Initializers (constructos) - - protected onInitializer(_cls: spec.ClassType, _method: spec.Method) { - return; - } - - protected onInitializerOverload(cls: spec.ClassType, overload: spec.Method, _originalInitializer: spec.Method) { - this.onInitializer(cls, overload); - } - - // - // Properties - - protected onProperty(cls: spec.ClassType, prop: spec.Property) { - this.renderProperty(cls, prop); - } - - protected onStaticProperty(cls: spec.ClassType, prop: spec.Property) { - this.renderProperty(cls, prop); - } - - // - // Union Properties - // Those are properties that can accept more than a single type (i.e. String | Token). If the option `expandUnionProperties` is enabled - // instead of onUnionProperty, the method onExpandedUnionProperty will be called for each of the types defined in the property. - // `primaryName` indicates the original name of the union property (without the 'AsXxx' postfix). - - protected onUnionProperty(cls: spec.ClassType, prop: spec.Property, _union: spec.UnionTypeReference) { - this.onProperty(cls, prop); - } - - protected onExpandedUnionProperty(_cls: spec.ClassType, _prop: spec.Property, _primaryName: string) { - throw new Error('Unexpected'); - } - - // - // Methods - // onMethodOverload is triggered if the option `generateOverloadsForMethodWithOptionals` is enabled for each overload of the original method. - // The original method will be emitted via onMethod. - - protected onMethod(_cls: spec.ClassType, method: spec.Method) { - this.renderMethod(method); - } - - protected onMethodOverload(_cls: spec.ClassType, overload: spec.Method, _originalMethod: spec.Method) { - this.renderMethod(overload); - } - - protected onStaticMethod(_cls: spec.ClassType, method: spec.Method) { - this.renderMethod(method); - } - - protected onStaticMethodOverload(_cls: spec.ClassType, overload: spec.Method, _originalMethod: spec.Method) { - this.renderMethod(overload); - } - - // - // Enums - - protected onBeginEnum(enm: spec.EnumType) { - const enumName = enm.name; - - if (!this.topNamespace.underClass) { - this.openSection(`${enumName} (enum)`); - this.code.line(); - } - - this.code.openBlock(`.. py:class:: ${enumName}`); - this.renderNames(enm); - this.renderDocsLine(enm); - this.code.line(); - } - - protected onEndEnum(_enm: spec.EnumType) { - this.code.closeBlock(); - if (!this.topNamespace.underClass) { this.closeSection(); } - } - - protected onEnumMember(_enm: spec.EnumType, member: spec.EnumMember) { - this.code.line(`.. py:data:: ${member.name}`); - this.renderDocsLine(member); - this.code.line(); - } - - protected onBeginInterface(ifc: spec.InterfaceType) { - if (!this.topNamespace.underClass) { - this.openSection(`${ifc.name} (interface)`); - this.code.line(); - } - - this.code.openBlock(`.. py:class:: ${ifc.name}`); - this.renderNames(ifc); - this.renderDocsLine(ifc); - this.code.line(); - - for (const base of ifc.interfaces || []) { - this.code.line(`:extends: ${this.renderTypeRef(this.findType(base)).ref}`); - } - - this.code.line(); - } - - protected onEndInterface(ifc: spec.InterfaceType) { - this.renderInheritedMembers(ifc); - this.code.closeBlock(); - if (!this.topNamespace.underClass) { this.closeSection(); } - } - - protected onInterfaceMethod(_ifc: spec.InterfaceType, method: spec.Method) { - this.renderMethod(method); - } - - protected onInterfaceMethodOverload(ifc: spec.InterfaceType, overload: spec.Method, _originalMethod: spec.Method) { - this.onInterfaceMethod(ifc, overload); - } - - protected onInterfaceProperty(ifc: spec.InterfaceType, property: spec.Property) { - this.renderProperty(ifc, property); - } - - private renderInheritedMembers(entity: spec.ClassType | spec.InterfaceType) { - const inherited = this.getInheritedMembers(entity); - if (Object.keys(inherited).length === 0) { return; } - for (const source of Object.keys(inherited).sort()) { - const entities = inherited[source]; - for (const method of entities.methods) { - this.renderMethod(method, source); - for (const overload of this.createOverloadsForOptionals(method)) { - this.renderMethod(overload, source); - } - } - for (const property of entities.properties) { - this.renderProperty(entity, property, source); - } - } - } - - private getInheritedMembers(entity: spec.ClassType | spec.InterfaceType): InheritedMembers { - const parents = parentTypes.call(this, entity); - const knownMembers = new Set([ - ...(entity.methods || []).map(m => m.name), - ...(entity.properties || []).map(p => p.name) - ]); - const result: InheritedMembers = {}; - for (const parent of parents) { - const parentType = this.findType(parent.fqn) as spec.ClassType | spec.InterfaceType; - for (const method of parentType.methods || []) { - if (method.static || knownMembers.has(method.name)) { continue; } - result[parentType.fqn] = result[parentType.fqn] || { methods: [], properties: [] }; - result[parentType.fqn].methods.push(method); - knownMembers.add(method.name); - } - for (const property of parentType.properties || []) { - if (property.static || knownMembers.has(property.name)) { continue; } - result[parentType.fqn] = result[parentType.fqn] || { methods: [], properties: [] }; - result[parentType.fqn].properties.push(property); - knownMembers.add(property.name); - } - for (const superType of parentTypes.call(this, parentType)) { - parents.push(superType); - } - } - return result; - - function parentTypes(this: SphinxDocsGenerator, type: spec.ClassType | spec.InterfaceType) { - const types = new Array(); - if (spec.isClassType(type) && type.base) { - types.push(this.findType(type.base)); - } - if (type.interfaces) { - types.push(...type.interfaces.map(fqn => this.findType(fqn))); - } - return types; - } - } - - /** - * Adds a title to the current code file, using the appropriate header - * adornment given the current TOC depth. It will start using simple - * underline adornment, and once all underline markers have been used, - * over-and-underline adornments will be used. Increments the TOC depth - * after having generated the title. - * - * @param title the text for the title line to be redenred. - * - * @throws if an attempt to render a title is made when all possible - * adornments have already been used once. - */ - private openSection(title: string) { - if (this.tocPath.length >= 2 * HMARKS.length) { - throw new Error(`Unable to open a section ${this.tocPath.length + 1} levels deep. (${this.tocPath.join(' > ')})`); - } - const headerLine = dup(HMARKS[this.tocPath.length % HMARKS.length], title.length); - if (this.tocPath.length >= HMARKS.length) { - this.code.line(headerLine); - } - this.code.line(title); - this.code.line(headerLine); - - this.tocPath.push(title); - } - - /** - * Closes a titled section, decrementing +this.tocDepth+. - */ - private closeSection() { - this.tocPath.pop(); - } - - private renderMethodSignature(method: spec.Method | spec.Initializer) { - const params = method.parameters || []; - let signature = '('; - let signaturePosfix = ''; - - params.forEach((p, idx) => { - if (idx > 0) { - signature += ', '; - } - - // Mark parameter as "optional" if it's type is optional, and all subsequent parameters are optional/variadic - if (p.optional) { - signature += '['; - signaturePosfix += ']'; - } - if (p.variadic) { - signature += '*'; - } - - signature += p.name; - }); - - signature += signaturePosfix; - signature += ')'; - - if (spec.isMethod(method) && method.returns) { - const retType = this.renderOptionalValue(method.returns); - const retSignature = method.returns ? ` -> ${retType.display}` : ''; - signature += retSignature; - } - - return signature; - } - - private renderMethodParameters(method: spec.Method | spec.Initializer) { - const params = method.parameters || []; - - for (const p of params) { - const ptype = this.renderTypeRef(p.type); - const paramName = `${p.variadic ? '\\*' : ''}${p.name}`; - this.code.line(`:param ${paramName}: ${this.renderDocs(p)}`); - this.code.line(`:type ${paramName}: ${ptype.ref}`); - } - } - - private renderMethod(method: spec.Method, inheritedFrom?: string) { - const signature = this.renderMethodSignature(method); - - const type = method.static ? 'py:staticmethod' : 'py:method'; - - this.code.line(); - this.code.openBlock(`.. ${type}:: ${method.name}${signature}`); - - if (inheritedFrom) { - this.code.line(); - this.code.line(`*Inherited from* :py:meth:\`${inheritedFrom} <${inheritedFrom}.${method.name}>\``); - } else if (method.overrides) { - this.code.line(); - const superType = this.findType(method.overrides) as spec.ClassType | spec.InterfaceType; - if (spec.isInterfaceType(superType) || superType.methods!.some(m => m.name === method.name && !!m.abstract)) { - this.code.line(`*Implements* :py:meth:\`${method.overrides}.${method.name}\``); - } else { - this.code.line(`*Overrides* :py:meth:\`${method.overrides}.${method.name}\``); - } - } - this.renderDocsLine(method); - this.code.line(); - if (method.protected) { - this.code.line('*Protected method*'); - this.code.line(); - } - - this.renderMethodParameters(method); - - // @return doc - if (method.docs && method.docs.returns) { - const [firstLine, ...rest] = method.docs.returns.split('\n'); - this.code.line(`:return: ${firstLine}`); - rest.forEach(line => this.code.line(` ${line}`)); - } - - if (method.returns) { - this.code.line(`:rtype: ${this.renderOptionalValue(method.returns).ref}`); - } - - if (method.abstract) { - this.code.line(':abstract: Yes'); - } - - this.code.closeBlock(); - } - - private renderDocsLine(element: spec.Documentable) { - const doclines = this.renderDocs(element, true); - if (doclines.length === 0) { - return; - } - - this.code.line(); - doclines.split('\n').forEach(line => this.code.line(`${line}\n`)); - - if (element.docs && element.docs.see) { - this.code.line(element.docs.see); - } - - this.code.line(); - } - - private renderDocs(element: spec.Documentable, newlines = false): string { - if (!element.docs) { - return ''; - } - - const lines = new Array(); - if (element.docs.summary) { - lines.push(element.docs.summary); - } - if (element.docs.remarks) { - lines.push(''); - lines.push(element.docs.remarks); - } - - if (newlines) { - return lines.join('\n'); - } - return lines.join('. ').replace(/\n/g, ' '); - - } - - private renderOptionalValue(optionalValue: spec.OptionalValue): { display: string, ref: string } { - const result = this.renderTypeRef(optionalValue.type); - if (optionalValue.optional && !isAny(optionalValue.type)) { - result.ref = `${result.ref} *(optional)*`; - } - return result; - - function isAny(type: spec.TypeReference): boolean { - return spec.isPrimitiveTypeReference(type) - && type.primitive === spec.PrimitiveType.Any; - } - } - - private renderTypeRef(type: spec.TypeReference): { display: string, ref: string } { - let result: { display: string, ref: string }; - if (spec.isNamedTypeReference(type)) { - const fqn = this.toNativeFqn(type.fqn); - result = { - ref: `:py:class:\`${type.fqn.startsWith(`${this.assembly.name}.`) ? '~' : ''}${fqn}\`\\ `, - display: fqn - }; - } else if (spec.isPrimitiveTypeReference(type)) { - result = { - ref: type.primitive, - display: type.primitive - }; - } else if (spec.isCollectionTypeReference(type)) { - const elementType = this.renderTypeRef(type.collection.elementtype); - const ref = wrap(elementType.ref); - const display = wrap(elementType.display); - - switch (type.collection.kind) { - case spec.CollectionKind.Array: - result = { - ref: `${ref}[]`, - display: `${display}[]` - }; - break; - case spec.CollectionKind.Map: - result = { - ref: `string => ${ref}`, - display: `string => ${display}` - }; - break; - default: - throw new Error(`Unexpected collection kind: ${type.collection.kind}`); - } - } else if (spec.isUnionTypeReference(type)) { - const mappedTypes = type.union.types.map(t => this.renderTypeRef(t)); - result = { - display: mappedTypes.map(t => t.display).join(' or '), - ref: mappedTypes.map(t => t.ref).join(' or '), - }; - } else { - throw new Error('Unexpected type ref'); - } - return result; - - // Wrap a string between parenthesis if it contains " or " - function wrap(str: string): string { - if (!str.includes(' or ')) { return str; } - return `(${str})`; - } - } - - private renderProperty(parent: spec.TypeBase, prop: spec.Property, inheritedFrom?: string) { - this.code.line(); - const type = this.renderOptionalValue(prop); - this.code.openBlock(`.. py:attribute:: ${prop.name}`); - if (inheritedFrom) { - this.code.line(); - this.code.line(`*Inherited from* :py:attr:\`${inheritedFrom} <${inheritedFrom}.${prop.name}>\``); - } else if (prop.overrides) { - this.code.line(); - const superType = this.findType(prop.overrides) as spec.ClassType | spec.InterfaceType; - if (spec.isInterfaceType(superType) || superType.properties!.some(p => p.name === prop.name && !!p.abstract)) { - this.code.line(`*Implements* :py:meth:\`${prop.overrides}.${prop.name}\``); - } else { - this.code.line(`*Overrides* :py:attr:\`${prop.overrides}.${prop.name}\``); - } - } - this.renderDocsLine(prop); - this.code.line(); - if (prop.protected) { - this.code.line('*Protected property*'); - this.code.line(); - } - const readonly = prop.immutable ? ' *(readonly)*' : ''; - const abs = parent.kind !== spec.TypeKind.Interface && prop.abstract ? ' *(abstract)*' : ''; - const stat = prop.static ? ' *(static)*' : ''; - this.code.line(`:type: ${type.ref}${readonly}${abs}${stat}`); - - if (prop.docs && prop.docs.default) { - this.code.line(`:default: ${prop.docs.default}`); - } - - this.code.closeBlock(); - } - - private toNativeFqn(name: string): string { - return name; - } - - private renderNames(type: spec.Type) { - this.code.line(); - this.code.line('**Language-specific names:**'); - this.code.line(); - this.code.openBlock('.. tabs::'); - this.code.line(); - - if (this.assembly.targets) { - for (const targetName of Object.keys(this.assembly.targets).sort()) { - if (targetName === 'sphinx') { continue; } - const target = this.targets[targetName]; - if (!target || !target.toNativeReference) { continue; } - const options = this.assembly.targets[targetName]; - - const names = target.toNativeReference(type, options); - for (const language of Object.keys(names).sort()) { - this.code.openBlock(`.. code-tab:: ${language}`); - this.code.line(); - this.code.line(names[language]); - this.code.closeBlock(); - } - } - } - this.code.closeBlock(); - } - - /** - * Emits the README markdown file, while stripping off the first H1 header (if exists). - * @returns readme: the name of the file (or undefined) - * @returns header: the contents of the header (or undefined) - */ - private emitReadme(assm: spec.Assembly): { readmeFile?: string, readmeHeader?: string } { - if (!assm.readme) { - return { - readmeFile: undefined, - readmeHeader: undefined - }; - } - - let lines = assm.readme.markdown.split('\n'); - let readmeHeader; - - if (lines[0].startsWith('# ')) { - readmeHeader = lines[0].substr(2); - lines = lines.slice(1); - } - - const readmeFile = `_${fsSafeName(assm.name)}.README.md`; - this.code.openFile(readmeFile); - this.code.line(lines.join('\n')); - this.code.closeFile(readmeFile); - - return { - readmeFile, - readmeHeader - }; - } -} - -function dup(char: string, times: number) { - let ret = ''; - for (let i = 0; i < times; ++i) { - ret += char; - } - return ret; -} - -/** - * Make a name safe for the file system - */ -function fsSafeName(x: string) { - // Strip unsafe characters - return x.replace(/[^a-zA-Z0-9_.-]/g, '_'); -} - -/** - * Obtains a display-friendly string from a language name. - * - * @param language the language name code (e.g: javascript) - * - * @returns a display-friendly name if possible (e.g: JavaScript) - */ -function formatLanguage(language: string): string { - switch (language) { - case 'csharp': - return 'C#'; - case 'java': - return 'Java'; - case 'javascript': - return 'JavaScript'; - case 'typescript': - return 'TypeScript'; - default: - return language; - } -} - -type InheritedMembers = { [typeFqn: string]: { methods: spec.Method[], properties: spec.Property[] } }; diff --git a/packages/jsii-pacmak/lib/util.ts b/packages/jsii-pacmak/lib/util.ts index 4acf11db80..199d62de73 100644 --- a/packages/jsii-pacmak/lib/util.ts +++ b/packages/jsii-pacmak/lib/util.ts @@ -1,6 +1,7 @@ import { spawn, SpawnOptions } from 'child_process'; import fs = require('fs-extra'); import spec = require('jsii-spec'); +import os = require('os'); import path = require('path'); import logging = require('./logging'); @@ -90,3 +91,33 @@ export async function loadAssembly(modulePath: string): Promise { } return spec.validateAssembly(await fs.readJson(assmPath)); } + +/** + * Class that makes a temporary directory and holds on to an operation object + */ +export class Scratch { + public static async make(factory: (dir: string) => Promise): Promise>; + public static async make(factory: (dir: string) => A): Promise>; + public static async make(factory: (dir: string) => A | Promise) { + const tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), 'npm-pack')); + return new Scratch(tmpdir, await factory(tmpdir), false); + } + + public static fake(directory: string, object: A) { + return new Scratch(directory, object, true); + } + + public static async cleanupAll(tempDirs: Array>) { + await Promise.all(tempDirs + .map(t => t.cleanup())); + } + + private constructor(public readonly directory: string, public readonly object: A, private readonly fake: boolean) { + } + + public async cleanup() { + if (!this.fake) { + await fs.remove(this.directory); + } + } +} \ No newline at end of file diff --git a/packages/jsii-pacmak/test/diff-test.sh b/packages/jsii-pacmak/test/diff-test.sh index 12f29b0963..39d7efc78f 100755 --- a/packages/jsii-pacmak/test/diff-test.sh +++ b/packages/jsii-pacmak/test/diff-test.sh @@ -29,6 +29,11 @@ function assert-generator() { rsync -a ${original_expected}/ ${expected}/ fi + if [[ -d ${original_expected}/java/target ]]; then + echo "An IDE plugin seems to have eagerly tried to compile ${original_expected}/java. Please remove." >&2 + exit 1 + fi + # put the real expected tarball instead of the placeholder for expected_tarball_placeholder in $(find ${expected} -name "*.tgz" || true); do rm -f ${expected_tarball_placeholder} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/.jsii b/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/.jsii index fa01990928..2cce0a3b34 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/.jsii +++ b/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/.jsii @@ -27,8 +27,7 @@ "python": { "distName": "scope.jsii-calc-base-of-base", "module": "scope.jsii_calc_base_of_base" - }, - "sphinx": {} + } }, "version": "0.19.0" } @@ -53,8 +52,7 @@ "python": { "distName": "scope.jsii-calc-base-of-base", "module": "scope.jsii_calc_base_of_base" - }, - "sphinx": {} + } }, "version": "0.19.0" } @@ -88,8 +86,7 @@ "python": { "distName": "scope.jsii-calc-base", "module": "scope.jsii_calc_base" - }, - "sphinx": {} + } }, "types": { "@scope/jsii-calc-base.Base": { @@ -177,5 +174,5 @@ } }, "version": "0.19.0", - "fingerprint": "UzDw4nRR+4fhd01t0ybeUo6SmdnWdfKbE+pTzl/6voQ=" + "fingerprint": "N9LvPVtN5Azr2Ip3FMatwqceL+70AEYPqZk+T7qC/bc=" } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-base/sphinx/_scope_jsii-calc-base.rst b/packages/jsii-pacmak/test/expected.jsii-calc-base/sphinx/_scope_jsii-calc-base.rst deleted file mode 100644 index 3d0a4f0b0d..0000000000 --- a/packages/jsii-pacmak/test/expected.jsii-calc-base/sphinx/_scope_jsii-calc-base.rst +++ /dev/null @@ -1,248 +0,0 @@ -@scope/jsii-calc-base -===================== - -Reference ---------- - -.. tabs:: - - .. group-tab:: C# - - View in `Nuget `_ - - **csproj**: - - .. code-block:: xml - - - - **dotnet**: - - .. code-block:: console - - dotnet add package Amazon.JSII.Tests.CalculatorPackageId.BasePackageId --version 0.19.0 - - **packages.config**: - - .. code-block:: xml - - - - - .. group-tab:: Java - - View in `Maven Central `_ - - **Apache Buildr**: - - .. code-block:: none - - 'software.amazon.jsii.tests:calculator-base:jar:0.19.0' - - **Apache Ivy**: - - .. code-block:: xml - - - - **Apache Maven**: - - .. code-block:: xml - - - software.amazon.jsii.tests - calculator-base - 0.19.0 - - - **Gradle / Grails**: - - .. code-block:: none - - compile 'software.amazon.jsii.tests:calculator-base:0.19.0' - - **Groovy Grape**: - - .. code-block:: none - - @Grapes( - @Grab(group='software.amazon.jsii.tests', module='calculator-base', version='0.19.0') - ) - - - .. group-tab:: JavaScript - - View in `NPM `_ - - **npm**: - - .. code-block:: console - - $ npm i @scope/jsii-calc-base@0.19.0 - - **package.json**: - - .. code-block:: js - - { - "@scope/jsii-calc-base": "^0.19.0" - } - - **yarn**: - - .. code-block:: console - - $ yarn add @scope/jsii-calc-base@0.19.0 - - - .. group-tab:: TypeScript - - View in `NPM `_ - - **npm**: - - .. code-block:: console - - $ npm i @scope/jsii-calc-base@0.19.0 - - **package.json**: - - .. code-block:: js - - { - "@scope/jsii-calc-base": "^0.19.0" - } - - **yarn**: - - .. code-block:: console - - $ yarn add @scope/jsii-calc-base@0.19.0 - - - -.. py:module:: @scope/jsii-calc-base - -Base -^^^^ - -.. py:class:: Base() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace.BaseNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.base.Base; - - .. code-tab:: javascript - - const { Base } = require('@scope/jsii-calc-base'); - - .. code-tab:: typescript - - import { Base } from '@scope/jsii-calc-base'; - - - - A base class. - - - - :abstract: Yes - - .. py:method:: typeName() -> any - - :return: the name of the class (to verify native type names are created for derived classes). - :rtype: any - - -BaseProps (interface) -^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: BaseProps - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace.BaseNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.base.BaseProps; - - .. code-tab:: javascript - - // BaseProps is an interface - - .. code-tab:: typescript - - import { BaseProps } from '@scope/jsii-calc-base'; - - - - :extends: :py:class:`@scope/jsii-calc-base-of-base.VeryBaseProps`\ - - - .. py:attribute:: bar - - :type: string *(readonly)* - - - .. py:attribute:: foo - - *Inherited from* :py:attr:`@scope/jsii-calc-base-of-base.VeryBaseProps <@scope/jsii-calc-base-of-base.VeryBaseProps.foo>` - - :type: :py:class:`@scope/jsii-calc-base-of-base.Very`\ *(readonly)* - - -IBaseInterface (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: IBaseInterface - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace.BaseNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.base.IBaseInterface; - - .. code-tab:: javascript - - // IBaseInterface is an interface - - .. code-tab:: typescript - - import { IBaseInterface } from '@scope/jsii-calc-base'; - - - - :extends: :py:class:`@scope/jsii-calc-base-of-base.IVeryBaseInterface`\ - - - .. py:method:: bar() - - :abstract: Yes - - - .. py:method:: foo() - - *Inherited from* :py:meth:`@scope/jsii-calc-base-of-base.IVeryBaseInterface <@scope/jsii-calc-base-of-base.IVeryBaseInterface.foo>` - - :abstract: Yes - - diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/.jsii b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/.jsii index 684d6bdabd..3ce44f8214 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/.jsii +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/.jsii @@ -27,8 +27,7 @@ "python": { "distName": "scope.jsii-calc-base", "module": "scope.jsii_calc_base" - }, - "sphinx": {} + } }, "version": "0.19.0" } @@ -53,8 +52,7 @@ "python": { "distName": "scope.jsii-calc-base", "module": "scope.jsii_calc_base" - }, - "sphinx": {} + } }, "version": "0.19.0" }, @@ -77,8 +75,7 @@ "python": { "distName": "scope.jsii-calc-base-of-base", "module": "scope.jsii_calc_base_of_base" - }, - "sphinx": {} + } }, "version": "0.19.0" } @@ -118,8 +115,7 @@ "python": { "distName": "scope.jsii-calc-lib", "module": "scope.jsii_calc_lib" - }, - "sphinx": {} + } }, "types": { "@scope/jsii-calc-lib.EnumFromScopedModule": { @@ -543,5 +539,5 @@ } }, "version": "0.19.0", - "fingerprint": "fTZVmFlDa7uoeJF41GTcIhD33vnnyxZOgxCeZ1hIvSk=" + "fingerprint": "rS2rGvy6Ma6wo/1JfCpR21CQsx8P5YmdtrxJ5EjgXxs=" } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/sphinx/_scope_jsii-calc-lib.rst b/packages/jsii-pacmak/test/expected.jsii-calc-lib/sphinx/_scope_jsii-calc-lib.rst deleted file mode 100644 index 51e1759e4d..0000000000 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/sphinx/_scope_jsii-calc-lib.rst +++ /dev/null @@ -1,617 +0,0 @@ -@scope/jsii-calc-lib -==================== - -Reference ---------- - -.. tabs:: - - .. group-tab:: C# - - View in `Nuget `_ - - **csproj**: - - .. code-block:: xml - - - - **dotnet**: - - .. code-block:: console - - dotnet add package Amazon.JSII.Tests.CalculatorPackageId.LibPackageId --version 0.19.0 - - **packages.config**: - - .. code-block:: xml - - - - - .. group-tab:: Java - - View in `Maven Central `_ - - **Apache Buildr**: - - .. code-block:: none - - 'software.amazon.jsii.tests:calculator-lib:jar:0.19.0' - - **Apache Ivy**: - - .. code-block:: xml - - - - **Apache Maven**: - - .. code-block:: xml - - - software.amazon.jsii.tests - calculator-lib - 0.19.0 - - - **Gradle / Grails**: - - .. code-block:: none - - compile 'software.amazon.jsii.tests:calculator-lib:0.19.0' - - **Groovy Grape**: - - .. code-block:: none - - @Grapes( - @Grab(group='software.amazon.jsii.tests', module='calculator-lib', version='0.19.0') - ) - - - .. group-tab:: JavaScript - - View in `NPM `_ - - **npm**: - - .. code-block:: console - - $ npm i @scope/jsii-calc-lib@0.19.0 - - **package.json**: - - .. code-block:: js - - { - "@scope/jsii-calc-lib": "^0.19.0" - } - - **yarn**: - - .. code-block:: console - - $ yarn add @scope/jsii-calc-lib@0.19.0 - - - .. group-tab:: TypeScript - - View in `NPM `_ - - **npm**: - - .. code-block:: console - - $ npm i @scope/jsii-calc-lib@0.19.0 - - **package.json**: - - .. code-block:: js - - { - "@scope/jsii-calc-lib": "^0.19.0" - } - - **yarn**: - - .. code-block:: console - - $ yarn add @scope/jsii-calc-lib@0.19.0 - - - -.. py:module:: @scope/jsii-calc-lib - -EnumFromScopedModule (enum) -^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: EnumFromScopedModule - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace.LibNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.lib.EnumFromScopedModule; - - .. code-tab:: javascript - - const { EnumFromScopedModule } = require('@scope/jsii-calc-lib'); - - .. code-tab:: typescript - - import { EnumFromScopedModule } from '@scope/jsii-calc-lib'; - - - - Check that enums from \@scoped packages can be references. See awslabs/jsii#138. - - - - .. py:data:: VALUE1 - - .. py:data:: VALUE2 - - -IDoublable (interface) -^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: IDoublable - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace.LibNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.lib.IDoublable; - - .. code-tab:: javascript - - // IDoublable is an interface - - .. code-tab:: typescript - - import { IDoublable } from '@scope/jsii-calc-lib'; - - - - The general contract for a concrete number. - - - - - - .. py:attribute:: doubleValue - - :type: number *(readonly)* - - -IFriendly (interface) -^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: IFriendly - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace.LibNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.lib.IFriendly; - - .. code-tab:: javascript - - // IFriendly is an interface - - .. code-tab:: typescript - - import { IFriendly } from '@scope/jsii-calc-lib'; - - - - Applies to classes that are considered friendly. - - - - These classes can be greeted with - - a "hello" or "goodbye" blessing and they will respond back in a fun and friendly manner. - - - - - - .. py:method:: hello() -> string - - Say hello! - - - - :rtype: string - :abstract: Yes - - -IThreeLevelsInterface (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: IThreeLevelsInterface - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace.LibNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.lib.IThreeLevelsInterface; - - .. code-tab:: javascript - - // IThreeLevelsInterface is an interface - - .. code-tab:: typescript - - import { IThreeLevelsInterface } from '@scope/jsii-calc-lib'; - - - - Interface that inherits from packages 2 levels up the tree. - - - - Their presence validates that .NET/Java/jsii-reflect can track all fields - - far enough up the tree. - - - - :extends: :py:class:`@scope/jsii-calc-base.IBaseInterface`\ - - - .. py:method:: baz() - - :abstract: Yes - - - .. py:method:: foo() - - *Inherited from* :py:meth:`@scope/jsii-calc-base-of-base.IVeryBaseInterface <@scope/jsii-calc-base-of-base.IVeryBaseInterface.foo>` - - :abstract: Yes - - - .. py:method:: bar() - - *Inherited from* :py:meth:`@scope/jsii-calc-base.IBaseInterface <@scope/jsii-calc-base.IBaseInterface.bar>` - - :abstract: Yes - - -MyFirstStruct (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: MyFirstStruct - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace.LibNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.lib.MyFirstStruct; - - .. code-tab:: javascript - - // MyFirstStruct is an interface - - .. code-tab:: typescript - - import { MyFirstStruct } from '@scope/jsii-calc-lib'; - - - - This is the first struct we have created in jsii. - - - - - - .. py:attribute:: anumber - - An awesome number value. - - - - :type: number *(readonly)* - - - .. py:attribute:: astring - - A string value. - - - - :type: string *(readonly)* - - - .. py:attribute:: firstOptional - - :type: string[] *(optional)* *(readonly)* - - -Number -^^^^^^ - -.. py:class:: Number(value) - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace.LibNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.lib.Number; - - .. code-tab:: javascript - - const { Number } = require('@scope/jsii-calc-lib'); - - .. code-tab:: typescript - - import { Number } from '@scope/jsii-calc-lib'; - - - - Represents a concrete number. - - - - :extends: :py:class:`~@scope/jsii-calc-lib.Value`\ - :implements: :py:class:`~@scope/jsii-calc-lib.IDoublable`\ - :param value: The number. - :type value: number - - .. py:attribute:: doubleValue - - *Implements* :py:meth:`@scope/jsii-calc-lib.IDoublable.doubleValue` - - The number multiplied by 2. - - - - :type: number *(readonly)* - - - .. py:attribute:: value - - *Implements* :py:meth:`@scope/jsii-calc-lib.Value.value` - - The number. - - - - :type: number *(readonly)* - - - .. py:method:: typeName() -> any - - *Inherited from* :py:meth:`@scope/jsii-calc-base.Base <@scope/jsii-calc-base.Base.typeName>` - - :return: the name of the class (to verify native type names are created for derived classes). - :rtype: any - - - .. py:method:: toString() -> string - - *Inherited from* :py:meth:`@scope/jsii-calc-lib.Value <@scope/jsii-calc-lib.Value.toString>` - - String representation of the value. - - - - :rtype: string - - -Operation -^^^^^^^^^ - -.. py:class:: Operation() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace.LibNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.lib.Operation; - - .. code-tab:: javascript - - const { Operation } = require('@scope/jsii-calc-lib'); - - .. code-tab:: typescript - - import { Operation } from '@scope/jsii-calc-lib'; - - - - Represents an operation on values. - - - - :extends: :py:class:`~@scope/jsii-calc-lib.Value`\ - :abstract: Yes - - .. py:method:: toString() -> string - - *Overrides* :py:meth:`@scope/jsii-calc-lib.Value.toString` - - String representation of the value. - - - - :rtype: string - :abstract: Yes - - - .. py:method:: typeName() -> any - - *Inherited from* :py:meth:`@scope/jsii-calc-base.Base <@scope/jsii-calc-base.Base.typeName>` - - :return: the name of the class (to verify native type names are created for derived classes). - :rtype: any - - - .. py:attribute:: value - - *Inherited from* :py:attr:`@scope/jsii-calc-lib.Value <@scope/jsii-calc-lib.Value.value>` - - The value. - - - - :type: number *(readonly)* *(abstract)* - - -StructWithOnlyOptionals (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: StructWithOnlyOptionals - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace.LibNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.lib.StructWithOnlyOptionals; - - .. code-tab:: javascript - - // StructWithOnlyOptionals is an interface - - .. code-tab:: typescript - - import { StructWithOnlyOptionals } from '@scope/jsii-calc-lib'; - - - - This is a struct with only optional properties. - - - - - - .. py:attribute:: optional1 - - The first optional! - - - - :type: string *(optional)* *(readonly)* - - - .. py:attribute:: optional2 - - :type: number *(optional)* *(readonly)* - - - .. py:attribute:: optional3 - - :type: boolean *(optional)* *(readonly)* - - -Value -^^^^^ - -.. py:class:: Value() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace.LibNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.lib.Value; - - .. code-tab:: javascript - - const { Value } = require('@scope/jsii-calc-lib'); - - .. code-tab:: typescript - - import { Value } from '@scope/jsii-calc-lib'; - - - - Abstract class which represents a numeric value. - - - - :extends: :py:class:`@scope/jsii-calc-base.Base`\ - :abstract: Yes - - .. py:method:: toString() -> string - - String representation of the value. - - - - :rtype: string - - - .. py:attribute:: value - - The value. - - - - :type: number *(readonly)* *(abstract)* - - - .. py:method:: typeName() -> any - - *Inherited from* :py:meth:`@scope/jsii-calc-base.Base <@scope/jsii-calc-base.Base.typeName>` - - :return: the name of the class (to verify native type names are created for derived classes). - :rtype: any - - diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/.jsii b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/.jsii index 24a1fc2261..c42118335e 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/.jsii +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/.jsii @@ -53,8 +53,7 @@ "python": { "distName": "scope.jsii-calc-base", "module": "scope.jsii_calc_base" - }, - "sphinx": {} + } }, "version": "0.19.0" }, @@ -77,8 +76,7 @@ "python": { "distName": "scope.jsii-calc-base-of-base", "module": "scope.jsii_calc_base_of_base" - }, - "sphinx": {} + } }, "version": "0.19.0" }, @@ -103,8 +101,7 @@ "python": { "distName": "scope.jsii-calc-lib", "module": "scope.jsii_calc_lib" - }, - "sphinx": {} + } }, "version": "0.19.0" } @@ -129,8 +126,7 @@ "python": { "distName": "scope.jsii-calc-base", "module": "scope.jsii_calc_base" - }, - "sphinx": {} + } }, "version": "0.19.0" }, @@ -153,8 +149,7 @@ "python": { "distName": "scope.jsii-calc-base-of-base", "module": "scope.jsii_calc_base_of_base" - }, - "sphinx": {} + } }, "version": "0.19.0" }, @@ -179,8 +174,7 @@ "python": { "distName": "scope.jsii-calc-lib", "module": "scope.jsii_calc_lib" - }, - "sphinx": {} + } }, "version": "0.19.0" } @@ -228,8 +222,7 @@ "python": { "distName": "jsii-calc", "module": "jsii_calc" - }, - "sphinx": {} + } }, "types": { "jsii-calc.AbstractClass": { @@ -9617,5 +9610,5 @@ } }, "version": "0.19.0", - "fingerprint": "z0M8ATIlYi8ohIQB7KR90oh4pKmIb3EdBoPgS3/lyHM=" + "fingerprint": "nQMF6ipA96E38PvG3NsgKOJIb3ZEit4jNrxZAkgRlbs=" } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/sphinx/_jsii-calc.README.md b/packages/jsii-pacmak/test/expected.jsii-calc/sphinx/_jsii-calc.README.md deleted file mode 100644 index 1faacccaac..0000000000 --- a/packages/jsii-pacmak/test/expected.jsii-calc/sphinx/_jsii-calc.README.md +++ /dev/null @@ -1,18 +0,0 @@ - -This library is used to demonstrate and test the features of JSII - -## Sphinx - -This file will be incorporated into the sphinx documentation. - -If this file starts with an "H1" line (in our case `# jsii Calculator`), this -heading will be used as the Sphinx topic name. Otherwise, the name of the module -(`jsii-calc`) will be used instead. - -## Code Samples - -```ts -/* This is totes a magic comment in here, just you wait! */ -const foo = 'bar'; -``` - diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/sphinx/jsii-calc.rst b/packages/jsii-pacmak/test/expected.jsii-calc/sphinx/jsii-calc.rst deleted file mode 100644 index 6c7f20a8d0..0000000000 --- a/packages/jsii-pacmak/test/expected.jsii-calc/sphinx/jsii-calc.rst +++ /dev/null @@ -1,7771 +0,0 @@ -jsii Calculator -=============== - -.. mdinclude:: ./_jsii-calc.README.md - -Reference ---------- - -.. tabs:: - - .. group-tab:: C# - - View in `Nuget `_ - - **csproj**: - - .. code-block:: xml - - - - **dotnet**: - - .. code-block:: console - - dotnet add package Amazon.JSII.Tests.CalculatorPackageId --version 0.19.0 - - **packages.config**: - - .. code-block:: xml - - - - - .. group-tab:: Java - - View in `Maven Central `_ - - **Apache Buildr**: - - .. code-block:: none - - 'software.amazon.jsii.tests:calculator:jar:0.19.0' - - **Apache Ivy**: - - .. code-block:: xml - - - - **Apache Maven**: - - .. code-block:: xml - - - software.amazon.jsii.tests - calculator - 0.19.0 - - - **Gradle / Grails**: - - .. code-block:: none - - compile 'software.amazon.jsii.tests:calculator:0.19.0' - - **Groovy Grape**: - - .. code-block:: none - - @Grapes( - @Grab(group='software.amazon.jsii.tests', module='calculator', version='0.19.0') - ) - - - .. group-tab:: JavaScript - - View in `NPM `_ - - **npm**: - - .. code-block:: console - - $ npm i jsii-calc@0.19.0 - - **package.json**: - - .. code-block:: js - - { - "jsii-calc": "^0.19.0" - } - - **yarn**: - - .. code-block:: console - - $ yarn add jsii-calc@0.19.0 - - - .. group-tab:: TypeScript - - View in `NPM `_ - - **npm**: - - .. code-block:: console - - $ npm i jsii-calc@0.19.0 - - **package.json**: - - .. code-block:: js - - { - "jsii-calc": "^0.19.0" - } - - **yarn**: - - .. code-block:: console - - $ yarn add jsii-calc@0.19.0 - - - -.. py:module:: jsii-calc - -AbstractClass -^^^^^^^^^^^^^ - -.. py:class:: AbstractClass() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.AbstractClass; - - .. code-tab:: javascript - - const { AbstractClass } = require('jsii-calc'); - - .. code-tab:: typescript - - import { AbstractClass } from 'jsii-calc'; - - - - :extends: :py:class:`~jsii-calc.AbstractClassBase`\ - :implements: :py:class:`~jsii-calc.IInterfaceImplementedByAbstractClass`\ - :abstract: Yes - - .. py:method:: abstractMethod(name) -> string - - :param name: - :type name: string - :rtype: string - :abstract: Yes - - - .. py:method:: nonAbstractMethod() -> number - - :rtype: number - - - .. py:attribute:: propFromInterface - - *Implements* :py:meth:`jsii-calc.IInterfaceImplementedByAbstractClass.propFromInterface` - - :type: string *(readonly)* - - - .. py:attribute:: abstractProperty - - *Inherited from* :py:attr:`jsii-calc.AbstractClassBase ` - - :type: string *(readonly)* *(abstract)* - - -AbstractClassBase -^^^^^^^^^^^^^^^^^ - -.. py:class:: AbstractClassBase() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.AbstractClassBase; - - .. code-tab:: javascript - - const { AbstractClassBase } = require('jsii-calc'); - - .. code-tab:: typescript - - import { AbstractClassBase } from 'jsii-calc'; - - - - :abstract: Yes - - .. py:attribute:: abstractProperty - - :type: string *(readonly)* *(abstract)* - - -AbstractClassReturner -^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: AbstractClassReturner() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.AbstractClassReturner; - - .. code-tab:: javascript - - const { AbstractClassReturner } = require('jsii-calc'); - - .. code-tab:: typescript - - import { AbstractClassReturner } from 'jsii-calc'; - - - - - .. py:method:: giveMeAbstract() -> jsii-calc.AbstractClass - - :rtype: :py:class:`~jsii-calc.AbstractClass`\ - - - .. py:method:: giveMeInterface() -> jsii-calc.IInterfaceImplementedByAbstractClass - - :rtype: :py:class:`~jsii-calc.IInterfaceImplementedByAbstractClass`\ - - - .. py:attribute:: returnAbstractFromProperty - - :type: :py:class:`~jsii-calc.AbstractClassBase`\ *(readonly)* - - -Add -^^^ - -.. py:class:: Add(lhs, rhs) - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.Add; - - .. code-tab:: javascript - - const { Add } = require('jsii-calc'); - - .. code-tab:: typescript - - import { Add } from 'jsii-calc'; - - - - The "+" binary operation. - - - - :extends: :py:class:`~jsii-calc.BinaryOperation`\ - :param lhs: Left-hand side operand. - :type lhs: :py:class:`@scope/jsii-calc-lib.Value`\ - :param rhs: Right-hand side operand. - :type rhs: :py:class:`@scope/jsii-calc-lib.Value`\ - - .. py:method:: toString() -> string - - *Implements* :py:meth:`@scope/jsii-calc-lib.Operation.toString` - - String representation of the value. - - - - :rtype: string - - - .. py:attribute:: value - - *Implements* :py:meth:`@scope/jsii-calc-lib.Value.value` - - The value. - - - - :type: number *(readonly)* - - - .. py:method:: typeName() -> any - - *Inherited from* :py:meth:`@scope/jsii-calc-base.Base <@scope/jsii-calc-base.Base.typeName>` - - :return: the name of the class (to verify native type names are created for derived classes). - :rtype: any - - - .. py:method:: hello() -> string - - *Inherited from* :py:meth:`jsii-calc.BinaryOperation ` - - Say hello! - - - - :rtype: string - - - .. py:attribute:: lhs - - *Inherited from* :py:attr:`jsii-calc.BinaryOperation ` - - Left-hand side operand. - - - - :type: :py:class:`@scope/jsii-calc-lib.Value`\ *(readonly)* - - - .. py:attribute:: rhs - - *Inherited from* :py:attr:`jsii-calc.BinaryOperation ` - - Right-hand side operand. - - - - :type: :py:class:`@scope/jsii-calc-lib.Value`\ *(readonly)* - - -AllTypes -^^^^^^^^ - -.. py:class:: AllTypes() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.AllTypes; - - .. code-tab:: javascript - - const { AllTypes } = require('jsii-calc'); - - .. code-tab:: typescript - - import { AllTypes } from 'jsii-calc'; - - - - This class includes property for all types supported by jsii. - - - - The setters will validate - - that the value set is of the expected type and throw otherwise. - - - - - .. py:method:: anyIn(inp) - - :param inp: - :type inp: any - - - .. py:method:: anyOut() -> any - - :rtype: any - - - .. py:method:: enumMethod(value) -> jsii-calc.StringEnum - - :param value: - :type value: :py:class:`~jsii-calc.StringEnum`\ - :rtype: :py:class:`~jsii-calc.StringEnum`\ - - - .. py:attribute:: enumPropertyValue - - :type: number *(readonly)* - - - .. py:attribute:: anyArrayProperty - - :type: any[] - - - .. py:attribute:: anyMapProperty - - :type: string => any - - - .. py:attribute:: anyProperty - - :type: any - - - .. py:attribute:: arrayProperty - - :type: string[] - - - .. py:attribute:: booleanProperty - - :type: boolean - - - .. py:attribute:: dateProperty - - :type: date - - - .. py:attribute:: enumProperty - - :type: :py:class:`~jsii-calc.AllTypesEnum`\ - - - .. py:attribute:: jsonProperty - - :type: json - - - .. py:attribute:: mapProperty - - :type: string => :py:class:`@scope/jsii-calc-lib.Number`\ - - - .. py:attribute:: numberProperty - - :type: number - - - .. py:attribute:: stringProperty - - :type: string - - - .. py:attribute:: unionArrayProperty - - :type: (number or :py:class:`@scope/jsii-calc-lib.Value`\ )[] - - - .. py:attribute:: unionMapProperty - - :type: string => (string or number or :py:class:`@scope/jsii-calc-lib.Number`\ ) - - - .. py:attribute:: unionProperty - - :type: string or number or :py:class:`~jsii-calc.Multiply`\ or :py:class:`@scope/jsii-calc-lib.Number`\ - - - .. py:attribute:: unknownArrayProperty - - :type: any[] - - - .. py:attribute:: unknownMapProperty - - :type: string => any - - - .. py:attribute:: unknownProperty - - :type: any - - - .. py:attribute:: optionalEnumValue - - :type: :py:class:`~jsii-calc.StringEnum`\ *(optional)* - - -AllTypesEnum (enum) -^^^^^^^^^^^^^^^^^^^ - -.. py:class:: AllTypesEnum - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.AllTypesEnum; - - .. code-tab:: javascript - - const { AllTypesEnum } = require('jsii-calc'); - - .. code-tab:: typescript - - import { AllTypesEnum } from 'jsii-calc'; - - - - .. py:data:: MY_ENUM_VALUE - - .. py:data:: YOUR_ENUM_VALUE - - .. py:data:: THIS_IS_GREAT - - -AllowedMethodNames -^^^^^^^^^^^^^^^^^^ - -.. py:class:: AllowedMethodNames() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.AllowedMethodNames; - - .. code-tab:: javascript - - const { AllowedMethodNames } = require('jsii-calc'); - - .. code-tab:: typescript - - import { AllowedMethodNames } from 'jsii-calc'; - - - - - .. py:method:: getBar(_p1, _p2) - - :param _p1: - :type _p1: string - :param _p2: - :type _p2: number - - - .. py:method:: getFoo(withParam) -> string - - getXxx() is not allowed (see negatives), but getXxx(a, ...) is okay. - - - - :param withParam: - :type withParam: string - :rtype: string - - - .. py:method:: setBar(_x, _y, _z) - - :param _x: - :type _x: string - :param _y: - :type _y: number - :param _z: - :type _z: boolean - - - .. py:method:: setFoo(_x, _y) - - setFoo(x) is not allowed (see negatives), but setXxx(a, b, ...) is okay. - - - - :param _x: - :type _x: string - :param _y: - :type _y: number - - -AsyncVirtualMethods -^^^^^^^^^^^^^^^^^^^ - -.. py:class:: AsyncVirtualMethods() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.AsyncVirtualMethods; - - .. code-tab:: javascript - - const { AsyncVirtualMethods } = require('jsii-calc'); - - .. code-tab:: typescript - - import { AsyncVirtualMethods } from 'jsii-calc'; - - - - - .. py:method:: callMe() -> number - - :rtype: number - - - .. py:method:: callMe2() -> number - - Just calls "overrideMeToo". - - - - :rtype: number - - - .. py:method:: callMeDoublePromise() -> number - - This method calls the "callMe" async method indirectly, which will then invoke a virtual method. - - - - This is a "double promise" situation, which - - means that callbacks are not going to be available immediate, but only - - after an "immediates" cycle. - - - - :rtype: number - - - .. py:method:: dontOverrideMe() -> number - - :rtype: number - - - .. py:method:: overrideMe(mult) -> number - - :param mult: - :type mult: number - :rtype: number - - - .. py:method:: overrideMeToo() -> number - - :rtype: number - - -AugmentableClass -^^^^^^^^^^^^^^^^ - -.. py:class:: AugmentableClass() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.AugmentableClass; - - .. code-tab:: javascript - - const { AugmentableClass } = require('jsii-calc'); - - .. code-tab:: typescript - - import { AugmentableClass } from 'jsii-calc'; - - - - - .. py:method:: methodOne() - - - - .. py:method:: methodTwo() - - - -BinaryOperation -^^^^^^^^^^^^^^^ - -.. py:class:: BinaryOperation(lhs, rhs) - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.BinaryOperation; - - .. code-tab:: javascript - - const { BinaryOperation } = require('jsii-calc'); - - .. code-tab:: typescript - - import { BinaryOperation } from 'jsii-calc'; - - - - Represents an operation with two operands. - - - - :extends: :py:class:`@scope/jsii-calc-lib.Operation`\ - :implements: :py:class:`@scope/jsii-calc-lib.IFriendly`\ - :abstract: Yes - :param lhs: Left-hand side operand. - :type lhs: :py:class:`@scope/jsii-calc-lib.Value`\ - :param rhs: Right-hand side operand. - :type rhs: :py:class:`@scope/jsii-calc-lib.Value`\ - - .. py:method:: hello() -> string - - *Implements* :py:meth:`@scope/jsii-calc-lib.IFriendly.hello` - - Say hello! - - - - :rtype: string - - - .. py:attribute:: lhs - - Left-hand side operand. - - - - :type: :py:class:`@scope/jsii-calc-lib.Value`\ *(readonly)* - - - .. py:attribute:: rhs - - Right-hand side operand. - - - - :type: :py:class:`@scope/jsii-calc-lib.Value`\ *(readonly)* - - - .. py:method:: typeName() -> any - - *Inherited from* :py:meth:`@scope/jsii-calc-base.Base <@scope/jsii-calc-base.Base.typeName>` - - :return: the name of the class (to verify native type names are created for derived classes). - :rtype: any - - - .. py:method:: toString() -> string - - *Inherited from* :py:meth:`@scope/jsii-calc-lib.Operation <@scope/jsii-calc-lib.Operation.toString>` - - String representation of the value. - - - - :rtype: string - :abstract: Yes - - - .. py:attribute:: value - - *Inherited from* :py:attr:`@scope/jsii-calc-lib.Value <@scope/jsii-calc-lib.Value.value>` - - The value. - - - - :type: number *(readonly)* *(abstract)* - - -Calculator -^^^^^^^^^^ - -.. py:class:: Calculator([props]) - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.Calculator; - - .. code-tab:: javascript - - const { Calculator } = require('jsii-calc'); - - .. code-tab:: typescript - - import { Calculator } from 'jsii-calc'; - - - - A calculator which maintains a current value and allows adding operations. - - - - :extends: :py:class:`~jsii-calc.composition.CompositeOperation`\ - :param props: Initialization properties. - :type props: :py:class:`~jsii-calc.CalculatorProps`\ - - .. py:method:: add(value) - - Adds a number to the current value. - - - - :param value: - :type value: number - - - .. py:method:: mul(value) - - Multiplies the current value by a number. - - - - :param value: - :type value: number - - - .. py:method:: neg() - - Negates the current value. - - - - - - .. py:method:: pow(value) - - Raises the current value by a power. - - - - :param value: - :type value: number - - - .. py:method:: readUnionValue() -> number - - Returns teh value of the union property (if defined). - - - - :rtype: number - - - .. py:attribute:: expression - - *Implements* :py:meth:`jsii-calc.composition.CompositeOperation.expression` - - Returns the expression. - - - - :type: :py:class:`@scope/jsii-calc-lib.Value`\ *(readonly)* - - - .. py:attribute:: operationsLog - - A log of all operations. - - - - :type: :py:class:`@scope/jsii-calc-lib.Value`\ [] *(readonly)* - - - .. py:attribute:: operationsMap - - A map of per operation name of all operations performed. - - - - :type: string => :py:class:`@scope/jsii-calc-lib.Value`\ [] *(readonly)* - - - .. py:attribute:: curr - - The current value. - - - - :type: :py:class:`@scope/jsii-calc-lib.Value`\ - - - .. py:attribute:: maxValue - - The maximum value allows in this calculator. - - - - :type: number *(optional)* - - - .. py:attribute:: unionProperty - - Example of a property that accepts a union of types. - - - - :type: :py:class:`~jsii-calc.Add`\ or :py:class:`~jsii-calc.Multiply`\ or :py:class:`~jsii-calc.Power`\ *(optional)* - - - .. py:method:: typeName() -> any - - *Inherited from* :py:meth:`@scope/jsii-calc-base.Base <@scope/jsii-calc-base.Base.typeName>` - - :return: the name of the class (to verify native type names are created for derived classes). - :rtype: any - - - .. py:method:: toString() -> string - - *Inherited from* :py:meth:`jsii-calc.composition.CompositeOperation ` - - String representation of the value. - - - - :rtype: string - - - .. py:attribute:: value - - *Inherited from* :py:attr:`jsii-calc.composition.CompositeOperation ` - - The value. - - - - :type: number *(readonly)* - - - .. py:attribute:: decorationPostfixes - - *Inherited from* :py:attr:`jsii-calc.composition.CompositeOperation ` - - A set of postfixes to include in a decorated .toString(). - - - - :type: string[] - - - .. py:attribute:: decorationPrefixes - - *Inherited from* :py:attr:`jsii-calc.composition.CompositeOperation ` - - A set of prefixes to include in a decorated .toString(). - - - - :type: string[] - - - .. py:attribute:: stringStyle - - *Inherited from* :py:attr:`jsii-calc.composition.CompositeOperation ` - - The .toString() style. - - - - :type: :py:class:`~jsii-calc.composition.CompositeOperation.CompositionStringStyle`\ - - -CalculatorProps (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: CalculatorProps - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.CalculatorProps; - - .. code-tab:: javascript - - // CalculatorProps is an interface - - .. code-tab:: typescript - - import { CalculatorProps } from 'jsii-calc'; - - - - Properties for Calculator. - - - - - - .. py:attribute:: initialValue - - :type: number *(optional)* *(readonly)* - - - .. py:attribute:: maximumValue - - :type: number *(optional)* *(readonly)* - - -ClassThatImplementsTheInternalInterface -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: ClassThatImplementsTheInternalInterface() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.ClassThatImplementsTheInternalInterface; - - .. code-tab:: javascript - - const { ClassThatImplementsTheInternalInterface } = require('jsii-calc'); - - .. code-tab:: typescript - - import { ClassThatImplementsTheInternalInterface } from 'jsii-calc'; - - - - :implements: :py:class:`~jsii-calc.INonInternalInterface`\ - - .. py:attribute:: a - - *Implements* :py:meth:`jsii-calc.IAnotherPublicInterface.a` - - :type: string - - - .. py:attribute:: b - - *Implements* :py:meth:`jsii-calc.INonInternalInterface.b` - - :type: string - - - .. py:attribute:: c - - *Implements* :py:meth:`jsii-calc.INonInternalInterface.c` - - :type: string - - - .. py:attribute:: d - - :type: string - - -ClassThatImplementsThePrivateInterface -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: ClassThatImplementsThePrivateInterface() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.ClassThatImplementsThePrivateInterface; - - .. code-tab:: javascript - - const { ClassThatImplementsThePrivateInterface } = require('jsii-calc'); - - .. code-tab:: typescript - - import { ClassThatImplementsThePrivateInterface } from 'jsii-calc'; - - - - :implements: :py:class:`~jsii-calc.INonInternalInterface`\ - - .. py:attribute:: a - - *Implements* :py:meth:`jsii-calc.IAnotherPublicInterface.a` - - :type: string - - - .. py:attribute:: b - - *Implements* :py:meth:`jsii-calc.INonInternalInterface.b` - - :type: string - - - .. py:attribute:: c - - *Implements* :py:meth:`jsii-calc.INonInternalInterface.c` - - :type: string - - - .. py:attribute:: e - - :type: string - - -ClassWithCollections -^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: ClassWithCollections(map, array) - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.ClassWithCollections; - - .. code-tab:: javascript - - const { ClassWithCollections } = require('jsii-calc'); - - .. code-tab:: typescript - - import { ClassWithCollections } from 'jsii-calc'; - - - - :param map: - :type map: string => string - :param array: - :type array: string[] - - .. py:staticmethod:: createAList() -> string[] - - :rtype: string[] - - - .. py:staticmethod:: createAMap() -> string => string - - :rtype: string => string - - - .. py:attribute:: staticArray - - :type: string[] *(static)* - - - .. py:attribute:: staticMap - - :type: string => string *(static)* - - - .. py:attribute:: array - - :type: string[] - - - .. py:attribute:: map - - :type: string => string - - -ClassWithDocs -^^^^^^^^^^^^^ - -.. py:class:: ClassWithDocs() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.ClassWithDocs; - - .. code-tab:: javascript - - const { ClassWithDocs } = require('jsii-calc'); - - .. code-tab:: typescript - - import { ClassWithDocs } from 'jsii-calc'; - - - - This class has docs. - - - - The docs are great. They're a bunch of tags. - - https://aws.amazon.com/ - - - -ClassWithJavaReservedWords -^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: ClassWithJavaReservedWords(int) - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.ClassWithJavaReservedWords; - - .. code-tab:: javascript - - const { ClassWithJavaReservedWords } = require('jsii-calc'); - - .. code-tab:: typescript - - import { ClassWithJavaReservedWords } from 'jsii-calc'; - - - - :param int: - :type int: string - - .. py:method:: import(assert) -> string - - :param assert: - :type assert: string - :rtype: string - - - .. py:attribute:: int - - :type: string *(readonly)* - - -ClassWithMutableObjectLiteralProperty -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: ClassWithMutableObjectLiteralProperty() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.ClassWithMutableObjectLiteralProperty; - - .. code-tab:: javascript - - const { ClassWithMutableObjectLiteralProperty } = require('jsii-calc'); - - .. code-tab:: typescript - - import { ClassWithMutableObjectLiteralProperty } from 'jsii-calc'; - - - - - .. py:attribute:: mutableObject - - :type: :py:class:`~jsii-calc.IMutableObjectLiteral`\ - - -ClassWithPrivateConstructorAndAutomaticProperties -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: ClassWithPrivateConstructorAndAutomaticProperties - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.ClassWithPrivateConstructorAndAutomaticProperties; - - .. code-tab:: javascript - - const { ClassWithPrivateConstructorAndAutomaticProperties } = require('jsii-calc'); - - .. code-tab:: typescript - - import { ClassWithPrivateConstructorAndAutomaticProperties } from 'jsii-calc'; - - - - Class that implements interface properties automatically, but using a private constructor. - - - - :implements: :py:class:`~jsii-calc.IInterfaceWithProperties`\ - - .. py:staticmethod:: create(readOnlyString, readWriteString) -> jsii-calc.ClassWithPrivateConstructorAndAutomaticProperties - - :param readOnlyString: - :type readOnlyString: string - :param readWriteString: - :type readWriteString: string - :rtype: :py:class:`~jsii-calc.ClassWithPrivateConstructorAndAutomaticProperties`\ - - - .. py:attribute:: readOnlyString - - *Implements* :py:meth:`jsii-calc.IInterfaceWithProperties.readOnlyString` - - :type: string *(readonly)* - - - .. py:attribute:: readWriteString - - *Implements* :py:meth:`jsii-calc.IInterfaceWithProperties.readWriteString` - - :type: string - - -ConstructorPassesThisOut -^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: ConstructorPassesThisOut(consumer) - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.ConstructorPassesThisOut; - - .. code-tab:: javascript - - const { ConstructorPassesThisOut } = require('jsii-calc'); - - .. code-tab:: typescript - - import { ConstructorPassesThisOut } from 'jsii-calc'; - - - - :param consumer: - :type consumer: :py:class:`~jsii-calc.PartiallyInitializedThisConsumer`\ - -Constructors -^^^^^^^^^^^^ - -.. py:class:: Constructors() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.Constructors; - - .. code-tab:: javascript - - const { Constructors } = require('jsii-calc'); - - .. code-tab:: typescript - - import { Constructors } from 'jsii-calc'; - - - - - .. py:staticmethod:: hiddenInterface() -> jsii-calc.IPublicInterface - - :rtype: :py:class:`~jsii-calc.IPublicInterface`\ - - - .. py:staticmethod:: hiddenInterfaces() -> jsii-calc.IPublicInterface[] - - :rtype: :py:class:`~jsii-calc.IPublicInterface`\ [] - - - .. py:staticmethod:: hiddenSubInterfaces() -> jsii-calc.IPublicInterface[] - - :rtype: :py:class:`~jsii-calc.IPublicInterface`\ [] - - - .. py:staticmethod:: makeClass() -> jsii-calc.PublicClass - - :rtype: :py:class:`~jsii-calc.PublicClass`\ - - - .. py:staticmethod:: makeInterface() -> jsii-calc.IPublicInterface - - :rtype: :py:class:`~jsii-calc.IPublicInterface`\ - - - .. py:staticmethod:: makeInterface2() -> jsii-calc.IPublicInterface2 - - :rtype: :py:class:`~jsii-calc.IPublicInterface2`\ - - - .. py:staticmethod:: makeInterfaces() -> jsii-calc.IPublicInterface[] - - :rtype: :py:class:`~jsii-calc.IPublicInterface`\ [] - - -ConsumersOfThisCrazyTypeSystem -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: ConsumersOfThisCrazyTypeSystem() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.ConsumersOfThisCrazyTypeSystem; - - .. code-tab:: javascript - - const { ConsumersOfThisCrazyTypeSystem } = require('jsii-calc'); - - .. code-tab:: typescript - - import { ConsumersOfThisCrazyTypeSystem } from 'jsii-calc'; - - - - - .. py:method:: consumeAnotherPublicInterface(obj) -> string - - :param obj: - :type obj: :py:class:`~jsii-calc.IAnotherPublicInterface`\ - :rtype: string - - - .. py:method:: consumeNonInternalInterface(obj) -> any - - :param obj: - :type obj: :py:class:`~jsii-calc.INonInternalInterface`\ - :rtype: any - - -DataRenderer -^^^^^^^^^^^^ - -.. py:class:: DataRenderer() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.DataRenderer; - - .. code-tab:: javascript - - const { DataRenderer } = require('jsii-calc'); - - .. code-tab:: typescript - - import { DataRenderer } from 'jsii-calc'; - - - - Verifies proper type handling through dynamic overrides. - - - - - .. py:method:: render([data]) -> string - - :param data: - :type data: :py:class:`@scope/jsii-calc-lib.MyFirstStruct`\ - :rtype: string - - - .. py:method:: renderArbitrary(data) -> string - - :param data: - :type data: string => any - :rtype: string - - - .. py:method:: renderMap(map) -> string - - :param map: - :type map: string => any - :rtype: string - - -DefaultedConstructorArgument -^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: DefaultedConstructorArgument([arg1, [arg2, [arg3]]]) - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.DefaultedConstructorArgument; - - .. code-tab:: javascript - - const { DefaultedConstructorArgument } = require('jsii-calc'); - - .. code-tab:: typescript - - import { DefaultedConstructorArgument } from 'jsii-calc'; - - - - :param arg1: - :type arg1: number - :param arg2: - :type arg2: string - :param arg3: - :type arg3: date - - .. py:attribute:: arg1 - - :type: number *(readonly)* - - - .. py:attribute:: arg3 - - :type: date *(readonly)* - - - .. py:attribute:: arg2 - - :type: string *(optional)* *(readonly)* - - -DeprecatedClass -^^^^^^^^^^^^^^^ - -.. py:class:: DeprecatedClass(readonlyString, [mutableNumber]) - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.DeprecatedClass; - - .. code-tab:: javascript - - const { DeprecatedClass } = require('jsii-calc'); - - .. code-tab:: typescript - - import { DeprecatedClass } from 'jsii-calc'; - - - - :param readonlyString: - :type readonlyString: string - :param mutableNumber: - :type mutableNumber: number - - .. py:method:: method() - - - - .. py:attribute:: readonlyProperty - - :type: string *(readonly)* - - - .. py:attribute:: mutableProperty - - :type: number *(optional)* - - -DeprecatedEnum (enum) -^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: DeprecatedEnum - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.DeprecatedEnum; - - .. code-tab:: javascript - - const { DeprecatedEnum } = require('jsii-calc'); - - .. code-tab:: typescript - - import { DeprecatedEnum } from 'jsii-calc'; - - - - .. py:data:: OPTION_A - - .. py:data:: OPTION_B - - -DeprecatedStruct (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: DeprecatedStruct - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.DeprecatedStruct; - - .. code-tab:: javascript - - // DeprecatedStruct is an interface - - .. code-tab:: typescript - - import { DeprecatedStruct } from 'jsii-calc'; - - - - - - .. py:attribute:: readonlyProperty - - :type: string *(readonly)* - - - -DerivedClassHasNoProperties -^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. py:module:: jsii-calc.DerivedClassHasNoProperties - -Base -~~~~ - -.. py:class:: Base() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.DerivedClassHasNoProperties.Base; - - .. code-tab:: javascript - - const { DerivedClassHasNoProperties.Base } = require('jsii-calc'); - - .. code-tab:: typescript - - import { DerivedClassHasNoProperties.Base } from 'jsii-calc'; - - - - - .. py:attribute:: prop - - :type: string - - -Derived -~~~~~~~ - -.. py:class:: Derived() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.DerivedClassHasNoProperties.Derived; - - .. code-tab:: javascript - - const { DerivedClassHasNoProperties.Derived } = require('jsii-calc'); - - .. code-tab:: typescript - - import { DerivedClassHasNoProperties.Derived } from 'jsii-calc'; - - - - :extends: :py:class:`~jsii-calc.DerivedClassHasNoProperties.Base`\ - - .. py:attribute:: prop - - *Inherited from* :py:attr:`jsii-calc.DerivedClassHasNoProperties.Base ` - - :type: string - - - -.. py:currentmodule:: jsii-calc - -DerivedStruct (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: DerivedStruct - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.DerivedStruct; - - .. code-tab:: javascript - - // DerivedStruct is an interface - - .. code-tab:: typescript - - import { DerivedStruct } from 'jsii-calc'; - - - - A struct which derives from another struct. - - - - :extends: :py:class:`@scope/jsii-calc-lib.MyFirstStruct`\ - - - .. py:attribute:: anotherRequired - - :type: date *(readonly)* - - - .. py:attribute:: bool - - :type: boolean *(readonly)* - - - .. py:attribute:: nonPrimitive - - An example of a non primitive property. - - - - :type: :py:class:`~jsii-calc.DoubleTrouble`\ *(readonly)* - - - .. py:attribute:: anotherOptional - - This is optional. - - - - :type: string => :py:class:`@scope/jsii-calc-lib.Value`\ *(optional)* *(readonly)* - - - .. py:attribute:: optionalAny - - :type: any *(readonly)* - - - .. py:attribute:: optionalArray - - :type: string[] *(optional)* *(readonly)* - - - .. py:attribute:: anumber - - *Inherited from* :py:attr:`@scope/jsii-calc-lib.MyFirstStruct <@scope/jsii-calc-lib.MyFirstStruct.anumber>` - - An awesome number value. - - - - :type: number *(readonly)* - - - .. py:attribute:: astring - - *Inherited from* :py:attr:`@scope/jsii-calc-lib.MyFirstStruct <@scope/jsii-calc-lib.MyFirstStruct.astring>` - - A string value. - - - - :type: string *(readonly)* - - - .. py:attribute:: firstOptional - - *Inherited from* :py:attr:`@scope/jsii-calc-lib.MyFirstStruct <@scope/jsii-calc-lib.MyFirstStruct.firstOptional>` - - :type: string[] *(optional)* *(readonly)* - - -DiamondInheritanceBaseLevelStruct (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: DiamondInheritanceBaseLevelStruct - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.DiamondInheritanceBaseLevelStruct; - - .. code-tab:: javascript - - // DiamondInheritanceBaseLevelStruct is an interface - - .. code-tab:: typescript - - import { DiamondInheritanceBaseLevelStruct } from 'jsii-calc'; - - - - - - .. py:attribute:: baseLevelProperty - - :type: string *(readonly)* - - -DiamondInheritanceFirstMidLevelStruct (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: DiamondInheritanceFirstMidLevelStruct - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.DiamondInheritanceFirstMidLevelStruct; - - .. code-tab:: javascript - - // DiamondInheritanceFirstMidLevelStruct is an interface - - .. code-tab:: typescript - - import { DiamondInheritanceFirstMidLevelStruct } from 'jsii-calc'; - - - - :extends: :py:class:`~jsii-calc.DiamondInheritanceBaseLevelStruct`\ - - - .. py:attribute:: firstMidLevelProperty - - :type: string *(readonly)* - - - .. py:attribute:: baseLevelProperty - - *Inherited from* :py:attr:`jsii-calc.DiamondInheritanceBaseLevelStruct ` - - :type: string *(readonly)* - - -DiamondInheritanceSecondMidLevelStruct (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: DiamondInheritanceSecondMidLevelStruct - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.DiamondInheritanceSecondMidLevelStruct; - - .. code-tab:: javascript - - // DiamondInheritanceSecondMidLevelStruct is an interface - - .. code-tab:: typescript - - import { DiamondInheritanceSecondMidLevelStruct } from 'jsii-calc'; - - - - :extends: :py:class:`~jsii-calc.DiamondInheritanceBaseLevelStruct`\ - - - .. py:attribute:: secondMidLevelProperty - - :type: string *(readonly)* - - - .. py:attribute:: baseLevelProperty - - *Inherited from* :py:attr:`jsii-calc.DiamondInheritanceBaseLevelStruct ` - - :type: string *(readonly)* - - -DiamondInheritanceTopLevelStruct (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: DiamondInheritanceTopLevelStruct - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.DiamondInheritanceTopLevelStruct; - - .. code-tab:: javascript - - // DiamondInheritanceTopLevelStruct is an interface - - .. code-tab:: typescript - - import { DiamondInheritanceTopLevelStruct } from 'jsii-calc'; - - - - :extends: :py:class:`~jsii-calc.DiamondInheritanceFirstMidLevelStruct`\ - :extends: :py:class:`~jsii-calc.DiamondInheritanceSecondMidLevelStruct`\ - - - .. py:attribute:: topLevelProperty - - :type: string *(readonly)* - - - .. py:attribute:: baseLevelProperty - - *Inherited from* :py:attr:`jsii-calc.DiamondInheritanceBaseLevelStruct ` - - :type: string *(readonly)* - - - .. py:attribute:: firstMidLevelProperty - - *Inherited from* :py:attr:`jsii-calc.DiamondInheritanceFirstMidLevelStruct ` - - :type: string *(readonly)* - - - .. py:attribute:: secondMidLevelProperty - - *Inherited from* :py:attr:`jsii-calc.DiamondInheritanceSecondMidLevelStruct ` - - :type: string *(readonly)* - - -DoNotOverridePrivates -^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: DoNotOverridePrivates() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.DoNotOverridePrivates; - - .. code-tab:: javascript - - const { DoNotOverridePrivates } = require('jsii-calc'); - - .. code-tab:: typescript - - import { DoNotOverridePrivates } from 'jsii-calc'; - - - - - .. py:method:: changePrivatePropertyValue(newValue) - - :param newValue: - :type newValue: string - - - .. py:method:: privateMethodValue() -> string - - :rtype: string - - - .. py:method:: privatePropertyValue() -> string - - :rtype: string - - -DoNotRecognizeAnyAsOptional -^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: DoNotRecognizeAnyAsOptional() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.DoNotRecognizeAnyAsOptional; - - .. code-tab:: javascript - - const { DoNotRecognizeAnyAsOptional } = require('jsii-calc'); - - .. code-tab:: typescript - - import { DoNotRecognizeAnyAsOptional } from 'jsii-calc'; - - - - jsii#284: do not recognize "any" as an optional argument. - - - - - .. py:method:: method(_requiredAny, [_optionalAny, [_optionalString]]) - - :param _requiredAny: - :type _requiredAny: any - :param _optionalAny: - :type _optionalAny: any - :param _optionalString: - :type _optionalString: string - - -DocumentedClass -^^^^^^^^^^^^^^^ - -.. py:class:: DocumentedClass() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.DocumentedClass; - - .. code-tab:: javascript - - const { DocumentedClass } = require('jsii-calc'); - - .. code-tab:: typescript - - import { DocumentedClass } from 'jsii-calc'; - - - - Here's the first line of the TSDoc comment. - - - - This is the meat of the TSDoc comment. It may contain - - multiple lines and multiple paragraphs. - - - - Multiple paragraphs are separated by an empty line. - - - - - .. py:method:: greet([greetee]) -> number - - Greet the indicated person. - - - - This will print out a friendly greeting intended for - - the indicated person. - - - - :param greetee: The person to be greeted. - :type greetee: :py:class:`~jsii-calc.Greetee`\ - :return: A number that everyone knows very well - :rtype: number - - - .. py:method:: hola() - - Say ¡Hola! - - - - - -DontComplainAboutVariadicAfterOptional -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: DontComplainAboutVariadicAfterOptional() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.DontComplainAboutVariadicAfterOptional; - - .. code-tab:: javascript - - const { DontComplainAboutVariadicAfterOptional } = require('jsii-calc'); - - .. code-tab:: typescript - - import { DontComplainAboutVariadicAfterOptional } from 'jsii-calc'; - - - - - .. py:method:: optionalAndVariadic([optional, *things]) -> string - - :param optional: - :type optional: string - :param \*things: - :type \*things: string - :rtype: string - - -DoubleTrouble -^^^^^^^^^^^^^ - -.. py:class:: DoubleTrouble() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.DoubleTrouble; - - .. code-tab:: javascript - - const { DoubleTrouble } = require('jsii-calc'); - - .. code-tab:: typescript - - import { DoubleTrouble } from 'jsii-calc'; - - - - :implements: :py:class:`~jsii-calc.IFriendlyRandomGenerator`\ - - .. py:method:: hello() -> string - - *Implements* :py:meth:`@scope/jsii-calc-lib.IFriendly.hello` - - Say hello! - - - - :rtype: string - - - .. py:method:: next() -> number - - *Implements* :py:meth:`jsii-calc.IRandomNumberGenerator.next` - - Returns another random number. - - - - :rtype: number - - -EnumDispenser -^^^^^^^^^^^^^ - -.. py:class:: EnumDispenser - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.EnumDispenser; - - .. code-tab:: javascript - - const { EnumDispenser } = require('jsii-calc'); - - .. code-tab:: typescript - - import { EnumDispenser } from 'jsii-calc'; - - - - - .. py:staticmethod:: randomIntegerLikeEnum() -> jsii-calc.AllTypesEnum - - :rtype: :py:class:`~jsii-calc.AllTypesEnum`\ - - - .. py:staticmethod:: randomStringLikeEnum() -> jsii-calc.StringEnum - - :rtype: :py:class:`~jsii-calc.StringEnum`\ - - -EraseUndefinedHashValues -^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: EraseUndefinedHashValues() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.EraseUndefinedHashValues; - - .. code-tab:: javascript - - const { EraseUndefinedHashValues } = require('jsii-calc'); - - .. code-tab:: typescript - - import { EraseUndefinedHashValues } from 'jsii-calc'; - - - - - .. py:staticmethod:: doesKeyExist(opts, key) -> boolean - - Returns `true` if `key` is defined in `opts`. - - - - Used to check that undefined/null hash values - - are being erased when sending values from native code to JS. - - - - :param opts: - :type opts: :py:class:`~jsii-calc.EraseUndefinedHashValuesOptions`\ - :param key: - :type key: string - :rtype: boolean - - - .. py:staticmethod:: prop1IsNull() -> any - - We expect "prop1" to be erased. - - - - :rtype: any - - - .. py:staticmethod:: prop2IsUndefined() -> any - - We expect "prop2" to be erased. - - - - :rtype: any - - -EraseUndefinedHashValuesOptions (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: EraseUndefinedHashValuesOptions - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.EraseUndefinedHashValuesOptions; - - .. code-tab:: javascript - - // EraseUndefinedHashValuesOptions is an interface - - .. code-tab:: typescript - - import { EraseUndefinedHashValuesOptions } from 'jsii-calc'; - - - - - - .. py:attribute:: option1 - - :type: string *(optional)* *(readonly)* - - - .. py:attribute:: option2 - - :type: string *(optional)* *(readonly)* - - -ExperimentalClass -^^^^^^^^^^^^^^^^^ - -.. py:class:: ExperimentalClass(readonlyString, [mutableNumber]) - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.ExperimentalClass; - - .. code-tab:: javascript - - const { ExperimentalClass } = require('jsii-calc'); - - .. code-tab:: typescript - - import { ExperimentalClass } from 'jsii-calc'; - - - - :param readonlyString: - :type readonlyString: string - :param mutableNumber: - :type mutableNumber: number - - .. py:method:: method() - - - - .. py:attribute:: readonlyProperty - - :type: string *(readonly)* - - - .. py:attribute:: mutableProperty - - :type: number *(optional)* - - -ExperimentalEnum (enum) -^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: ExperimentalEnum - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.ExperimentalEnum; - - .. code-tab:: javascript - - const { ExperimentalEnum } = require('jsii-calc'); - - .. code-tab:: typescript - - import { ExperimentalEnum } from 'jsii-calc'; - - - - .. py:data:: OPTION_A - - .. py:data:: OPTION_B - - -ExperimentalStruct (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: ExperimentalStruct - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.ExperimentalStruct; - - .. code-tab:: javascript - - // ExperimentalStruct is an interface - - .. code-tab:: typescript - - import { ExperimentalStruct } from 'jsii-calc'; - - - - - - .. py:attribute:: readonlyProperty - - :type: string *(readonly)* - - -ExportedBaseClass -^^^^^^^^^^^^^^^^^ - -.. py:class:: ExportedBaseClass(success) - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.ExportedBaseClass; - - .. code-tab:: javascript - - const { ExportedBaseClass } = require('jsii-calc'); - - .. code-tab:: typescript - - import { ExportedBaseClass } from 'jsii-calc'; - - - - :param success: - :type success: boolean - - .. py:attribute:: success - - :type: boolean *(readonly)* - - -ExtendsInternalInterface (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: ExtendsInternalInterface - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.ExtendsInternalInterface; - - .. code-tab:: javascript - - // ExtendsInternalInterface is an interface - - .. code-tab:: typescript - - import { ExtendsInternalInterface } from 'jsii-calc'; - - - - - - .. py:attribute:: boom - - :type: boolean *(readonly)* - - - .. py:attribute:: prop - - :type: string *(readonly)* - - -GiveMeStructs -^^^^^^^^^^^^^ - -.. py:class:: GiveMeStructs() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.GiveMeStructs; - - .. code-tab:: javascript - - const { GiveMeStructs } = require('jsii-calc'); - - .. code-tab:: typescript - - import { GiveMeStructs } from 'jsii-calc'; - - - - - .. py:method:: derivedToFirst(derived) -> @scope/jsii-calc-lib.MyFirstStruct - - Accepts a struct of type DerivedStruct and returns a struct of type FirstStruct. - - - - :param derived: - :type derived: :py:class:`~jsii-calc.DerivedStruct`\ - :rtype: :py:class:`@scope/jsii-calc-lib.MyFirstStruct`\ - - - .. py:method:: readDerivedNonPrimitive(derived) -> jsii-calc.DoubleTrouble - - Returns the boolean from a DerivedStruct struct. - - - - :param derived: - :type derived: :py:class:`~jsii-calc.DerivedStruct`\ - :rtype: :py:class:`~jsii-calc.DoubleTrouble`\ - - - .. py:method:: readFirstNumber(first) -> number - - Returns the "anumber" from a MyFirstStruct struct; - - - - :param first: - :type first: :py:class:`@scope/jsii-calc-lib.MyFirstStruct`\ - :rtype: number - - - .. py:attribute:: structLiteral - - :type: :py:class:`@scope/jsii-calc-lib.StructWithOnlyOptionals`\ *(readonly)* - - -Greetee (interface) -^^^^^^^^^^^^^^^^^^^ - -.. py:class:: Greetee - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.Greetee; - - .. code-tab:: javascript - - // Greetee is an interface - - .. code-tab:: typescript - - import { Greetee } from 'jsii-calc'; - - - - These are some arguments you can pass to a method. - - - - - - .. py:attribute:: name - - The name of the greetee. - - - - :type: string *(optional)* *(readonly)* - :default: world - - -GreetingAugmenter -^^^^^^^^^^^^^^^^^ - -.. py:class:: GreetingAugmenter() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.GreetingAugmenter; - - .. code-tab:: javascript - - const { GreetingAugmenter } = require('jsii-calc'); - - .. code-tab:: typescript - - import { GreetingAugmenter } from 'jsii-calc'; - - - - - .. py:method:: betterGreeting(friendly) -> string - - :param friendly: - :type friendly: :py:class:`@scope/jsii-calc-lib.IFriendly`\ - :rtype: string - - -IAnotherPublicInterface (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: IAnotherPublicInterface - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.IAnotherPublicInterface; - - .. code-tab:: javascript - - // IAnotherPublicInterface is an interface - - .. code-tab:: typescript - - import { IAnotherPublicInterface } from 'jsii-calc'; - - - - - - .. py:attribute:: a - - :type: string - - -IDeprecatedInterface (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: IDeprecatedInterface - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.IDeprecatedInterface; - - .. code-tab:: javascript - - // IDeprecatedInterface is an interface - - .. code-tab:: typescript - - import { IDeprecatedInterface } from 'jsii-calc'; - - - - - - .. py:attribute:: mutableProperty - - :type: number *(optional)* - - - .. py:method:: method() - - :abstract: Yes - - -IExperimentalInterface (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: IExperimentalInterface - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.IExperimentalInterface; - - .. code-tab:: javascript - - // IExperimentalInterface is an interface - - .. code-tab:: typescript - - import { IExperimentalInterface } from 'jsii-calc'; - - - - - - .. py:attribute:: mutableProperty - - :type: number *(optional)* - - - .. py:method:: method() - - :abstract: Yes - - -IExtendsPrivateInterface (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: IExtendsPrivateInterface - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.IExtendsPrivateInterface; - - .. code-tab:: javascript - - // IExtendsPrivateInterface is an interface - - .. code-tab:: typescript - - import { IExtendsPrivateInterface } from 'jsii-calc'; - - - - - - .. py:attribute:: moreThings - - :type: string[] *(readonly)* - - - .. py:attribute:: private - - :type: string - - -IFriendlier (interface) -^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: IFriendlier - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.IFriendlier; - - .. code-tab:: javascript - - // IFriendlier is an interface - - .. code-tab:: typescript - - import { IFriendlier } from 'jsii-calc'; - - - - Even friendlier classes can implement this interface. - - - - :extends: :py:class:`@scope/jsii-calc-lib.IFriendly`\ - - - .. py:method:: farewell() -> string - - Say farewell. - - - - :rtype: string - :abstract: Yes - - - .. py:method:: goodbye() -> string - - Say goodbye. - - - - :return: A goodbye blessing. - :rtype: string - :abstract: Yes - - - .. py:method:: hello() -> string - - *Inherited from* :py:meth:`@scope/jsii-calc-lib.IFriendly <@scope/jsii-calc-lib.IFriendly.hello>` - - Say hello! - - - - :rtype: string - :abstract: Yes - - -IFriendlyRandomGenerator (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: IFriendlyRandomGenerator - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.IFriendlyRandomGenerator; - - .. code-tab:: javascript - - // IFriendlyRandomGenerator is an interface - - .. code-tab:: typescript - - import { IFriendlyRandomGenerator } from 'jsii-calc'; - - - - :extends: :py:class:`~jsii-calc.IRandomNumberGenerator`\ - :extends: :py:class:`@scope/jsii-calc-lib.IFriendly`\ - - - .. py:method:: hello() -> string - - *Inherited from* :py:meth:`@scope/jsii-calc-lib.IFriendly <@scope/jsii-calc-lib.IFriendly.hello>` - - Say hello! - - - - :rtype: string - :abstract: Yes - - - .. py:method:: next() -> number - - *Inherited from* :py:meth:`jsii-calc.IRandomNumberGenerator ` - - Returns another random number. - - - - :return: A random number. - :rtype: number - :abstract: Yes - - -IInterfaceImplementedByAbstractClass (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: IInterfaceImplementedByAbstractClass - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.IInterfaceImplementedByAbstractClass; - - .. code-tab:: javascript - - // IInterfaceImplementedByAbstractClass is an interface - - .. code-tab:: typescript - - import { IInterfaceImplementedByAbstractClass } from 'jsii-calc'; - - - - awslabs/jsii#220 Abstract return type. - - - - - - .. py:attribute:: propFromInterface - - :type: string *(readonly)* - - -IInterfaceThatShouldNotBeADataType (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: IInterfaceThatShouldNotBeADataType - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.IInterfaceThatShouldNotBeADataType; - - .. code-tab:: javascript - - // IInterfaceThatShouldNotBeADataType is an interface - - .. code-tab:: typescript - - import { IInterfaceThatShouldNotBeADataType } from 'jsii-calc'; - - - - Even though this interface has only properties, it is disqualified from being a datatype because it inherits from an interface that is not a datatype. - - - - :extends: :py:class:`~jsii-calc.IInterfaceWithMethods`\ - - - .. py:attribute:: otherValue - - :type: string *(readonly)* - - - .. py:method:: doThings() - - *Inherited from* :py:meth:`jsii-calc.IInterfaceWithMethods ` - - :abstract: Yes - - - .. py:attribute:: value - - *Inherited from* :py:attr:`jsii-calc.IInterfaceWithMethods ` - - :type: string *(readonly)* - - -IInterfaceWithInternal (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: IInterfaceWithInternal - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.IInterfaceWithInternal; - - .. code-tab:: javascript - - // IInterfaceWithInternal is an interface - - .. code-tab:: typescript - - import { IInterfaceWithInternal } from 'jsii-calc'; - - - - - - .. py:method:: visible() - - :abstract: Yes - - -IInterfaceWithMethods (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: IInterfaceWithMethods - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.IInterfaceWithMethods; - - .. code-tab:: javascript - - // IInterfaceWithMethods is an interface - - .. code-tab:: typescript - - import { IInterfaceWithMethods } from 'jsii-calc'; - - - - - - .. py:attribute:: value - - :type: string *(readonly)* - - - .. py:method:: doThings() - - :abstract: Yes - - -IInterfaceWithOptionalMethodArguments (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: IInterfaceWithOptionalMethodArguments - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.IInterfaceWithOptionalMethodArguments; - - .. code-tab:: javascript - - // IInterfaceWithOptionalMethodArguments is an interface - - .. code-tab:: typescript - - import { IInterfaceWithOptionalMethodArguments } from 'jsii-calc'; - - - - awslabs/jsii#175 Interface proxies (and builders) do not respect optional arguments in methods. - - - - - - .. py:method:: hello(arg1, [arg2]) - - :param arg1: - :type arg1: string - :param arg2: - :type arg2: number - :abstract: Yes - - -IInterfaceWithProperties (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: IInterfaceWithProperties - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.IInterfaceWithProperties; - - .. code-tab:: javascript - - // IInterfaceWithProperties is an interface - - .. code-tab:: typescript - - import { IInterfaceWithProperties } from 'jsii-calc'; - - - - - - .. py:attribute:: readOnlyString - - :type: string *(readonly)* - - - .. py:attribute:: readWriteString - - :type: string - - -IInterfaceWithPropertiesExtension (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: IInterfaceWithPropertiesExtension - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.IInterfaceWithPropertiesExtension; - - .. code-tab:: javascript - - // IInterfaceWithPropertiesExtension is an interface - - .. code-tab:: typescript - - import { IInterfaceWithPropertiesExtension } from 'jsii-calc'; - - - - :extends: :py:class:`~jsii-calc.IInterfaceWithProperties`\ - - - .. py:attribute:: foo - - :type: number - - - .. py:attribute:: readOnlyString - - *Inherited from* :py:attr:`jsii-calc.IInterfaceWithProperties ` - - :type: string *(readonly)* - - - .. py:attribute:: readWriteString - - *Inherited from* :py:attr:`jsii-calc.IInterfaceWithProperties ` - - :type: string - - -IJSII417Derived (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: IJSII417Derived - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.IJSII417Derived; - - .. code-tab:: javascript - - // IJSII417Derived is an interface - - .. code-tab:: typescript - - import { IJSII417Derived } from 'jsii-calc'; - - - - :extends: :py:class:`~jsii-calc.IJSII417PublicBaseOfBase`\ - - - .. py:attribute:: property - - :type: string *(readonly)* - - - .. py:method:: bar() - - :abstract: Yes - - - .. py:method:: baz() - - :abstract: Yes - - - .. py:method:: foo() - - *Inherited from* :py:meth:`jsii-calc.IJSII417PublicBaseOfBase ` - - :abstract: Yes - - - .. py:attribute:: hasRoot - - *Inherited from* :py:attr:`jsii-calc.IJSII417PublicBaseOfBase ` - - :type: boolean *(readonly)* - - -IJSII417PublicBaseOfBase (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: IJSII417PublicBaseOfBase - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.IJSII417PublicBaseOfBase; - - .. code-tab:: javascript - - // IJSII417PublicBaseOfBase is an interface - - .. code-tab:: typescript - - import { IJSII417PublicBaseOfBase } from 'jsii-calc'; - - - - - - .. py:attribute:: hasRoot - - :type: boolean *(readonly)* - - - .. py:method:: foo() - - :abstract: Yes - - -IJsii487External (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: IJsii487External - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.IJsii487External; - - .. code-tab:: javascript - - // IJsii487External is an interface - - .. code-tab:: typescript - - import { IJsii487External } from 'jsii-calc'; - - - - - -IJsii487External2 (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: IJsii487External2 - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.IJsii487External2; - - .. code-tab:: javascript - - // IJsii487External2 is an interface - - .. code-tab:: typescript - - import { IJsii487External2 } from 'jsii-calc'; - - - - - -IJsii496 (interface) -^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: IJsii496 - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.IJsii496; - - .. code-tab:: javascript - - // IJsii496 is an interface - - .. code-tab:: typescript - - import { IJsii496 } from 'jsii-calc'; - - - - - -IMutableObjectLiteral (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: IMutableObjectLiteral - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.IMutableObjectLiteral; - - .. code-tab:: javascript - - // IMutableObjectLiteral is an interface - - .. code-tab:: typescript - - import { IMutableObjectLiteral } from 'jsii-calc'; - - - - - - .. py:attribute:: value - - :type: string - - -INonInternalInterface (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: INonInternalInterface - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.INonInternalInterface; - - .. code-tab:: javascript - - // INonInternalInterface is an interface - - .. code-tab:: typescript - - import { INonInternalInterface } from 'jsii-calc'; - - - - :extends: :py:class:`~jsii-calc.IAnotherPublicInterface`\ - - - .. py:attribute:: b - - :type: string - - - .. py:attribute:: c - - :type: string - - - .. py:attribute:: a - - *Inherited from* :py:attr:`jsii-calc.IAnotherPublicInterface ` - - :type: string - - -IPrivatelyImplemented (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: IPrivatelyImplemented - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.IPrivatelyImplemented; - - .. code-tab:: javascript - - // IPrivatelyImplemented is an interface - - .. code-tab:: typescript - - import { IPrivatelyImplemented } from 'jsii-calc'; - - - - - - .. py:attribute:: success - - :type: boolean *(readonly)* - - -IPublicInterface (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: IPublicInterface - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.IPublicInterface; - - .. code-tab:: javascript - - // IPublicInterface is an interface - - .. code-tab:: typescript - - import { IPublicInterface } from 'jsii-calc'; - - - - - - .. py:method:: bye() -> string - - :rtype: string - :abstract: Yes - - -IPublicInterface2 (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: IPublicInterface2 - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.IPublicInterface2; - - .. code-tab:: javascript - - // IPublicInterface2 is an interface - - .. code-tab:: typescript - - import { IPublicInterface2 } from 'jsii-calc'; - - - - - - .. py:method:: ciao() -> string - - :rtype: string - :abstract: Yes - - -IRandomNumberGenerator (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: IRandomNumberGenerator - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.IRandomNumberGenerator; - - .. code-tab:: javascript - - // IRandomNumberGenerator is an interface - - .. code-tab:: typescript - - import { IRandomNumberGenerator } from 'jsii-calc'; - - - - Generates random numbers. - - - - - - .. py:method:: next() -> number - - Returns another random number. - - - - :return: A random number. - :rtype: number - :abstract: Yes - - -IReturnsNumber (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: IReturnsNumber - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.IReturnsNumber; - - .. code-tab:: javascript - - // IReturnsNumber is an interface - - .. code-tab:: typescript - - import { IReturnsNumber } from 'jsii-calc'; - - - - - - .. py:attribute:: numberProp - - :type: :py:class:`@scope/jsii-calc-lib.Number`\ *(readonly)* - - - .. py:method:: obtainNumber() -> @scope/jsii-calc-lib.IDoublable - - :rtype: :py:class:`@scope/jsii-calc-lib.IDoublable`\ - :abstract: Yes - - -IStableInterface (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: IStableInterface - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.IStableInterface; - - .. code-tab:: javascript - - // IStableInterface is an interface - - .. code-tab:: typescript - - import { IStableInterface } from 'jsii-calc'; - - - - - - .. py:attribute:: mutableProperty - - :type: number *(optional)* - - - .. py:method:: method() - - :abstract: Yes - - -ImplementInternalInterface -^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: ImplementInternalInterface() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.ImplementInternalInterface; - - .. code-tab:: javascript - - const { ImplementInternalInterface } = require('jsii-calc'); - - .. code-tab:: typescript - - import { ImplementInternalInterface } from 'jsii-calc'; - - - - - .. py:attribute:: prop - - :type: string - - -ImplementsInterfaceWithInternal -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: ImplementsInterfaceWithInternal() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.ImplementsInterfaceWithInternal; - - .. code-tab:: javascript - - const { ImplementsInterfaceWithInternal } = require('jsii-calc'); - - .. code-tab:: typescript - - import { ImplementsInterfaceWithInternal } from 'jsii-calc'; - - - - :implements: :py:class:`~jsii-calc.IInterfaceWithInternal`\ - - .. py:method:: visible() - - *Implements* :py:meth:`jsii-calc.IInterfaceWithInternal.visible` - - - -ImplementsInterfaceWithInternalSubclass -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: ImplementsInterfaceWithInternalSubclass() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.ImplementsInterfaceWithInternalSubclass; - - .. code-tab:: javascript - - const { ImplementsInterfaceWithInternalSubclass } = require('jsii-calc'); - - .. code-tab:: typescript - - import { ImplementsInterfaceWithInternalSubclass } from 'jsii-calc'; - - - - :extends: :py:class:`~jsii-calc.ImplementsInterfaceWithInternal`\ - - .. py:method:: visible() - - *Inherited from* :py:meth:`jsii-calc.ImplementsInterfaceWithInternal ` - - - -ImplementsPrivateInterface -^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: ImplementsPrivateInterface() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.ImplementsPrivateInterface; - - .. code-tab:: javascript - - const { ImplementsPrivateInterface } = require('jsii-calc'); - - .. code-tab:: typescript - - import { ImplementsPrivateInterface } from 'jsii-calc'; - - - - - .. py:attribute:: private - - :type: string - - -ImplictBaseOfBase (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: ImplictBaseOfBase - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.ImplictBaseOfBase; - - .. code-tab:: javascript - - // ImplictBaseOfBase is an interface - - .. code-tab:: typescript - - import { ImplictBaseOfBase } from 'jsii-calc'; - - - - :extends: :py:class:`@scope/jsii-calc-base.BaseProps`\ - - - .. py:attribute:: goo - - :type: date *(readonly)* - - - .. py:attribute:: foo - - *Inherited from* :py:attr:`@scope/jsii-calc-base-of-base.VeryBaseProps <@scope/jsii-calc-base-of-base.VeryBaseProps.foo>` - - :type: :py:class:`@scope/jsii-calc-base-of-base.Very`\ *(readonly)* - - - .. py:attribute:: bar - - *Inherited from* :py:attr:`@scope/jsii-calc-base.BaseProps <@scope/jsii-calc-base.BaseProps.bar>` - - :type: string *(readonly)* - - -InbetweenClass -^^^^^^^^^^^^^^ - -.. py:class:: InbetweenClass() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.InbetweenClass; - - .. code-tab:: javascript - - const { InbetweenClass } = require('jsii-calc'); - - .. code-tab:: typescript - - import { InbetweenClass } from 'jsii-calc'; - - - - :extends: :py:class:`~jsii-calc.PublicClass`\ - :implements: :py:class:`~jsii-calc.IPublicInterface2`\ - - .. py:method:: ciao() -> string - - *Implements* :py:meth:`jsii-calc.IPublicInterface2.ciao` - - :rtype: string - - - .. py:method:: hello() - - *Inherited from* :py:meth:`jsii-calc.PublicClass ` - - - - -InterfaceInNamespaceIncludesClasses -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. py:module:: jsii-calc.InterfaceInNamespaceIncludesClasses - -Foo -~~~ - -.. py:class:: Foo() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.InterfaceInNamespaceIncludesClasses.Foo; - - .. code-tab:: javascript - - const { InterfaceInNamespaceIncludesClasses.Foo } = require('jsii-calc'); - - .. code-tab:: typescript - - import { InterfaceInNamespaceIncludesClasses.Foo } from 'jsii-calc'; - - - - - .. py:attribute:: bar - - :type: string *(optional)* - - -Hello (interface) -~~~~~~~~~~~~~~~~~ - -.. py:class:: Hello - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.InterfaceInNamespaceIncludesClasses.Hello; - - .. code-tab:: javascript - - // InterfaceInNamespaceIncludesClasses.Hello is an interface - - .. code-tab:: typescript - - import { InterfaceInNamespaceIncludesClasses.Hello } from 'jsii-calc'; - - - - - - .. py:attribute:: foo - - :type: number *(readonly)* - - - -.. py:currentmodule:: jsii-calc - - -InterfaceInNamespaceOnlyInterface -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. py:module:: jsii-calc.InterfaceInNamespaceOnlyInterface - -Hello (interface) -~~~~~~~~~~~~~~~~~ - -.. py:class:: Hello - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.InterfaceInNamespaceOnlyInterface.Hello; - - .. code-tab:: javascript - - // InterfaceInNamespaceOnlyInterface.Hello is an interface - - .. code-tab:: typescript - - import { InterfaceInNamespaceOnlyInterface.Hello } from 'jsii-calc'; - - - - - - .. py:attribute:: foo - - :type: number *(readonly)* - - - -.. py:currentmodule:: jsii-calc - -InterfacesMaker -^^^^^^^^^^^^^^^ - -.. py:class:: InterfacesMaker - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.InterfacesMaker; - - .. code-tab:: javascript - - const { InterfacesMaker } = require('jsii-calc'); - - .. code-tab:: typescript - - import { InterfacesMaker } from 'jsii-calc'; - - - - We can return arrays of interfaces See aws/aws-cdk#2362. - - - - - .. py:staticmethod:: makeInterfaces(count) -> @scope/jsii-calc-lib.IDoublable[] - - :param count: - :type count: number - :rtype: :py:class:`@scope/jsii-calc-lib.IDoublable`\ [] - - -JSII417Derived -^^^^^^^^^^^^^^ - -.. py:class:: JSII417Derived(property) - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.JSII417Derived; - - .. code-tab:: javascript - - const { JSII417Derived } = require('jsii-calc'); - - .. code-tab:: typescript - - import { JSII417Derived } from 'jsii-calc'; - - - - :extends: :py:class:`~jsii-calc.JSII417PublicBaseOfBase`\ - :param property: - :type property: string - - .. py:method:: bar() - - - - .. py:method:: baz() - - - - .. py:attribute:: property - - *Protected property* - - :type: string *(readonly)* - - - .. py:method:: foo() - - *Inherited from* :py:meth:`jsii-calc.JSII417PublicBaseOfBase ` - - - - .. py:attribute:: hasRoot - - *Inherited from* :py:attr:`jsii-calc.JSII417PublicBaseOfBase ` - - :type: boolean *(readonly)* - - -JSII417PublicBaseOfBase -^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: JSII417PublicBaseOfBase() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.JSII417PublicBaseOfBase; - - .. code-tab:: javascript - - const { JSII417PublicBaseOfBase } = require('jsii-calc'); - - .. code-tab:: typescript - - import { JSII417PublicBaseOfBase } from 'jsii-calc'; - - - - - .. py:staticmethod:: makeInstance() -> jsii-calc.JSII417PublicBaseOfBase - - :rtype: :py:class:`~jsii-calc.JSII417PublicBaseOfBase`\ - - - .. py:method:: foo() - - - - .. py:attribute:: hasRoot - - :type: boolean *(readonly)* - - -JSObjectLiteralForInterface -^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: JSObjectLiteralForInterface() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.JSObjectLiteralForInterface; - - .. code-tab:: javascript - - const { JSObjectLiteralForInterface } = require('jsii-calc'); - - .. code-tab:: typescript - - import { JSObjectLiteralForInterface } from 'jsii-calc'; - - - - - .. py:method:: giveMeFriendly() -> @scope/jsii-calc-lib.IFriendly - - :rtype: :py:class:`@scope/jsii-calc-lib.IFriendly`\ - - - .. py:method:: giveMeFriendlyGenerator() -> jsii-calc.IFriendlyRandomGenerator - - :rtype: :py:class:`~jsii-calc.IFriendlyRandomGenerator`\ - - -JSObjectLiteralToNative -^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: JSObjectLiteralToNative() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.JSObjectLiteralToNative; - - .. code-tab:: javascript - - const { JSObjectLiteralToNative } = require('jsii-calc'); - - .. code-tab:: typescript - - import { JSObjectLiteralToNative } from 'jsii-calc'; - - - - - .. py:method:: returnLiteral() -> jsii-calc.JSObjectLiteralToNativeClass - - :rtype: :py:class:`~jsii-calc.JSObjectLiteralToNativeClass`\ - - -JSObjectLiteralToNativeClass -^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: JSObjectLiteralToNativeClass() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.JSObjectLiteralToNativeClass; - - .. code-tab:: javascript - - const { JSObjectLiteralToNativeClass } = require('jsii-calc'); - - .. code-tab:: typescript - - import { JSObjectLiteralToNativeClass } from 'jsii-calc'; - - - - - .. py:attribute:: propA - - :type: string - - - .. py:attribute:: propB - - :type: number - - -JavaReservedWords -^^^^^^^^^^^^^^^^^ - -.. py:class:: JavaReservedWords() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.JavaReservedWords; - - .. code-tab:: javascript - - const { JavaReservedWords } = require('jsii-calc'); - - .. code-tab:: typescript - - import { JavaReservedWords } from 'jsii-calc'; - - - - - .. py:method:: abstract() - - - - .. py:method:: assert() - - - - .. py:method:: boolean() - - - - .. py:method:: break() - - - - .. py:method:: byte() - - - - .. py:method:: case() - - - - .. py:method:: catch() - - - - .. py:method:: char() - - - - .. py:method:: class() - - - - .. py:method:: const() - - - - .. py:method:: continue() - - - - .. py:method:: default() - - - - .. py:method:: do() - - - - .. py:method:: double() - - - - .. py:method:: else() - - - - .. py:method:: enum() - - - - .. py:method:: extends() - - - - .. py:method:: false() - - - - .. py:method:: final() - - - - .. py:method:: finally() - - - - .. py:method:: float() - - - - .. py:method:: for() - - - - .. py:method:: goto() - - - - .. py:method:: if() - - - - .. py:method:: implements() - - - - .. py:method:: import() - - - - .. py:method:: instanceof() - - - - .. py:method:: int() - - - - .. py:method:: interface() - - - - .. py:method:: long() - - - - .. py:method:: native() - - - - .. py:method:: new() - - - - .. py:method:: null() - - - - .. py:method:: package() - - - - .. py:method:: private() - - - - .. py:method:: protected() - - - - .. py:method:: public() - - - - .. py:method:: return() - - - - .. py:method:: short() - - - - .. py:method:: static() - - - - .. py:method:: strictfp() - - - - .. py:method:: super() - - - - .. py:method:: switch() - - - - .. py:method:: synchronized() - - - - .. py:method:: this() - - - - .. py:method:: throw() - - - - .. py:method:: throws() - - - - .. py:method:: transient() - - - - .. py:method:: true() - - - - .. py:method:: try() - - - - .. py:method:: void() - - - - .. py:method:: volatile() - - - - .. py:attribute:: while - - :type: string - - -Jsii487Derived -^^^^^^^^^^^^^^ - -.. py:class:: Jsii487Derived() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.Jsii487Derived; - - .. code-tab:: javascript - - const { Jsii487Derived } = require('jsii-calc'); - - .. code-tab:: typescript - - import { Jsii487Derived } from 'jsii-calc'; - - - - :implements: :py:class:`~jsii-calc.IJsii487External2`\ - :implements: :py:class:`~jsii-calc.IJsii487External`\ - -Jsii496Derived -^^^^^^^^^^^^^^ - -.. py:class:: Jsii496Derived() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.Jsii496Derived; - - .. code-tab:: javascript - - const { Jsii496Derived } = require('jsii-calc'); - - .. code-tab:: typescript - - import { Jsii496Derived } from 'jsii-calc'; - - - - :implements: :py:class:`~jsii-calc.IJsii496`\ - -JsiiAgent -^^^^^^^^^ - -.. py:class:: JsiiAgent() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.JsiiAgent; - - .. code-tab:: javascript - - const { JsiiAgent } = require('jsii-calc'); - - .. code-tab:: typescript - - import { JsiiAgent } from 'jsii-calc'; - - - - Host runtime version should be set via JSII_AGENT. - - - - - .. py:attribute:: jsiiAgent - - Returns the value of the JSII_AGENT environment variable. - - - - :type: string *(optional)* *(readonly)* *(static)* - - -LoadBalancedFargateServiceProps (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: LoadBalancedFargateServiceProps - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.LoadBalancedFargateServiceProps; - - .. code-tab:: javascript - - // LoadBalancedFargateServiceProps is an interface - - .. code-tab:: typescript - - import { LoadBalancedFargateServiceProps } from 'jsii-calc'; - - - - jsii#298: show default values in sphinx documentation, and respect newlines. - - - - - - .. py:attribute:: containerPort - - The container port of the application load balancer attached to your Fargate service. - - - - Corresponds to container port mapping. - - - - :type: number *(optional)* *(readonly)* - :default: 80 - - - .. py:attribute:: cpu - - The number of cpu units used by the task. Valid values, which determines your range of valid values for the memory parameter: 256 (.25 vCPU) - Available memory values: 0.5GB, 1GB, 2GB 512 (.5 vCPU) - Available memory values: 1GB, 2GB, 3GB, 4GB 1024 (1 vCPU) - Available memory values: 2GB, 3GB, 4GB, 5GB, 6GB, 7GB, 8GB 2048 (2 vCPU) - Available memory values: Between 4GB and 16GB in 1GB increments 4096 (4 vCPU) - Available memory values: Between 8GB and 30GB in 1GB increments. - - - - This default is set in the underlying FargateTaskDefinition construct. - - - - :type: string *(optional)* *(readonly)* - :default: 256 - - - .. py:attribute:: memoryMiB - - The amount (in MiB) of memory used by the task. - - - - This field is required and you must use one of the following values, which determines your range of valid values - - for the cpu parameter: - - - - 0.5GB, 1GB, 2GB - Available cpu values: 256 (.25 vCPU) - - - - 1GB, 2GB, 3GB, 4GB - Available cpu values: 512 (.5 vCPU) - - - - 2GB, 3GB, 4GB, 5GB, 6GB, 7GB, 8GB - Available cpu values: 1024 (1 vCPU) - - - - Between 4GB and 16GB in 1GB increments - Available cpu values: 2048 (2 vCPU) - - - - Between 8GB and 30GB in 1GB increments - Available cpu values: 4096 (4 vCPU) - - - - This default is set in the underlying FargateTaskDefinition construct. - - - - :type: string *(optional)* *(readonly)* - :default: 512 - - - .. py:attribute:: publicLoadBalancer - - Determines whether the Application Load Balancer will be internet-facing. - - - - :type: boolean *(optional)* *(readonly)* - :default: true - - - .. py:attribute:: publicTasks - - Determines whether your Fargate Service will be assigned a public IP address. - - - - :type: boolean *(optional)* *(readonly)* - :default: false - - -Multiply -^^^^^^^^ - -.. py:class:: Multiply(lhs, rhs) - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.Multiply; - - .. code-tab:: javascript - - const { Multiply } = require('jsii-calc'); - - .. code-tab:: typescript - - import { Multiply } from 'jsii-calc'; - - - - The "*" binary operation. - - - - :extends: :py:class:`~jsii-calc.BinaryOperation`\ - :implements: :py:class:`~jsii-calc.IFriendlier`\ - :implements: :py:class:`~jsii-calc.IRandomNumberGenerator`\ - :param lhs: Left-hand side operand. - :type lhs: :py:class:`@scope/jsii-calc-lib.Value`\ - :param rhs: Right-hand side operand. - :type rhs: :py:class:`@scope/jsii-calc-lib.Value`\ - - .. py:method:: farewell() -> string - - *Implements* :py:meth:`jsii-calc.IFriendlier.farewell` - - Say farewell. - - - - :rtype: string - - - .. py:method:: goodbye() -> string - - *Implements* :py:meth:`jsii-calc.IFriendlier.goodbye` - - Say goodbye. - - - - :rtype: string - - - .. py:method:: next() -> number - - *Implements* :py:meth:`jsii-calc.IRandomNumberGenerator.next` - - Returns another random number. - - - - :rtype: number - - - .. py:method:: toString() -> string - - *Implements* :py:meth:`@scope/jsii-calc-lib.Operation.toString` - - String representation of the value. - - - - :rtype: string - - - .. py:attribute:: value - - *Implements* :py:meth:`@scope/jsii-calc-lib.Value.value` - - The value. - - - - :type: number *(readonly)* - - - .. py:method:: typeName() -> any - - *Inherited from* :py:meth:`@scope/jsii-calc-base.Base <@scope/jsii-calc-base.Base.typeName>` - - :return: the name of the class (to verify native type names are created for derived classes). - :rtype: any - - - .. py:method:: hello() -> string - - *Inherited from* :py:meth:`jsii-calc.BinaryOperation ` - - Say hello! - - - - :rtype: string - - - .. py:attribute:: lhs - - *Inherited from* :py:attr:`jsii-calc.BinaryOperation ` - - Left-hand side operand. - - - - :type: :py:class:`@scope/jsii-calc-lib.Value`\ *(readonly)* - - - .. py:attribute:: rhs - - *Inherited from* :py:attr:`jsii-calc.BinaryOperation ` - - Right-hand side operand. - - - - :type: :py:class:`@scope/jsii-calc-lib.Value`\ *(readonly)* - - -Negate -^^^^^^ - -.. py:class:: Negate(operand) - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.Negate; - - .. code-tab:: javascript - - const { Negate } = require('jsii-calc'); - - .. code-tab:: typescript - - import { Negate } from 'jsii-calc'; - - - - The negation operation ("-value"). - - - - :extends: :py:class:`~jsii-calc.UnaryOperation`\ - :implements: :py:class:`~jsii-calc.IFriendlier`\ - :param operand: - :type operand: :py:class:`@scope/jsii-calc-lib.Value`\ - - .. py:method:: farewell() -> string - - *Implements* :py:meth:`jsii-calc.IFriendlier.farewell` - - Say farewell. - - - - :rtype: string - - - .. py:method:: goodbye() -> string - - *Implements* :py:meth:`jsii-calc.IFriendlier.goodbye` - - Say goodbye. - - - - :rtype: string - - - .. py:method:: hello() -> string - - *Implements* :py:meth:`@scope/jsii-calc-lib.IFriendly.hello` - - Say hello! - - - - :rtype: string - - - .. py:method:: toString() -> string - - *Implements* :py:meth:`@scope/jsii-calc-lib.Operation.toString` - - String representation of the value. - - - - :rtype: string - - - .. py:attribute:: value - - *Implements* :py:meth:`@scope/jsii-calc-lib.Value.value` - - The value. - - - - :type: number *(readonly)* - - - .. py:method:: typeName() -> any - - *Inherited from* :py:meth:`@scope/jsii-calc-base.Base <@scope/jsii-calc-base.Base.typeName>` - - :return: the name of the class (to verify native type names are created for derived classes). - :rtype: any - - - .. py:attribute:: operand - - *Inherited from* :py:attr:`jsii-calc.UnaryOperation ` - - :type: :py:class:`@scope/jsii-calc-lib.Value`\ *(readonly)* - - -NodeStandardLibrary -^^^^^^^^^^^^^^^^^^^ - -.. py:class:: NodeStandardLibrary() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.NodeStandardLibrary; - - .. code-tab:: javascript - - const { NodeStandardLibrary } = require('jsii-calc'); - - .. code-tab:: typescript - - import { NodeStandardLibrary } from 'jsii-calc'; - - - - Test fixture to verify that jsii modules can use the node standard library. - - - - - .. py:method:: cryptoSha256() -> string - - Uses node.js "crypto" module to calculate sha256 of a string. - - - - :return: "6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50" - :rtype: string - - - .. py:method:: fsReadFile() -> string - - Reads a local resource file (resource.txt) asynchronously. - - - - :return: "Hello, resource!" - :rtype: string - - - .. py:method:: fsReadFileSync() -> string - - Sync version of fsReadFile. - - - - :return: "Hello, resource! SYNC!" - :rtype: string - - - .. py:attribute:: osPlatform - - Returns the current os.platform() from the "os" node module. - - - - :type: string *(readonly)* - - -NullShouldBeTreatedAsUndefined -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: NullShouldBeTreatedAsUndefined(_param1, [optional]) - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.NullShouldBeTreatedAsUndefined; - - .. code-tab:: javascript - - const { NullShouldBeTreatedAsUndefined } = require('jsii-calc'); - - .. code-tab:: typescript - - import { NullShouldBeTreatedAsUndefined } from 'jsii-calc'; - - - - jsii#282, aws-cdk#157: null should be treated as "undefined". - - - - :param _param1: - :type _param1: string - :param optional: - :type optional: any - - .. py:method:: giveMeUndefined([value]) - - :param value: - :type value: any - - - .. py:method:: giveMeUndefinedInsideAnObject(input) - - :param input: - :type input: :py:class:`~jsii-calc.NullShouldBeTreatedAsUndefinedData`\ - - - .. py:method:: verifyPropertyIsUndefined() - - - - .. py:attribute:: changeMeToUndefined - - :type: string *(optional)* - - -NullShouldBeTreatedAsUndefinedData (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: NullShouldBeTreatedAsUndefinedData - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.NullShouldBeTreatedAsUndefinedData; - - .. code-tab:: javascript - - // NullShouldBeTreatedAsUndefinedData is an interface - - .. code-tab:: typescript - - import { NullShouldBeTreatedAsUndefinedData } from 'jsii-calc'; - - - - - - .. py:attribute:: arrayWithThreeElementsAndUndefinedAsSecondArgument - - :type: any[] *(readonly)* - - - .. py:attribute:: thisShouldBeUndefined - - :type: any *(readonly)* - - -NumberGenerator -^^^^^^^^^^^^^^^ - -.. py:class:: NumberGenerator(generator) - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.NumberGenerator; - - .. code-tab:: javascript - - const { NumberGenerator } = require('jsii-calc'); - - .. code-tab:: typescript - - import { NumberGenerator } from 'jsii-calc'; - - - - This allows us to test that a reference can be stored for objects that implement interfaces. - - - - :param generator: - :type generator: :py:class:`~jsii-calc.IRandomNumberGenerator`\ - - .. py:method:: isSameGenerator(gen) -> boolean - - :param gen: - :type gen: :py:class:`~jsii-calc.IRandomNumberGenerator`\ - :rtype: boolean - - - .. py:method:: nextTimes100() -> number - - :rtype: number - - - .. py:attribute:: generator - - :type: :py:class:`~jsii-calc.IRandomNumberGenerator`\ - - -ObjectRefsInCollections -^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: ObjectRefsInCollections() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.ObjectRefsInCollections; - - .. code-tab:: javascript - - const { ObjectRefsInCollections } = require('jsii-calc'); - - .. code-tab:: typescript - - import { ObjectRefsInCollections } from 'jsii-calc'; - - - - Verify that object references can be passed inside collections. - - - - - .. py:method:: sumFromArray(values) -> number - - Returns the sum of all values. - - - - :param values: - :type values: :py:class:`@scope/jsii-calc-lib.Value`\ [] - :rtype: number - - - .. py:method:: sumFromMap(values) -> number - - Returns the sum of all values in a map. - - - - :param values: - :type values: string => :py:class:`@scope/jsii-calc-lib.Value`\ - :rtype: number - - -Old -^^^ - -.. py:class:: Old() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.Old; - - .. code-tab:: javascript - - const { Old } = require('jsii-calc'); - - .. code-tab:: typescript - - import { Old } from 'jsii-calc'; - - - - Old class. - - - - - .. py:method:: doAThing() - - Doo wop that thing. - - - - - -OptionalConstructorArgument -^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: OptionalConstructorArgument(arg1, arg2, [arg3]) - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.OptionalConstructorArgument; - - .. code-tab:: javascript - - const { OptionalConstructorArgument } = require('jsii-calc'); - - .. code-tab:: typescript - - import { OptionalConstructorArgument } from 'jsii-calc'; - - - - :param arg1: - :type arg1: number - :param arg2: - :type arg2: string - :param arg3: - :type arg3: date - - .. py:attribute:: arg1 - - :type: number *(readonly)* - - - .. py:attribute:: arg2 - - :type: string *(readonly)* - - - .. py:attribute:: arg3 - - :type: date *(optional)* *(readonly)* - - -OptionalStruct (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: OptionalStruct - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.OptionalStruct; - - .. code-tab:: javascript - - // OptionalStruct is an interface - - .. code-tab:: typescript - - import { OptionalStruct } from 'jsii-calc'; - - - - - - .. py:attribute:: field - - :type: string *(optional)* *(readonly)* - - -OptionalStructConsumer -^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: OptionalStructConsumer([optionalStruct]) - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.OptionalStructConsumer; - - .. code-tab:: javascript - - const { OptionalStructConsumer } = require('jsii-calc'); - - .. code-tab:: typescript - - import { OptionalStructConsumer } from 'jsii-calc'; - - - - :param optionalStruct: - :type optionalStruct: :py:class:`~jsii-calc.OptionalStruct`\ - - .. py:attribute:: parameterWasUndefined - - :type: boolean *(readonly)* - - - .. py:attribute:: fieldValue - - :type: string *(optional)* *(readonly)* - - -OverrideReturnsObject -^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: OverrideReturnsObject() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.OverrideReturnsObject; - - .. code-tab:: javascript - - const { OverrideReturnsObject } = require('jsii-calc'); - - .. code-tab:: typescript - - import { OverrideReturnsObject } from 'jsii-calc'; - - - - - .. py:method:: test(obj) -> number - - :param obj: - :type obj: :py:class:`~jsii-calc.IReturnsNumber`\ - :rtype: number - - -PartiallyInitializedThisConsumer -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: PartiallyInitializedThisConsumer() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.PartiallyInitializedThisConsumer; - - .. code-tab:: javascript - - const { PartiallyInitializedThisConsumer } = require('jsii-calc'); - - .. code-tab:: typescript - - import { PartiallyInitializedThisConsumer } from 'jsii-calc'; - - - - :abstract: Yes - - .. py:method:: consumePartiallyInitializedThis(obj, dt, ev) -> string - - :param obj: - :type obj: :py:class:`~jsii-calc.ConstructorPassesThisOut`\ - :param dt: - :type dt: date - :param ev: - :type ev: :py:class:`~jsii-calc.AllTypesEnum`\ - :rtype: string - :abstract: Yes - - -Polymorphism -^^^^^^^^^^^^ - -.. py:class:: Polymorphism() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.Polymorphism; - - .. code-tab:: javascript - - const { Polymorphism } = require('jsii-calc'); - - .. code-tab:: typescript - - import { Polymorphism } from 'jsii-calc'; - - - - - .. py:method:: sayHello(friendly) -> string - - :param friendly: - :type friendly: :py:class:`@scope/jsii-calc-lib.IFriendly`\ - :rtype: string - - -Power -^^^^^ - -.. py:class:: Power(base, pow) - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.Power; - - .. code-tab:: javascript - - const { Power } = require('jsii-calc'); - - .. code-tab:: typescript - - import { Power } from 'jsii-calc'; - - - - The power operation. - - - - :extends: :py:class:`~jsii-calc.composition.CompositeOperation`\ - :param base: The base of the power. - :type base: :py:class:`@scope/jsii-calc-lib.Value`\ - :param pow: The number of times to multiply. - :type pow: :py:class:`@scope/jsii-calc-lib.Value`\ - - .. py:attribute:: base - - The base of the power. - - - - :type: :py:class:`@scope/jsii-calc-lib.Value`\ *(readonly)* - - - .. py:attribute:: expression - - *Implements* :py:meth:`jsii-calc.composition.CompositeOperation.expression` - - The expression that this operation consists of. Must be implemented by derived classes. - - - - :type: :py:class:`@scope/jsii-calc-lib.Value`\ *(readonly)* - - - .. py:attribute:: pow - - The number of times to multiply. - - - - :type: :py:class:`@scope/jsii-calc-lib.Value`\ *(readonly)* - - - .. py:method:: typeName() -> any - - *Inherited from* :py:meth:`@scope/jsii-calc-base.Base <@scope/jsii-calc-base.Base.typeName>` - - :return: the name of the class (to verify native type names are created for derived classes). - :rtype: any - - - .. py:method:: toString() -> string - - *Inherited from* :py:meth:`jsii-calc.composition.CompositeOperation ` - - String representation of the value. - - - - :rtype: string - - - .. py:attribute:: value - - *Inherited from* :py:attr:`jsii-calc.composition.CompositeOperation ` - - The value. - - - - :type: number *(readonly)* - - - .. py:attribute:: decorationPostfixes - - *Inherited from* :py:attr:`jsii-calc.composition.CompositeOperation ` - - A set of postfixes to include in a decorated .toString(). - - - - :type: string[] - - - .. py:attribute:: decorationPrefixes - - *Inherited from* :py:attr:`jsii-calc.composition.CompositeOperation ` - - A set of prefixes to include in a decorated .toString(). - - - - :type: string[] - - - .. py:attribute:: stringStyle - - *Inherited from* :py:attr:`jsii-calc.composition.CompositeOperation ` - - The .toString() style. - - - - :type: :py:class:`~jsii-calc.composition.CompositeOperation.CompositionStringStyle`\ - - -PublicClass -^^^^^^^^^^^ - -.. py:class:: PublicClass() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.PublicClass; - - .. code-tab:: javascript - - const { PublicClass } = require('jsii-calc'); - - .. code-tab:: typescript - - import { PublicClass } from 'jsii-calc'; - - - - - .. py:method:: hello() - - - -PythonReservedWords -^^^^^^^^^^^^^^^^^^^ - -.. py:class:: PythonReservedWords() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.PythonReservedWords; - - .. code-tab:: javascript - - const { PythonReservedWords } = require('jsii-calc'); - - .. code-tab:: typescript - - import { PythonReservedWords } from 'jsii-calc'; - - - - - .. py:method:: and() - - - - .. py:method:: as() - - - - .. py:method:: assert() - - - - .. py:method:: async() - - - - .. py:method:: await() - - - - .. py:method:: break() - - - - .. py:method:: class() - - - - .. py:method:: continue() - - - - .. py:method:: def() - - - - .. py:method:: del() - - - - .. py:method:: elif() - - - - .. py:method:: else() - - - - .. py:method:: except() - - - - .. py:method:: finally() - - - - .. py:method:: for() - - - - .. py:method:: from() - - - - .. py:method:: global() - - - - .. py:method:: if() - - - - .. py:method:: import() - - - - .. py:method:: in() - - - - .. py:method:: is() - - - - .. py:method:: lambda() - - - - .. py:method:: nonlocal() - - - - .. py:method:: not() - - - - .. py:method:: or() - - - - .. py:method:: pass() - - - - .. py:method:: raise() - - - - .. py:method:: return() - - - - .. py:method:: try() - - - - .. py:method:: while() - - - - .. py:method:: with() - - - - .. py:method:: yield() - - - -ReferenceEnumFromScopedPackage -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: ReferenceEnumFromScopedPackage() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.ReferenceEnumFromScopedPackage; - - .. code-tab:: javascript - - const { ReferenceEnumFromScopedPackage } = require('jsii-calc'); - - .. code-tab:: typescript - - import { ReferenceEnumFromScopedPackage } from 'jsii-calc'; - - - - See awslabs/jsii#138. - - - - - .. py:method:: loadFoo() -> @scope/jsii-calc-lib.EnumFromScopedModule - - :rtype: :py:class:`@scope/jsii-calc-lib.EnumFromScopedModule`\ *(optional)* - - - .. py:method:: saveFoo(value) - - :param value: - :type value: :py:class:`@scope/jsii-calc-lib.EnumFromScopedModule`\ - - - .. py:attribute:: foo - - :type: :py:class:`@scope/jsii-calc-lib.EnumFromScopedModule`\ *(optional)* - - -ReturnsPrivateImplementationOfInterface -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: ReturnsPrivateImplementationOfInterface() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.ReturnsPrivateImplementationOfInterface; - - .. code-tab:: javascript - - const { ReturnsPrivateImplementationOfInterface } = require('jsii-calc'); - - .. code-tab:: typescript - - import { ReturnsPrivateImplementationOfInterface } from 'jsii-calc'; - - - - Helps ensure the JSII kernel & runtime cooperate correctly when an un-exported instance of a class is returned with a declared type that is an exported interface, and the instance inherits from an exported class. - - https://github.com/aws/jsii/issues/320 - - - - .. py:attribute:: privateImplementation - - :type: :py:class:`~jsii-calc.IPrivatelyImplemented`\ *(readonly)* - - -RuntimeTypeChecking -^^^^^^^^^^^^^^^^^^^ - -.. py:class:: RuntimeTypeChecking() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.RuntimeTypeChecking; - - .. code-tab:: javascript - - const { RuntimeTypeChecking } = require('jsii-calc'); - - .. code-tab:: typescript - - import { RuntimeTypeChecking } from 'jsii-calc'; - - - - - .. py:method:: methodWithDefaultedArguments([arg1, [arg2, [arg3]]]) - - :param arg1: - :type arg1: number - :param arg2: - :type arg2: string - :param arg3: - :type arg3: date - - - .. py:method:: methodWithOptionalAnyArgument([arg]) - - :param arg: - :type arg: any - - - .. py:method:: methodWithOptionalArguments(arg1, arg2, [arg3]) - - Used to verify verification of number of method arguments. - - - - :param arg1: - :type arg1: number - :param arg2: - :type arg2: string - :param arg3: - :type arg3: date - - -SecondLevelStruct (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: SecondLevelStruct - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.SecondLevelStruct; - - .. code-tab:: javascript - - // SecondLevelStruct is an interface - - .. code-tab:: typescript - - import { SecondLevelStruct } from 'jsii-calc'; - - - - - - .. py:attribute:: deeperRequiredProp - - It's long and required. - - - - :type: string *(readonly)* - - - .. py:attribute:: deeperOptionalProp - - It's long, but you'll almost never pass it. - - - - :type: string *(optional)* *(readonly)* - - -SingleInstanceTwoTypes -^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: SingleInstanceTwoTypes() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.SingleInstanceTwoTypes; - - .. code-tab:: javascript - - const { SingleInstanceTwoTypes } = require('jsii-calc'); - - .. code-tab:: typescript - - import { SingleInstanceTwoTypes } from 'jsii-calc'; - - - - Test that a single instance can be returned under two different FQNs. - - - - JSII clients can instantiate 2 different strongly-typed wrappers for the same - - object. Unfortunately, this will break object equality, but if we didn't do - - this it would break runtime type checks in the JVM or CLR. - - - - - .. py:method:: interface1() -> jsii-calc.InbetweenClass - - :rtype: :py:class:`~jsii-calc.InbetweenClass`\ - - - .. py:method:: interface2() -> jsii-calc.IPublicInterface - - :rtype: :py:class:`~jsii-calc.IPublicInterface`\ - - -SingletonInt -^^^^^^^^^^^^ - -.. py:class:: SingletonInt - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.SingletonInt; - - .. code-tab:: javascript - - const { SingletonInt } = require('jsii-calc'); - - .. code-tab:: typescript - - import { SingletonInt } from 'jsii-calc'; - - - - Verifies that singleton enums are handled correctly. - - - - https://github.com/aws/jsii/issues/231 - - - - - .. py:method:: isSingletonInt(value) -> boolean - - :param value: - :type value: number - :rtype: boolean - - -SingletonIntEnum (enum) -^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: SingletonIntEnum - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.SingletonIntEnum; - - .. code-tab:: javascript - - const { SingletonIntEnum } = require('jsii-calc'); - - .. code-tab:: typescript - - import { SingletonIntEnum } from 'jsii-calc'; - - - - A singleton integer. - - - - .. py:data:: SINGLETON_INT - - Elite! - - - - -SingletonString -^^^^^^^^^^^^^^^ - -.. py:class:: SingletonString - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.SingletonString; - - .. code-tab:: javascript - - const { SingletonString } = require('jsii-calc'); - - .. code-tab:: typescript - - import { SingletonString } from 'jsii-calc'; - - - - Verifies that singleton enums are handled correctly. - - - - https://github.com/aws/jsii/issues/231 - - - - - .. py:method:: isSingletonString(value) -> boolean - - :param value: - :type value: string - :rtype: boolean - - -SingletonStringEnum (enum) -^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: SingletonStringEnum - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.SingletonStringEnum; - - .. code-tab:: javascript - - const { SingletonStringEnum } = require('jsii-calc'); - - .. code-tab:: typescript - - import { SingletonStringEnum } from 'jsii-calc'; - - - - A singleton string. - - - - .. py:data:: SINGLETON_STRING - - 1337. - - - - -StableClass -^^^^^^^^^^^ - -.. py:class:: StableClass(readonlyString, [mutableNumber]) - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.StableClass; - - .. code-tab:: javascript - - const { StableClass } = require('jsii-calc'); - - .. code-tab:: typescript - - import { StableClass } from 'jsii-calc'; - - - - :param readonlyString: - :type readonlyString: string - :param mutableNumber: - :type mutableNumber: number - - .. py:method:: method() - - - - .. py:attribute:: readonlyProperty - - :type: string *(readonly)* - - - .. py:attribute:: mutableProperty - - :type: number *(optional)* - - -StableEnum (enum) -^^^^^^^^^^^^^^^^^ - -.. py:class:: StableEnum - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.StableEnum; - - .. code-tab:: javascript - - const { StableEnum } = require('jsii-calc'); - - .. code-tab:: typescript - - import { StableEnum } from 'jsii-calc'; - - - - .. py:data:: OPTION_A - - .. py:data:: OPTION_B - - -StableStruct (interface) -^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: StableStruct - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.StableStruct; - - .. code-tab:: javascript - - // StableStruct is an interface - - .. code-tab:: typescript - - import { StableStruct } from 'jsii-calc'; - - - - - - .. py:attribute:: readonlyProperty - - :type: string *(readonly)* - - -StaticContext -^^^^^^^^^^^^^ - -.. py:class:: StaticContext - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.StaticContext; - - .. code-tab:: javascript - - const { StaticContext } = require('jsii-calc'); - - .. code-tab:: typescript - - import { StaticContext } from 'jsii-calc'; - - - - This is used to validate the ability to use `this` from within a static context. - - - - https://github.com/awslabs/aws-cdk/issues/2304 - - - - - .. py:staticmethod:: canAccessStaticContext() -> boolean - - :rtype: boolean - - - .. py:attribute:: staticVariable - - :type: boolean *(static)* - - -Statics -^^^^^^^ - -.. py:class:: Statics(value) - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.Statics; - - .. code-tab:: javascript - - const { Statics } = require('jsii-calc'); - - .. code-tab:: typescript - - import { Statics } from 'jsii-calc'; - - - - :param value: - :type value: string - - .. py:staticmethod:: staticMethod(name) -> string - - Jsdocs for static method. - - - - :param name: The name of the person to say hello to. - :type name: string - :rtype: string - - - .. py:method:: justMethod() -> string - - :rtype: string - - - .. py:attribute:: BAR - - Constants may also use all-caps. - - - - :type: number *(readonly)* *(static)* - - - .. py:attribute:: ConstObj - - :type: :py:class:`~jsii-calc.DoubleTrouble`\ *(readonly)* *(static)* - - - .. py:attribute:: Foo - - Jsdocs for static property. - - - - :type: string *(readonly)* *(static)* - - - .. py:attribute:: zooBar - - Constants can also use camelCase. - - - - :type: string => string *(readonly)* *(static)* - - - .. py:attribute:: instance - - Jsdocs for static getter. Jsdocs for static setter. - - - - :type: :py:class:`~jsii-calc.Statics`\ *(static)* - - - .. py:attribute:: nonConstStatic - - :type: number *(static)* - - - .. py:attribute:: value - - :type: string *(readonly)* - - -StringEnum (enum) -^^^^^^^^^^^^^^^^^ - -.. py:class:: StringEnum - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.StringEnum; - - .. code-tab:: javascript - - const { StringEnum } = require('jsii-calc'); - - .. code-tab:: typescript - - import { StringEnum } from 'jsii-calc'; - - - - .. py:data:: A - - .. py:data:: B - - .. py:data:: C - - -StripInternal -^^^^^^^^^^^^^ - -.. py:class:: StripInternal() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.StripInternal; - - .. code-tab:: javascript - - const { StripInternal } = require('jsii-calc'); - - .. code-tab:: typescript - - import { StripInternal } from 'jsii-calc'; - - - - - .. py:attribute:: youSeeMe - - :type: string - - -StructPassing -^^^^^^^^^^^^^ - -.. py:class:: StructPassing() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.StructPassing; - - .. code-tab:: javascript - - const { StructPassing } = require('jsii-calc'); - - .. code-tab:: typescript - - import { StructPassing } from 'jsii-calc'; - - - - Just because we can. - - - - - .. py:staticmethod:: howManyVarArgsDidIPass(_positional, *inputs) -> number - - :param _positional: - :type _positional: number - :param \*inputs: - :type \*inputs: :py:class:`~jsii-calc.TopLevelStruct`\ - :rtype: number - - - .. py:staticmethod:: roundTrip(_positional, input) -> jsii-calc.TopLevelStruct - - :param _positional: - :type _positional: number - :param input: - :type input: :py:class:`~jsii-calc.TopLevelStruct`\ - :rtype: :py:class:`~jsii-calc.TopLevelStruct`\ - - -StructWithJavaReservedWords (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: StructWithJavaReservedWords - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.StructWithJavaReservedWords; - - .. code-tab:: javascript - - // StructWithJavaReservedWords is an interface - - .. code-tab:: typescript - - import { StructWithJavaReservedWords } from 'jsii-calc'; - - - - - - .. py:attribute:: default - - :type: string *(readonly)* - - - .. py:attribute:: assert - - :type: string *(optional)* *(readonly)* - - - .. py:attribute:: result - - :type: string *(optional)* *(readonly)* - - - .. py:attribute:: that - - :type: string *(optional)* *(readonly)* - - -Sum -^^^ - -.. py:class:: Sum() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.Sum; - - .. code-tab:: javascript - - const { Sum } = require('jsii-calc'); - - .. code-tab:: typescript - - import { Sum } from 'jsii-calc'; - - - - An operation that sums multiple values. - - - - :extends: :py:class:`~jsii-calc.composition.CompositeOperation`\ - - .. py:attribute:: expression - - *Implements* :py:meth:`jsii-calc.composition.CompositeOperation.expression` - - The expression that this operation consists of. Must be implemented by derived classes. - - - - :type: :py:class:`@scope/jsii-calc-lib.Value`\ *(readonly)* - - - .. py:attribute:: parts - - The parts to sum. - - - - :type: :py:class:`@scope/jsii-calc-lib.Value`\ [] - - - .. py:method:: typeName() -> any - - *Inherited from* :py:meth:`@scope/jsii-calc-base.Base <@scope/jsii-calc-base.Base.typeName>` - - :return: the name of the class (to verify native type names are created for derived classes). - :rtype: any - - - .. py:method:: toString() -> string - - *Inherited from* :py:meth:`jsii-calc.composition.CompositeOperation ` - - String representation of the value. - - - - :rtype: string - - - .. py:attribute:: value - - *Inherited from* :py:attr:`jsii-calc.composition.CompositeOperation ` - - The value. - - - - :type: number *(readonly)* - - - .. py:attribute:: decorationPostfixes - - *Inherited from* :py:attr:`jsii-calc.composition.CompositeOperation ` - - A set of postfixes to include in a decorated .toString(). - - - - :type: string[] - - - .. py:attribute:: decorationPrefixes - - *Inherited from* :py:attr:`jsii-calc.composition.CompositeOperation ` - - A set of prefixes to include in a decorated .toString(). - - - - :type: string[] - - - .. py:attribute:: stringStyle - - *Inherited from* :py:attr:`jsii-calc.composition.CompositeOperation ` - - The .toString() style. - - - - :type: :py:class:`~jsii-calc.composition.CompositeOperation.CompositionStringStyle`\ - - -SyncVirtualMethods -^^^^^^^^^^^^^^^^^^ - -.. py:class:: SyncVirtualMethods() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.SyncVirtualMethods; - - .. code-tab:: javascript - - const { SyncVirtualMethods } = require('jsii-calc'); - - .. code-tab:: typescript - - import { SyncVirtualMethods } from 'jsii-calc'; - - - - - .. py:method:: callerIsAsync() -> number - - :rtype: number - - - .. py:method:: callerIsMethod() -> number - - :rtype: number - - - .. py:method:: modifyOtherProperty(value) - - :param value: - :type value: string - - - .. py:method:: modifyValueOfTheProperty(value) - - :param value: - :type value: string - - - .. py:method:: readA() -> number - - :rtype: number - - - .. py:method:: retrieveOtherProperty() -> string - - :rtype: string - - - .. py:method:: retrieveReadOnlyProperty() -> string - - :rtype: string - - - .. py:method:: retrieveValueOfTheProperty() -> string - - :rtype: string - - - .. py:method:: virtualMethod(n) -> number - - :param n: - :type n: number - :rtype: number - - - .. py:method:: writeA(value) - - :param value: - :type value: number - - - .. py:attribute:: readonlyProperty - - :type: string *(readonly)* - - - .. py:attribute:: a - - :type: number - - - .. py:attribute:: callerIsProperty - - :type: number - - - .. py:attribute:: otherProperty - - :type: string - - - .. py:attribute:: theProperty - - :type: string - - - .. py:attribute:: valueOfOtherProperty - - :type: string - - -Thrower -^^^^^^^ - -.. py:class:: Thrower() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.Thrower; - - .. code-tab:: javascript - - const { Thrower } = require('jsii-calc'); - - .. code-tab:: typescript - - import { Thrower } from 'jsii-calc'; - - - - - .. py:method:: throwError() - - - -TopLevelStruct (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: TopLevelStruct - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.TopLevelStruct; - - .. code-tab:: javascript - - // TopLevelStruct is an interface - - .. code-tab:: typescript - - import { TopLevelStruct } from 'jsii-calc'; - - - - - - .. py:attribute:: required - - This is a required field. - - - - :type: string *(readonly)* - - - .. py:attribute:: secondLevel - - A union to really stress test our serialization. - - - - :type: number or :py:class:`~jsii-calc.SecondLevelStruct`\ *(readonly)* - - - .. py:attribute:: optional - - You don't have to pass this. - - - - :type: string *(optional)* *(readonly)* - - -UnaryOperation -^^^^^^^^^^^^^^ - -.. py:class:: UnaryOperation(operand) - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.UnaryOperation; - - .. code-tab:: javascript - - const { UnaryOperation } = require('jsii-calc'); - - .. code-tab:: typescript - - import { UnaryOperation } from 'jsii-calc'; - - - - An operation on a single operand. - - - - :extends: :py:class:`@scope/jsii-calc-lib.Operation`\ - :abstract: Yes - :param operand: - :type operand: :py:class:`@scope/jsii-calc-lib.Value`\ - - .. py:attribute:: operand - - :type: :py:class:`@scope/jsii-calc-lib.Value`\ *(readonly)* - - - .. py:method:: typeName() -> any - - *Inherited from* :py:meth:`@scope/jsii-calc-base.Base <@scope/jsii-calc-base.Base.typeName>` - - :return: the name of the class (to verify native type names are created for derived classes). - :rtype: any - - - .. py:method:: toString() -> string - - *Inherited from* :py:meth:`@scope/jsii-calc-lib.Operation <@scope/jsii-calc-lib.Operation.toString>` - - String representation of the value. - - - - :rtype: string - :abstract: Yes - - - .. py:attribute:: value - - *Inherited from* :py:attr:`@scope/jsii-calc-lib.Value <@scope/jsii-calc-lib.Value.value>` - - The value. - - - - :type: number *(readonly)* *(abstract)* - - -UnionProperties (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: UnionProperties - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.UnionProperties; - - .. code-tab:: javascript - - // UnionProperties is an interface - - .. code-tab:: typescript - - import { UnionProperties } from 'jsii-calc'; - - - - - - .. py:attribute:: bar - - :type: string or number or :py:class:`~jsii-calc.AllTypes`\ *(readonly)* - - - .. py:attribute:: foo - - :type: string or number *(optional)* *(readonly)* - - -UseBundledDependency -^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: UseBundledDependency() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.UseBundledDependency; - - .. code-tab:: javascript - - const { UseBundledDependency } = require('jsii-calc'); - - .. code-tab:: typescript - - import { UseBundledDependency } from 'jsii-calc'; - - - - - .. py:method:: value() -> any - - :rtype: any - - -UseCalcBase -^^^^^^^^^^^ - -.. py:class:: UseCalcBase() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.UseCalcBase; - - .. code-tab:: javascript - - const { UseCalcBase } = require('jsii-calc'); - - .. code-tab:: typescript - - import { UseCalcBase } from 'jsii-calc'; - - - - Depend on a type from jsii-calc-base as a test for awslabs/jsii#128. - - - - - .. py:method:: hello() -> @scope/jsii-calc-base.Base - - :rtype: :py:class:`@scope/jsii-calc-base.Base`\ - - -UsesInterfaceWithProperties -^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: UsesInterfaceWithProperties(obj) - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.UsesInterfaceWithProperties; - - .. code-tab:: javascript - - const { UsesInterfaceWithProperties } = require('jsii-calc'); - - .. code-tab:: typescript - - import { UsesInterfaceWithProperties } from 'jsii-calc'; - - - - :param obj: - :type obj: :py:class:`~jsii-calc.IInterfaceWithProperties`\ - - .. py:method:: justRead() -> string - - :rtype: string - - - .. py:method:: readStringAndNumber(ext) -> string - - :param ext: - :type ext: :py:class:`~jsii-calc.IInterfaceWithPropertiesExtension`\ - :rtype: string - - - .. py:method:: writeAndRead(value) -> string - - :param value: - :type value: string - :rtype: string - - - .. py:attribute:: obj - - :type: :py:class:`~jsii-calc.IInterfaceWithProperties`\ *(readonly)* - - -VariadicMethod -^^^^^^^^^^^^^^ - -.. py:class:: VariadicMethod(*prefix) - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.VariadicMethod; - - .. code-tab:: javascript - - const { VariadicMethod } = require('jsii-calc'); - - .. code-tab:: typescript - - import { VariadicMethod } from 'jsii-calc'; - - - - :param \*prefix: a prefix that will be use for all values returned by `#asArray`. - :type \*prefix: number - - .. py:method:: asArray(first, *others) -> number[] - - :param first: the first element of the array to be returned (after the `prefix` provided at construction time). - :type first: number - :param \*others: other elements to be included in the array. - :type \*others: number - :rtype: number[] - - -VirtualMethodPlayground -^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: VirtualMethodPlayground() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.VirtualMethodPlayground; - - .. code-tab:: javascript - - const { VirtualMethodPlayground } = require('jsii-calc'); - - .. code-tab:: typescript - - import { VirtualMethodPlayground } from 'jsii-calc'; - - - - - .. py:method:: overrideMeAsync(index) -> number - - :param index: - :type index: number - :rtype: number - - - .. py:method:: overrideMeSync(index) -> number - - :param index: - :type index: number - :rtype: number - - - .. py:method:: parallelSumAsync(count) -> number - - :param count: - :type count: number - :rtype: number - - - .. py:method:: serialSumAsync(count) -> number - - :param count: - :type count: number - :rtype: number - - - .. py:method:: sumSync(count) -> number - - :param count: - :type count: number - :rtype: number - - -VoidCallback -^^^^^^^^^^^^ - -.. py:class:: VoidCallback() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.VoidCallback; - - .. code-tab:: javascript - - const { VoidCallback } = require('jsii-calc'); - - .. code-tab:: typescript - - import { VoidCallback } from 'jsii-calc'; - - - - This test is used to validate the runtimes can return correctly from a void callback. - - - - - Implement `overrideMe` (method does not have to do anything). - - - Invoke `callMe` - - - Verify that `methodWasCalled` is `true`. - - - - :abstract: Yes - - .. py:method:: callMe() - - - - .. py:method:: overrideMe() - - *Protected method* - - :abstract: Yes - - - .. py:attribute:: methodWasCalled - - :type: boolean *(readonly)* - - -WithPrivatePropertyInConstructor -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: WithPrivatePropertyInConstructor([privateField]) - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.WithPrivatePropertyInConstructor; - - .. code-tab:: javascript - - const { WithPrivatePropertyInConstructor } = require('jsii-calc'); - - .. code-tab:: typescript - - import { WithPrivatePropertyInConstructor } from 'jsii-calc'; - - - - Verifies that private property declarations in constructor arguments are hidden. - - - - :param privateField: - :type privateField: string - - .. py:attribute:: success - - :type: boolean *(readonly)* - - - -composition -^^^^^^^^^^^ -.. py:module:: jsii-calc.composition - -CompositeOperation -~~~~~~~~~~~~~~~~~~ - -.. py:class:: CompositeOperation() - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.composition.CompositeOperation; - - .. code-tab:: javascript - - const { composition.CompositeOperation } = require('jsii-calc'); - - .. code-tab:: typescript - - import { composition.CompositeOperation } from 'jsii-calc'; - - - - Abstract operation composed from an expression of other operations. - - - - :extends: :py:class:`@scope/jsii-calc-lib.Operation`\ - :abstract: Yes - - .. py:method:: toString() -> string - - *Implements* :py:meth:`@scope/jsii-calc-lib.Operation.toString` - - String representation of the value. - - - - :rtype: string - - - .. py:attribute:: expression - - The expression that this operation consists of. Must be implemented by derived classes. - - - - :type: :py:class:`@scope/jsii-calc-lib.Value`\ *(readonly)* *(abstract)* - - - .. py:attribute:: value - - *Implements* :py:meth:`@scope/jsii-calc-lib.Value.value` - - The value. - - - - :type: number *(readonly)* - - - .. py:attribute:: decorationPostfixes - - A set of postfixes to include in a decorated .toString(). - - - - :type: string[] - - - .. py:attribute:: decorationPrefixes - - A set of prefixes to include in a decorated .toString(). - - - - :type: string[] - - - .. py:attribute:: stringStyle - - The .toString() style. - - - - :type: :py:class:`~jsii-calc.composition.CompositeOperation.CompositionStringStyle`\ - - .. py:class:: CompositionStringStyle - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.composition.CompositeOperation.CompositionStringStyle; - - .. code-tab:: javascript - - const { composition.CompositeOperation.CompositionStringStyle } = require('jsii-calc'); - - .. code-tab:: typescript - - import { composition.CompositeOperation.CompositionStringStyle } from 'jsii-calc'; - - - - Style of .toString() output for CompositeOperation. - - - - .. py:data:: NORMAL - - Normal string expression. - - - - .. py:data:: DECORATED - - Decorated string expression. - - - - - - .. py:method:: typeName() -> any - - *Inherited from* :py:meth:`@scope/jsii-calc-base.Base <@scope/jsii-calc-base.Base.typeName>` - - :return: the name of the class (to verify native type names are created for derived classes). - :rtype: any - - - -.. py:currentmodule:: jsii-calc - diff --git a/packages/jsii-ruby-runtime/generate.sh b/packages/jsii-ruby-runtime/generate.sh index 038e01a321..5cbaabfea3 100755 --- a/packages/jsii-ruby-runtime/generate.sh +++ b/packages/jsii-ruby-runtime/generate.sh @@ -11,4 +11,4 @@ rsync -av $(node -p 'require("path").dirname(require.resolve("jsii-runtime/packa # generate jsii-calc for ruby mkdir -p project/test/jsii-calc -jsii-pacmak --no-force-subdirectory -t ruby -o project/test/jsii-calc --recurse ../jsii-calc +jsii-pacmak --no-force-subdirectory -t ruby -o project/test/jsii-calc --recurse ../jsii-calc --force-target