> cache = new HashMap<>();
public $Module() {
super(\\"4c6b576fbe7e27053874813d9754cb2e46811d806c1e0aa9aae8add4c3763060\\", \\"0.0.0\\", $Module.class, \\"4c6b576fbe7e27053874813d9754cb2e46811d806c1e0aa9aae8add4c3763060@0.0.0.jsii.tgz\\");
}
@Override
protected Class> resolveClass(final String fqn) throws ClassNotFoundException {
if (!MODULE_TYPES.containsKey(fqn)) {
throw new ClassNotFoundException(\\"Unknown JSII type: \\" + fqn);
}
String className = MODULE_TYPES.get(fqn);
if (!this.cache.containsKey(className)) {
this.cache.put(className, this.findClass(className));
}
return this.cache.get(className);
}
private Class> findClass(final String binaryName) {
try {
return Class.forName(binaryName);
}
catch (final ClassNotFoundException exception) {
throw new RuntimeException(exception);
}
}
}
",
"src/main/java/mypackage/Calculator.java": "package mypackage;
/**
* A sophisticaed multi-language calculator.
*/
@software.amazon.jsii.Jsii(module = mypackage.$Module.class, fqn = \\"4c6b576fbe7e27053874813d9754cb2e46811d806c1e0aa9aae8add4c3763060.Calculator\\")
public class Calculator extends software.amazon.jsii.JsiiObject {
protected Calculator(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected Calculator(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
public Calculator() {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this);
}
/**
* Adds the two operands.
*
* @param ops operands. This parameter is required.
*/
public @org.jetbrains.annotations.NotNull java.lang.Number add(final @org.jetbrains.annotations.NotNull mypackage.Operands ops) {
return software.amazon.jsii.Kernel.call(this, \\"add\\", software.amazon.jsii.NativeType.forClass(java.lang.Number.class), new Object[] { java.util.Objects.requireNonNull(ops, \\"ops is required\\") });
}
/**
* Multiplies the two operands.
*
* @param ops operands. This parameter is required.
*/
public @org.jetbrains.annotations.NotNull java.lang.Number mul(final @org.jetbrains.annotations.NotNull mypackage.Operands ops) {
return software.amazon.jsii.Kernel.call(this, \\"mul\\", software.amazon.jsii.NativeType.forClass(java.lang.Number.class), new Object[] { java.util.Objects.requireNonNull(ops, \\"ops is required\\") });
}
/**
* Subtracts the two operands.
*
* @param ops operands. This parameter is required.
*/
public @org.jetbrains.annotations.NotNull java.lang.Number sub(final @org.jetbrains.annotations.NotNull mypackage.Operands ops) {
return software.amazon.jsii.Kernel.call(this, \\"sub\\", software.amazon.jsii.NativeType.forClass(java.lang.Number.class), new Object[] { java.util.Objects.requireNonNull(ops, \\"ops is required\\") });
}
}
",
"src/main/java/mypackage/Operands.java": "package mypackage;
/**
* Math operands.
*/
@software.amazon.jsii.Jsii(module = mypackage.$Module.class, fqn = \\"4c6b576fbe7e27053874813d9754cb2e46811d806c1e0aa9aae8add4c3763060.Operands\\")
@software.amazon.jsii.Jsii.Proxy(Operands.Jsii$Proxy.class)
public interface Operands extends software.amazon.jsii.JsiiSerializable {
/**
* Left-hand side operand.
*/
@org.jetbrains.annotations.NotNull java.lang.Number getLhs();
/**
* Right-hand side operand.
*/
@org.jetbrains.annotations.NotNull java.lang.Number getRhs();
/**
* @return a {@link Builder} of {@link Operands}
*/
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link Operands}
*/
public static final class Builder implements software.amazon.jsii.Builder {
java.lang.Number lhs;
java.lang.Number rhs;
/**
* Sets the value of {@link Operands#getLhs}
* @param lhs Left-hand side operand. This parameter is required.
* @return {@code this}
*/
public Builder lhs(java.lang.Number lhs) {
this.lhs = lhs;
return this;
}
/**
* Sets the value of {@link Operands#getRhs}
* @param rhs Right-hand side operand. This parameter is required.
* @return {@code this}
*/
public Builder rhs(java.lang.Number rhs) {
this.rhs = rhs;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link Operands}
* @throws NullPointerException if any required attribute was not provided
*/
@Override
public Operands build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link Operands}
*/
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements Operands {
private final java.lang.Number lhs;
private final java.lang.Number rhs;
/**
* Constructor that initializes the object based on values retrieved from the JsiiObject.
* @param objRef Reference to the JSII managed object.
*/
protected Jsii$Proxy(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
this.lhs = software.amazon.jsii.Kernel.get(this, \\"lhs\\", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
this.rhs = software.amazon.jsii.Kernel.get(this, \\"rhs\\", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
}
/**
* Constructor that initializes the object based on literal property values passed by the {@link Builder}.
*/
protected Jsii$Proxy(final Builder builder) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
this.lhs = java.util.Objects.requireNonNull(builder.lhs, \\"lhs is required\\");
this.rhs = java.util.Objects.requireNonNull(builder.rhs, \\"rhs is required\\");
}
@Override
public final java.lang.Number getLhs() {
return this.lhs;
}
@Override
public final java.lang.Number getRhs() {
return this.rhs;
}
@Override
@software.amazon.jsii.Internal
public com.fasterxml.jackson.databind.JsonNode $jsii$toJson() {
final com.fasterxml.jackson.databind.ObjectMapper om = software.amazon.jsii.JsiiObjectMapper.INSTANCE;
final com.fasterxml.jackson.databind.node.ObjectNode data = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
data.set(\\"lhs\\", om.valueToTree(this.getLhs()));
data.set(\\"rhs\\", om.valueToTree(this.getRhs()));
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set(\\"fqn\\", om.valueToTree(\\"4c6b576fbe7e27053874813d9754cb2e46811d806c1e0aa9aae8add4c3763060.Operands\\"));
struct.set(\\"data\\", data);
final com.fasterxml.jackson.databind.node.ObjectNode obj = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
obj.set(\\"$jsii.struct\\", struct);
return obj;
}
@Override
public final boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Operands.Jsii$Proxy that = (Operands.Jsii$Proxy) o;
if (!lhs.equals(that.lhs)) return false;
return this.rhs.equals(that.rhs);
}
@Override
public final int hashCode() {
int result = this.lhs.hashCode();
result = 31 * result + (this.rhs.hashCode());
return result;
}
}
}
",
"src/main/resources/mypackage/$Module.txt": "4c6b576fbe7e27053874813d9754cb2e46811d806c1e0aa9aae8add4c3763060.Calculator=mypackage.Calculator
4c6b576fbe7e27053874813d9754cb2e46811d806c1e0aa9aae8add4c3763060.Operands=mypackage.Operands
",
}
`;
exports[`jsii output 1`] = `
Object {
"author": Object {
"name": "generated@generated.com",
"roles": Array [
"author",
],
},
"description": "4c6b576fbe7e27053874813d9754cb2e46811d806c1e0aa9aae8add4c3763060",
"fingerprint": "jEYc9fQOnPKOdif15XcY4uxEGn37bZ/OcX3ItJRtDnc=",
"homepage": "http://generated",
"jsiiVersion": "5.1.10 (build 041401a)",
"license": "UNLICENSED",
"metadata": Object {
"jsii": Object {
"pacmak": Object {
"hasDefaultInterfaces": true,
},
},
},
"name": "4c6b576fbe7e27053874813d9754cb2e46811d806c1e0aa9aae8add4c3763060",
"repository": Object {
"type": "git",
"url": "http://generated",
},
"schema": "jsii/0.10.0",
"targets": Object {
"js": Object {
"npm": "4c6b576fbe7e27053874813d9754cb2e46811d806c1e0aa9aae8add4c3763060",
},
},
"types": Object {
"4c6b576fbe7e27053874813d9754cb2e46811d806c1e0aa9aae8add4c3763060.Calculator": Object {
"assembly": "4c6b576fbe7e27053874813d9754cb2e46811d806c1e0aa9aae8add4c3763060",
"docs": Object {
"summary": "A sophisticaed multi-language calculator.",
},
"fqn": "4c6b576fbe7e27053874813d9754cb2e46811d806c1e0aa9aae8add4c3763060.Calculator",
"initializer": Object {},
"kind": "class",
"locationInModule": Object {
"filename": "lib/main.ts",
"line": 19,
},
"methods": Array [
Object {
"docs": Object {
"summary": "Adds the two operands.",
},
"locationInModule": Object {
"filename": "lib/main.ts",
"line": 24,
},
"name": "add",
"parameters": Array [
Object {
"docs": Object {
"summary": "operands.",
},
"name": "ops",
"type": Object {
"fqn": "4c6b576fbe7e27053874813d9754cb2e46811d806c1e0aa9aae8add4c3763060.Operands",
},
},
],
"returns": Object {
"type": Object {
"primitive": "number",
},
},
},
Object {
"docs": Object {
"summary": "Multiplies the two operands.",
},
"locationInModule": Object {
"filename": "lib/main.ts",
"line": 40,
},
"name": "mul",
"parameters": Array [
Object {
"docs": Object {
"summary": "operands.",
},
"name": "ops",
"type": Object {
"fqn": "4c6b576fbe7e27053874813d9754cb2e46811d806c1e0aa9aae8add4c3763060.Operands",
},
},
],
"returns": Object {
"type": Object {
"primitive": "number",
},
},
},
Object {
"docs": Object {
"summary": "Subtracts the two operands.",
},
"locationInModule": Object {
"filename": "lib/main.ts",
"line": 32,
},
"name": "sub",
"parameters": Array [
Object {
"docs": Object {
"summary": "operands.",
},
"name": "ops",
"type": Object {
"fqn": "4c6b576fbe7e27053874813d9754cb2e46811d806c1e0aa9aae8add4c3763060.Operands",
},
},
],
"returns": Object {
"type": Object {
"primitive": "number",
},
},
},
],
"name": "Calculator",
"symbolId": "lib/main:Calculator",
},
"4c6b576fbe7e27053874813d9754cb2e46811d806c1e0aa9aae8add4c3763060.Operands": Object {
"assembly": "4c6b576fbe7e27053874813d9754cb2e46811d806c1e0aa9aae8add4c3763060",
"datatype": true,
"docs": Object {
"summary": "Math operands.",
},
"fqn": "4c6b576fbe7e27053874813d9754cb2e46811d806c1e0aa9aae8add4c3763060.Operands",
"kind": "interface",
"locationInModule": Object {
"filename": "lib/main.ts",
"line": 4,
},
"name": "Operands",
"properties": Array [
Object {
"abstract": true,
"docs": Object {
"summary": "Left-hand side operand.",
},
"immutable": true,
"locationInModule": Object {
"filename": "lib/main.ts",
"line": 8,
},
"name": "lhs",
"type": Object {
"primitive": "number",
},
},
Object {
"abstract": true,
"docs": Object {
"summary": "Right-hand side operand.",
},
"immutable": true,
"locationInModule": Object {
"filename": "lib/main.ts",
"line": 13,
},
"name": "rhs",
"type": Object {
"primitive": "number",
},
},
],
"symbolId": "lib/main:Operands",
},
},
"version": "0.0.0",
}
`;
exports[`python output 1`] = `
Object {
"my/python/module/__init__.py": "import abc
import builtins
import datetime
import enum
import typing
import jsii
import publication
import typing_extensions
from typeguard import check_type
from ._jsii import *
class Calculator(
metaclass=jsii.JSIIMeta,
jsii_type=\\"4c6b576fbe7e27053874813d9754cb2e46811d806c1e0aa9aae8add4c3763060.Calculator\\",
):
'''A sophisticaed multi-language calculator.'''
def __init__(self) -> None:
jsii.create(self.__class__, self, [])
@jsii.member(jsii_name=\\"add\\")
def add(self, *, lhs: jsii.Number, rhs: jsii.Number) -> jsii.Number:
'''Adds the two operands.
:param lhs: Left-hand side operand.
:param rhs: Right-hand side operand.
'''
ops = Operands(lhs=lhs, rhs=rhs)
return typing.cast(jsii.Number, jsii.invoke(self, \\"add\\", [ops]))
@jsii.member(jsii_name=\\"mul\\")
def mul(self, *, lhs: jsii.Number, rhs: jsii.Number) -> jsii.Number:
'''Multiplies the two operands.
:param lhs: Left-hand side operand.
:param rhs: Right-hand side operand.
'''
ops = Operands(lhs=lhs, rhs=rhs)
return typing.cast(jsii.Number, jsii.invoke(self, \\"mul\\", [ops]))
@jsii.member(jsii_name=\\"sub\\")
def sub(self, *, lhs: jsii.Number, rhs: jsii.Number) -> jsii.Number:
'''Subtracts the two operands.
:param lhs: Left-hand side operand.
:param rhs: Right-hand side operand.
'''
ops = Operands(lhs=lhs, rhs=rhs)
return typing.cast(jsii.Number, jsii.invoke(self, \\"sub\\", [ops]))
@jsii.data_type(
jsii_type=\\"4c6b576fbe7e27053874813d9754cb2e46811d806c1e0aa9aae8add4c3763060.Operands\\",
jsii_struct_bases=[],
name_mapping={\\"lhs\\": \\"lhs\\", \\"rhs\\": \\"rhs\\"},
)
class Operands:
def __init__(self, *, lhs: jsii.Number, rhs: jsii.Number) -> None:
'''Math operands.
:param lhs: Left-hand side operand.
:param rhs: Right-hand side operand.
'''
if __debug__:
type_hints = typing.get_type_hints(_typecheckingstub__62b72180950e738f3da9d30928f89aeb536b4a0ac6dbb349ce3eb7a1e3c2a293)
check_type(argname=\\"argument lhs\\", value=lhs, expected_type=type_hints[\\"lhs\\"])
check_type(argname=\\"argument rhs\\", value=rhs, expected_type=type_hints[\\"rhs\\"])
self._values: typing.Dict[builtins.str, typing.Any] = {
\\"lhs\\": lhs,
\\"rhs\\": rhs,
}
@builtins.property
def lhs(self) -> jsii.Number:
'''Left-hand side operand.'''
result = self._values.get(\\"lhs\\")
assert result is not None, \\"Required property 'lhs' is missing\\"
return typing.cast(jsii.Number, result)
@builtins.property
def rhs(self) -> jsii.Number:
'''Right-hand side operand.'''
result = self._values.get(\\"rhs\\")
assert result is not None, \\"Required property 'rhs' is missing\\"
return typing.cast(jsii.Number, result)
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return \\"Operands(%s)\\" % \\", \\".join(
k + \\"=\\" + repr(v) for k, v in self._values.items()
)
__all__ = [
\\"Calculator\\",
\\"Operands\\",
]
publication.publish()
def _typecheckingstub__62b72180950e738f3da9d30928f89aeb536b4a0ac6dbb349ce3eb7a1e3c2a293(
*,
lhs: jsii.Number,
rhs: jsii.Number,
) -> None:
\\"\\"\\"Type checking stubs\\"\\"\\"
pass
",
"my/python/module/_jsii/__init__.py": "import abc
import builtins
import datetime
import enum
import typing
import jsii
import publication
import typing_extensions
from typeguard import check_type
__jsii_assembly__ = jsii.JSIIAssembly.load(
\\"4c6b576fbe7e27053874813d9754cb2e46811d806c1e0aa9aae8add4c3763060\\",
\\"0.0.0\\",
__name__[0:-6],
\\"4c6b576fbe7e27053874813d9754cb2e46811d806c1e0aa9aae8add4c3763060@0.0.0.jsii.tgz\\",
)
__all__ = [
\\"__jsii_assembly__\\",
]
publication.publish()
",
"my/python/module/py.typed": "
",
}
`;