| Package | Description |
|---|---|
| org.jsweet.transpiler |
This package contains the JSweet Java to JavaScript transpiler
implementation.
|
| org.jsweet.transpiler.extension |
This package contains the basic extensions of the JSweet transpiler, as
printer adapters.
|
| org.jsweet.transpiler.model |
This package contains a extension of the Java model (
javax.lang.model
) to cover Java expressions and statements. |
| org.jsweet.transpiler.util |
This package contains utilities for the JSweet transpiler.
|
| Modifier and Type | Method and Description |
|---|---|
List<BiFunction<ExtendedElement,String,Object>> |
JSweetContext.getFunctionalTypeMappings()
Returns the functional type mappings.
|
| Modifier and Type | Method and Description |
|---|---|
void |
JSweetContext.addTypeMapping(BiFunction<ExtendedElement,String,Object> mappingFunction)
Adds a functional type mapping.
|
| Modifier and Type | Method and Description |
|---|---|
ExtendedElement |
PrinterAdapter.getParentElement()
Gets the parent element in the printer's scanning stack.
|
| Modifier and Type | Method and Description |
|---|---|
protected List<BiFunction<ExtendedElement,String,Object>> |
PrinterAdapter.getFunctionalTypeMappings()
Gets the functional type mappings.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
Java2TypeScriptAdapter.delegateToEmulLayerStatic(String targetClassName,
String targetMethodName,
ExtendedElement target) |
PrinterAdapter |
PrinterAdapter.print(ExtendedElement element)
Prints a generic element by delegating to the printer.
|
protected RemoveJavaDependenciesAdapter |
RemoveJavaDependenciesAdapter.print(ExtendedElement expression,
boolean delegate) |
void |
PrinterAdapter.print(String exprStr,
ExtendedElement expr)
Print either a string, or a tree if the string is null.
|
protected void |
Java2TypeScriptAdapter.printFunctionalInvocation(ExtendedElement target,
String functionName,
List<ExtendedElement> arguments) |
protected PrinterAdapter |
Java2TypeScriptAdapter.printTarget(ExtendedElement target) |
protected void |
PrinterAdapter.report(ExtendedElement element,
JSweetProblem problem,
Object... params)
Reports a problem during the printing phase.
|
protected void |
PrinterAdapter.report(ExtendedElement element,
Name name,
JSweetProblem problem,
Object... params)
Reports a problem during the printing phase.
|
boolean |
PrinterAdapter.substitute(ExtendedElement extendedElement)
Upcalled by the transpiler to forward to the right subtitution method
depending on the actual extended element type.
|
boolean |
Java2TypeScriptAdapter.substituteAndPrintType(ExtendedElement enclosingElement,
TypeElement type) |
boolean |
StringEnumAdapter.substituteCaseStatementPattern(CaseElement caseStatement,
ExtendedElement pattern)
Special case for the case statement patter.
|
boolean |
PrinterAdapter.substituteCaseStatementPattern(CaseElement caseStatement,
ExtendedElement pattern)
Substitutes if necessary the pattern of a case statement.
|
boolean |
PrinterAdapter.substituteInstanceof(String exprStr,
ExtendedElement expr,
TypeMirror type)
Substitutes if necessary an instanceof expression.
|
boolean |
RemoveJavaDependenciesAdapter.substituteInstanceof(String exprStr,
ExtendedElement expr,
TypeMirror typeMirror) |
protected boolean |
RemoveJavaDependenciesAdapter.substituteMethodInvocationOnArrays(MethodInvocationElement invocation,
String targetMethodName,
ExtendedElement targetExpression,
boolean delegate) |
protected boolean |
RemoveJavaDependenciesAdapter.substituteMethodInvocationOnCollections(MethodInvocationElement invocation,
String targetMethodName,
ExtendedElement targetExpression,
boolean delegate) |
protected boolean |
RemoveJavaDependenciesAdapter.substituteMethodInvocationOnMap(MethodInvocationElement invocation,
String targetMethodName,
ExtendedElement targetExpression,
boolean delegate) |
| Modifier and Type | Method and Description |
|---|---|
void |
PrinterAdapter.addTypeMapping(BiFunction<ExtendedElement,String,Object> mappingFunction)
Adds a type mapping so that this adapter substitutes the source type tree
with a target type during the transpilation process.
|
PrinterAdapter |
PrinterAdapter.printArgList(List<? extends ExtendedElement> args)
Prints an argument list by delegating to the printer.
|
protected void |
Java2TypeScriptAdapter.printFunctionalInvocation(ExtendedElement target,
String functionName,
List<ExtendedElement> arguments) |
| Modifier and Type | Interface and Description |
|---|---|
interface |
ArrayAccessElement
An AST node for a Java array access expression, of the form
indexed[index]. |
interface |
AssignmentElement
An AST node for a Java assignment statement/expression, of the form
assignedVariable = value. |
interface |
AssignmentWithOperatorElement
An AST node for a Java assignment with operator statement/expression, of the form
assignedVariable += value. |
interface |
BinaryOperatorElement
The model element that represents a binary operator (+, *, &&, ...).
|
interface |
CaseElement
An AST node for the Java case statement.
|
interface |
ForeachLoopElement
An AST node for a Java for each loop statement, of the form
for(var : iterable) body. |
interface |
IdentifierElement
An AST node for a Java identifier.
|
interface |
ImportElement
An AST node for a Java import.
|
interface |
InvocationElement
The model element for a method invocation.
|
interface |
LiteralElement
An AST node for a Java literal.
|
interface |
MethodInvocationElement
An AST node for a Java method invocation.
|
interface |
NewArrayElement
An AST node for a Java new array expression.
|
interface |
NewClassElement
An AST node for a Java new class expression.
|
interface |
UnaryOperatorElement
The model element that represents a binary operator (+, *, &&, ...).
|
interface |
VariableAccessElement
An AST node for a Java variable/field access (of the form
targetExpression.variableName or variableName). |
| Modifier and Type | Method and Description |
|---|---|
ExtendedElement |
ExtendedElementFactory.create(com.sun.tools.javac.tree.JCTree tree)
Creates an extended element out of a javac tree.
|
ExtendedElement |
UnaryOperatorElement.getArgument()
Gets the operator element.
|
ExtendedElement |
InvocationElement.getArgument(int i)
Gets the ith argument that is passed to the invoked element.
|
ExtendedElement |
ForeachLoopElement.getBody()
The body of the foreach loop.
|
ExtendedElement |
NewClassElement.getConstructorAccess()
Gets the constructor access expression.
|
ExtendedElement |
NewArrayElement.getDimension(int i)
Gets the ith dimension.
|
ExtendedElement |
ArrayAccessElement.getIndex()
Gets the expression passed as the index.
|
ExtendedElement |
ForeachLoopElement.getIterableExpression()
The expression returning the iterable (or array) being looped over.
|
ExtendedElement |
BinaryOperatorElement.getLeftHandSide()
Gets the left-hand side element.
|
ExtendedElement |
BinaryOperatorElement.getRightHandSide()
Gets the right-hand side element.
|
ExtendedElement |
ArrayAccessElement.getTarget()
Gets the expression passed being accessed as an array.
|
ExtendedElement |
MethodInvocationElement.getTargetExpression()
The target expression of the invocation if any, null otherwise.
|
ExtendedElement |
VariableAccessElement.getTargetExpression()
Gets the target expression of the access (the part before the dot), if
any.
|
ExtendedElement |
AssignmentWithOperatorElement.getValue()
Gets the expression passed as the index.
|
ExtendedElement |
AssignmentElement.getValue()
Gets the expression passed as the index.
|
| Modifier and Type | Method and Description |
|---|---|
List<ExtendedElement> |
InvocationElement.getArguments()
Gets the arguments that are passed to the invoked element.
|
List<ExtendedElement> |
InvocationElement.getArgumentTail()
Gets the arguments that are passed to the invoked element, omitting the
first argument.
|
List<ExtendedElement> |
NewArrayElement.getDimensions()
Gets the dimensions passed to the array.
|
| Modifier and Type | Method and Description |
|---|---|
static <T extends com.sun.tools.javac.tree.JCTree> |
ExtendedElementFactory.toTree(ExtendedElement element)
Gets the javac tree from the given element.
|
| Modifier and Type | Method and Description |
|---|---|
ExtendedElement |
AbstractTreeScanner.getParentElement()
Gets the parent element in the printer's scanning stack.
|
| Modifier and Type | Method and Description |
|---|---|
void |
AbstractTreeScanner.scan(ExtendedElement element)
Generically scan an extended element.
|