@alloy-js/java 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/dist/src/components/Annotation.d.ts +4 -4
- package/dist/src/components/Annotation.d.ts.map +1 -1
- package/dist/src/components/Annotation.js +27 -5
- package/dist/src/components/Annotation.js.map +1 -1
- package/dist/src/components/ArgumentList.d.ts +12 -0
- package/dist/src/components/ArgumentList.d.ts.map +1 -0
- package/dist/src/components/ArgumentList.js +33 -0
- package/dist/src/components/ArgumentList.js.map +1 -0
- package/dist/src/components/Class.d.ts +5 -5
- package/dist/src/components/Class.d.ts.map +1 -1
- package/dist/src/components/Class.js +33 -14
- package/dist/src/components/Class.js.map +1 -1
- package/dist/src/components/Constructor.d.ts +3 -3
- package/dist/src/components/Constructor.d.ts.map +1 -1
- package/dist/src/components/Constructor.js +9 -10
- package/dist/src/components/Constructor.js.map +1 -1
- package/dist/src/components/Declaration.d.ts +1 -1
- package/dist/src/components/Declaration.d.ts.map +1 -1
- package/dist/src/components/Declaration.js +0 -1
- package/dist/src/components/Declaration.js.map +1 -1
- package/dist/src/components/Enum.d.ts +15 -7
- package/dist/src/components/Enum.d.ts.map +1 -1
- package/dist/src/components/Enum.js +38 -16
- package/dist/src/components/Enum.js.map +1 -1
- package/dist/src/components/ExtendsClause.d.ts +9 -0
- package/dist/src/components/ExtendsClause.d.ts.map +1 -0
- package/dist/src/components/ExtendsClause.js +28 -0
- package/dist/src/components/ExtendsClause.js.map +1 -0
- package/dist/src/components/ImplementsClause.d.ts +9 -0
- package/dist/src/components/ImplementsClause.d.ts.map +1 -0
- package/dist/src/components/ImplementsClause.js +28 -0
- package/dist/src/components/ImplementsClause.js.map +1 -0
- package/dist/src/components/ImportStatement.d.ts +1 -1
- package/dist/src/components/ImportStatement.d.ts.map +1 -1
- package/dist/src/components/ImportStatement.js +1 -1
- package/dist/src/components/ImportStatement.js.map +1 -1
- package/dist/src/components/Interface.d.ts +5 -5
- package/dist/src/components/Interface.d.ts.map +1 -1
- package/dist/src/components/Interface.js +23 -16
- package/dist/src/components/Interface.js.map +1 -1
- package/dist/src/components/MavenProject.d.ts +4 -2
- package/dist/src/components/MavenProject.d.ts.map +1 -1
- package/dist/src/components/MavenProject.js +183 -122
- package/dist/src/components/MavenProject.js.map +1 -1
- package/dist/src/components/Method.d.ts +3 -3
- package/dist/src/components/Method.d.ts.map +1 -1
- package/dist/src/components/Method.js +8 -4
- package/dist/src/components/Method.js.map +1 -1
- package/dist/src/{object-modifiers.d.ts → components/Modifiers.d.ts} +6 -3
- package/dist/src/components/Modifiers.d.ts.map +1 -0
- package/dist/src/components/Modifiers.js +27 -0
- package/dist/src/components/Modifiers.js.map +1 -0
- package/dist/src/components/Name.d.ts +1 -1
- package/dist/src/components/Name.d.ts.map +1 -1
- package/dist/src/components/Name.js +1 -1
- package/dist/src/components/Name.js.map +1 -1
- package/dist/src/components/NamedArgumentList.d.ts +11 -0
- package/dist/src/components/NamedArgumentList.d.ts.map +1 -0
- package/dist/src/components/NamedArgumentList.js +30 -0
- package/dist/src/components/NamedArgumentList.js.map +1 -0
- package/dist/src/components/ObjectDeclaration.d.ts +4 -4
- package/dist/src/components/ObjectDeclaration.d.ts.map +1 -1
- package/dist/src/components/ObjectDeclaration.js +8 -4
- package/dist/src/components/ObjectDeclaration.js.map +1 -1
- package/dist/src/components/PackageDirectory.d.ts +1 -1
- package/dist/src/components/PackageDirectory.d.ts.map +1 -1
- package/dist/src/components/PackageDirectory.js.map +1 -1
- package/dist/src/components/Parameters.d.ts +3 -3
- package/dist/src/components/Parameters.d.ts.map +1 -1
- package/dist/src/components/Parameters.js +1 -1
- package/dist/src/components/Parameters.js.map +1 -1
- package/dist/src/components/ProjectDirectory.d.ts +1 -1
- package/dist/src/components/ProjectDirectory.d.ts.map +1 -1
- package/dist/src/components/ProjectDirectory.js +3 -3
- package/dist/src/components/ProjectDirectory.js.map +1 -1
- package/dist/src/components/Reference.d.ts +1 -1
- package/dist/src/components/Reference.d.ts.map +1 -1
- package/dist/src/components/Reference.js +1 -1
- package/dist/src/components/Reference.js.map +1 -1
- package/dist/src/components/SourceFile.d.ts +1 -1
- package/dist/src/components/SourceFile.d.ts.map +1 -1
- package/dist/src/components/SourceFile.js +3 -2
- package/dist/src/components/SourceFile.js.map +1 -1
- package/dist/src/components/TypeArguments.d.ts +24 -0
- package/dist/src/components/TypeArguments.d.ts.map +1 -0
- package/dist/src/components/TypeArguments.js +82 -0
- package/dist/src/components/TypeArguments.js.map +1 -0
- package/dist/src/components/TypeParameters.d.ts +9 -0
- package/dist/src/components/TypeParameters.d.ts.map +1 -0
- package/dist/src/components/TypeParameters.js +40 -0
- package/dist/src/components/TypeParameters.js.map +1 -0
- package/dist/src/components/Variable.d.ts +5 -5
- package/dist/src/components/Variable.d.ts.map +1 -1
- package/dist/src/components/Variable.js +4 -3
- package/dist/src/components/Variable.js.map +1 -1
- package/dist/src/components/index.d.ts +8 -2
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +8 -2
- package/dist/src/components/index.js.map +1 -1
- package/dist/src/components/stc/index.d.ts +37 -17
- package/dist/src/components/stc/index.d.ts.map +1 -1
- package/dist/src/components/stc/index.js +7 -2
- package/dist/src/components/stc/index.js.map +1 -1
- package/dist/src/index.d.ts +0 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +0 -3
- package/dist/src/index.js.map +1 -1
- package/dist/test/maven.test.d.ts +2 -0
- package/dist/test/maven.test.d.ts.map +1 -0
- package/dist/test/type-arguments.test.d.ts +2 -0
- package/dist/test/type-arguments.test.d.ts.map +1 -0
- package/dist/test/utils.d.ts +3 -3
- package/dist/test/utils.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -6
- package/src/components/Annotation.tsx +24 -13
- package/src/components/ArgumentList.tsx +29 -0
- package/src/components/Class.tsx +24 -20
- package/src/components/Constructor.tsx +11 -10
- package/src/components/Declaration.tsx +1 -3
- package/src/components/Enum.tsx +39 -23
- package/src/components/ExtendsClause.tsx +19 -0
- package/src/components/ImplementsClause.tsx +19 -0
- package/src/components/ImportStatement.tsx +5 -2
- package/src/components/Interface.tsx +20 -20
- package/src/components/MavenProject.tsx +256 -121
- package/src/components/Method.tsx +12 -10
- package/src/components/Modifiers.tsx +54 -0
- package/src/components/NamedArgumentList.tsx +31 -0
- package/src/components/ObjectDeclaration.tsx +6 -6
- package/src/components/PackageDirectory.tsx +14 -7
- package/src/components/Parameters.tsx +4 -4
- package/src/components/ProjectDirectory.tsx +7 -5
- package/src/components/SourceFile.tsx +15 -11
- package/src/components/TypeArguments.tsx +88 -0
- package/src/components/TypeParameters.tsx +34 -0
- package/src/components/Variable.tsx +6 -6
- package/src/components/index.ts +8 -2
- package/src/components/stc/index.ts +7 -2
- package/src/index.ts +0 -3
- package/temp/api.json +1482 -953
- package/test/annotation.test.tsx +38 -25
- package/test/class.test.tsx +32 -27
- package/test/constructor.test.tsx +24 -25
- package/test/enum.test.tsx +28 -25
- package/test/externals.test.tsx +13 -5
- package/test/interface.test.tsx +20 -15
- package/test/{maven.tsx → maven.test.tsx} +15 -13
- package/test/method.test.tsx +39 -23
- package/test/package.test.tsx +2 -3
- package/test/reference.test.tsx +14 -12
- package/test/{generics.tsx → type-arguments.test.tsx} +6 -6
- package/test/utils.tsx +10 -6
- package/test/values.test.tsx +1 -3
- package/test/variables.test.tsx +7 -7
- package/dist/src/arguments.d.ts +0 -15
- package/dist/src/arguments.d.ts.map +0 -1
- package/dist/src/arguments.js +0 -27
- package/dist/src/arguments.js.map +0 -1
- package/dist/src/components/Block.d.ts +0 -6
- package/dist/src/components/Block.d.ts.map +0 -1
- package/dist/src/components/Block.js +0 -4
- package/dist/src/components/Block.js.map +0 -1
- package/dist/src/components/Generics.d.ts +0 -6
- package/dist/src/components/Generics.d.ts.map +0 -1
- package/dist/src/components/Generics.js +0 -8
- package/dist/src/components/Generics.js.map +0 -1
- package/dist/src/generics.d.ts +0 -28
- package/dist/src/generics.d.ts.map +0 -1
- package/dist/src/generics.js +0 -51
- package/dist/src/generics.js.map +0 -1
- package/dist/src/object-modifiers.d.ts.map +0 -1
- package/dist/src/object-modifiers.js +0 -31
- package/dist/src/object-modifiers.js.map +0 -1
- package/dist/test/generics.d.ts +0 -2
- package/dist/test/generics.d.ts.map +0 -1
- package/dist/test/maven.d.ts +0 -2
- package/dist/test/maven.d.ts.map +0 -1
- package/src/arguments.ts +0 -30
- package/src/components/Block.tsx +0 -8
- package/src/components/Generics.tsx +0 -12
- package/src/generics.ts +0 -59
- package/src/object-modifiers.ts +0 -48
package/package.json
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alloy-js/java",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
|
-
"development": "./src/index.ts",
|
|
8
7
|
"import": "./dist/src/index.js"
|
|
9
8
|
},
|
|
10
9
|
"./stc": {
|
|
11
|
-
"development": "./src/components/stc/index.ts",
|
|
12
10
|
"import": "./dist/src/components/stc/index.js"
|
|
13
11
|
}
|
|
14
12
|
},
|
|
@@ -18,7 +16,7 @@
|
|
|
18
16
|
"dependencies": {
|
|
19
17
|
"change-case": "^5.4.4",
|
|
20
18
|
"pathe": "^1.1.2",
|
|
21
|
-
"@alloy-js/core": "~0.
|
|
19
|
+
"@alloy-js/core": "~0.6.0"
|
|
22
20
|
},
|
|
23
21
|
"devDependencies": {
|
|
24
22
|
"@babel/cli": "^7.24.7",
|
|
@@ -27,9 +25,9 @@
|
|
|
27
25
|
"@rollup/plugin-babel": "^6.0.4",
|
|
28
26
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
29
27
|
"concurrently": "^8.2.2",
|
|
30
|
-
"typescript": "^5.
|
|
28
|
+
"typescript": "^5.7.3",
|
|
31
29
|
"vitest": "^3.0.4",
|
|
32
|
-
"@alloy-js/babel-preset": "~0.
|
|
30
|
+
"@alloy-js/babel-preset": "~0.2.0"
|
|
33
31
|
},
|
|
34
32
|
"type": "module",
|
|
35
33
|
"scripts": {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { Match, Switch } from "@alloy-js/core";
|
|
2
|
+
import { Children } from "@alloy-js/core/jsx-runtime";
|
|
3
|
+
import { NamedArgumentList } from "./NamedArgumentList.jsx";
|
|
4
4
|
|
|
5
5
|
export interface AnnotationProps {
|
|
6
|
-
type:
|
|
7
|
-
value?: Record<string,
|
|
6
|
+
type: Children;
|
|
7
|
+
value?: Record<string, Children>; // Either single value or named values if many
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -12,12 +12,23 @@ export interface AnnotationProps {
|
|
|
12
12
|
* For instance, use this if you want to annotate a method with '\@Override'.
|
|
13
13
|
*/
|
|
14
14
|
export function Annotation(props: AnnotationProps) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
return (
|
|
16
|
+
<>
|
|
17
|
+
@{props.type}
|
|
18
|
+
<Switch>
|
|
19
|
+
<Match
|
|
20
|
+
when={
|
|
21
|
+
props.value &&
|
|
22
|
+
Object.keys(props.value).length === 1 &&
|
|
23
|
+
"value" in props.value
|
|
24
|
+
}
|
|
25
|
+
>
|
|
26
|
+
({props.value!["value"]})
|
|
27
|
+
</Match>
|
|
28
|
+
<Match when={!!props.value}>
|
|
29
|
+
<NamedArgumentList args={props.value!} />
|
|
30
|
+
</Match>
|
|
31
|
+
</Switch>
|
|
32
|
+
</>
|
|
33
|
+
);
|
|
23
34
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Children, For, Indent } from "@alloy-js/core";
|
|
2
|
+
|
|
3
|
+
export interface ArgumentListProps {
|
|
4
|
+
args?: Children[];
|
|
5
|
+
omitParensWhenEmpty?: boolean;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* A list of arguments to be passed to a function, constructor, enum, and so
|
|
10
|
+
* forth. Includes parenthesis when arguments are passed, otherwise returns an
|
|
11
|
+
* empty string.
|
|
12
|
+
*/
|
|
13
|
+
export function ArgumentList(props: ArgumentListProps) {
|
|
14
|
+
if (props.omitParensWhenEmpty && (!props.args || props.args.length === 0)) {
|
|
15
|
+
return "";
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<group>
|
|
20
|
+
(
|
|
21
|
+
<Indent break="soft" trailingBreak>
|
|
22
|
+
<For each={props.args ?? []} comma line>
|
|
23
|
+
{(value) => value}
|
|
24
|
+
</For>
|
|
25
|
+
</Indent>
|
|
26
|
+
)
|
|
27
|
+
</group>
|
|
28
|
+
);
|
|
29
|
+
}
|
package/src/components/Class.tsx
CHANGED
|
@@ -1,33 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { collectArguments } from "../arguments.js";
|
|
3
|
-
import { collectGenerics, GenericTypes } from "../generics.js";
|
|
1
|
+
import { Block, Children, Scope, Show } from "@alloy-js/core";
|
|
4
2
|
import { useJavaNamePolicy } from "../name-policy.js";
|
|
5
|
-
import { collectModifiers, ObjectModifiers } from "../object-modifiers.js";
|
|
6
3
|
import { Declaration, DeclarationProps } from "./Declaration.js";
|
|
4
|
+
import { ExtendsClause } from "./ExtendsClause.js";
|
|
5
|
+
import { ImplementsClause } from "./ImplementsClause.js";
|
|
6
|
+
import { ModifierProps, Modifiers } from "./Modifiers.jsx";
|
|
7
7
|
import { Name } from "./Name.js";
|
|
8
|
+
import { TypeParameters, TypeParametersProps } from "./TypeParameters.jsx";
|
|
8
9
|
|
|
9
10
|
export interface ClassProps
|
|
10
11
|
extends DeclarationProps,
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
ModifierProps,
|
|
13
|
+
TypeParametersProps {
|
|
13
14
|
extends?: Children;
|
|
14
|
-
implements?: Children;
|
|
15
|
+
implements?: Children[];
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
export function Class(props: ClassProps) {
|
|
18
19
|
const name = useJavaNamePolicy().getName(props.name, "class");
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
<
|
|
29
|
-
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Declaration {...props} name={name}>
|
|
23
|
+
<group>
|
|
24
|
+
<Modifiers {...props} />
|
|
25
|
+
class <Name />
|
|
26
|
+
<Show when={!!props.generics}>
|
|
27
|
+
<TypeParameters generics={props.generics} />
|
|
28
|
+
</Show>
|
|
29
|
+
<ExtendsClause extends={props.extends ? [props.extends] : []} />
|
|
30
|
+
<ImplementsClause interfaces={props.implements} />{" "}
|
|
31
|
+
<Scope name={name} kind="class">
|
|
32
|
+
<Block>{props.children}</Block>
|
|
30
33
|
</Scope>
|
|
31
|
-
|
|
32
|
-
</Declaration
|
|
34
|
+
</group>
|
|
35
|
+
</Declaration>
|
|
36
|
+
);
|
|
33
37
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Block } from "@alloy-js/core";
|
|
2
2
|
import { Children } from "@alloy-js/core/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { ModifierProps, Modifiers } from "./Modifiers.jsx";
|
|
4
4
|
import { Name } from "./Name.js";
|
|
5
5
|
import { Parameters } from "./Parameters.js";
|
|
6
6
|
|
|
7
|
-
export interface ConstructorProps extends
|
|
7
|
+
export interface ConstructorProps extends ModifierProps {
|
|
8
8
|
name?: string;
|
|
9
9
|
parameters?: Record<string, Children>; // Map of parameter name to type
|
|
10
10
|
children?: Children;
|
|
@@ -15,11 +15,12 @@ export interface ConstructorProps extends ObjectModifiers {
|
|
|
15
15
|
* If no name is provided, will try take name from class or enum declaration
|
|
16
16
|
*/
|
|
17
17
|
export function Constructor(props: ConstructorProps) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
return (
|
|
19
|
+
<>
|
|
20
|
+
<Modifiers {...props} />
|
|
21
|
+
{props.name ?? <Name />}(
|
|
22
|
+
<Parameters parameters={props.parameters} />){" "}
|
|
23
|
+
<Block>{props.children}</Block>
|
|
24
|
+
</>
|
|
25
|
+
);
|
|
25
26
|
}
|
|
@@ -18,7 +18,5 @@ export interface DeclarationProps {
|
|
|
18
18
|
*/
|
|
19
19
|
export function Declaration(props: DeclarationProps) {
|
|
20
20
|
const sym = createJavaSymbol(props);
|
|
21
|
-
return <CoreDeclaration symbol={sym}>
|
|
22
|
-
{props.children}
|
|
23
|
-
</CoreDeclaration>;
|
|
21
|
+
return <CoreDeclaration symbol={sym}>{props.children}</CoreDeclaration>;
|
|
24
22
|
}
|
package/src/components/Enum.tsx
CHANGED
|
@@ -1,40 +1,56 @@
|
|
|
1
|
-
import { Children,
|
|
2
|
-
import { collectArguments } from "../arguments.js";
|
|
1
|
+
import { Block, Children, List, Scope } from "@alloy-js/core";
|
|
3
2
|
import { useJavaNamePolicy } from "../name-policy.js";
|
|
4
|
-
import {
|
|
3
|
+
import { ArgumentList } from "./ArgumentList.jsx";
|
|
5
4
|
import { Declaration, DeclarationProps } from "./Declaration.js";
|
|
5
|
+
import { ImplementsClause } from "./ImplementsClause.jsx";
|
|
6
|
+
import { ModifierProps, Modifiers } from "./Modifiers.jsx";
|
|
6
7
|
import { Name } from "./Name.js";
|
|
7
8
|
|
|
8
|
-
export interface EnumProps extends DeclarationProps,
|
|
9
|
-
implements?: Children;
|
|
9
|
+
export interface EnumProps extends DeclarationProps, ModifierProps {
|
|
10
|
+
implements?: Children[];
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
export function Enum(props: EnumProps) {
|
|
13
14
|
const name = useJavaNamePolicy().getName(props.name, "enum");
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
{
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<Declaration {...props} name={name}>
|
|
18
|
+
<group>
|
|
19
|
+
<Modifiers {...props} />
|
|
20
|
+
enum <Name />
|
|
21
|
+
<ImplementsClause interfaces={props.implements} />
|
|
22
|
+
</group>{" "}
|
|
23
|
+
<Scope kind="enum">
|
|
24
|
+
<Block>{props.children}</Block>
|
|
25
|
+
</Scope>
|
|
26
|
+
</Declaration>
|
|
27
|
+
);
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
export interface EnumMemberProps extends
|
|
30
|
+
export interface EnumMemberProps extends ModifierProps {
|
|
30
31
|
name: string;
|
|
31
|
-
|
|
32
|
+
args?: Children[];
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
export function EnumMember(props: EnumMemberProps) {
|
|
35
|
-
const collectedArgs = collectArguments(props.arguments);
|
|
36
|
-
const args = props.arguments ? code`(${collectedArgs})` : "";
|
|
37
36
|
const name = useJavaNamePolicy().getName(props.name, "enum-member");
|
|
38
37
|
|
|
39
|
-
return
|
|
38
|
+
return (
|
|
39
|
+
<>
|
|
40
|
+
{name}
|
|
41
|
+
<ArgumentList args={props.args} omitParensWhenEmpty />
|
|
42
|
+
</>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface EnumMemberListProps {
|
|
47
|
+
children: Children;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Create a list of enum members, joining with a comma and a hardline, and
|
|
52
|
+
* ending with a semicolon.
|
|
53
|
+
*/
|
|
54
|
+
export function EnumMemberList(props: EnumMemberListProps) {
|
|
55
|
+
return <List children={props.children} comma hardline ender=";" />;
|
|
40
56
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Children, List, Show } from "@alloy-js/core";
|
|
2
|
+
|
|
3
|
+
export interface ExtendsClauseProps {
|
|
4
|
+
extends: Children[] | undefined;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The extends clause for a class or interface.
|
|
9
|
+
*/
|
|
10
|
+
export function ExtendsClause(props: ExtendsClauseProps) {
|
|
11
|
+
return (
|
|
12
|
+
<Show when={props.extends !== undefined && props.extends.length > 0}>
|
|
13
|
+
<indent>
|
|
14
|
+
<br />
|
|
15
|
+
extends <List children={props.extends} comma space />
|
|
16
|
+
</indent>
|
|
17
|
+
</Show>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Children, List, Show } from "@alloy-js/core";
|
|
2
|
+
|
|
3
|
+
export interface ImplementsClauseProps {
|
|
4
|
+
interfaces: Children[] | undefined;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The implements clause for a class, interface, or enum.
|
|
9
|
+
*/
|
|
10
|
+
export function ImplementsClause(props: ImplementsClauseProps) {
|
|
11
|
+
return (
|
|
12
|
+
<Show when={props.interfaces !== undefined && props.interfaces.length > 0}>
|
|
13
|
+
<indent>
|
|
14
|
+
<br />
|
|
15
|
+
implements <List children={props.interfaces} comma space />
|
|
16
|
+
</indent>
|
|
17
|
+
</Show>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -12,8 +12,11 @@ export interface ImportStatementsProps {
|
|
|
12
12
|
|
|
13
13
|
export function ImportStatements(props: ImportStatementsProps) {
|
|
14
14
|
return memo(() =>
|
|
15
|
-
mapJoin(
|
|
16
|
-
() =>
|
|
15
|
+
mapJoin(
|
|
16
|
+
() => props.imports,
|
|
17
|
+
(importProp) => () => <ImportStatement {...importProp} />,
|
|
18
|
+
),
|
|
19
|
+
);
|
|
17
20
|
}
|
|
18
21
|
|
|
19
22
|
export function ImportStatement(props: ImportSymbol) {
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { collectArguments } from "../arguments.js";
|
|
3
|
-
import { collectGenerics, GenericTypes } from "../generics.js";
|
|
1
|
+
import { Block, Children, Scope } from "@alloy-js/core";
|
|
4
2
|
import { useJavaNamePolicy } from "../name-policy.js";
|
|
5
|
-
import { collectModifiers, ObjectModifiers } from "../object-modifiers.js";
|
|
6
3
|
import { Declaration, DeclarationProps } from "./Declaration.js";
|
|
4
|
+
import { ExtendsClause } from "./ExtendsClause.jsx";
|
|
5
|
+
import { ModifierProps, Modifiers } from "./Modifiers.jsx";
|
|
7
6
|
import { Name } from "./Name.js";
|
|
7
|
+
import { TypeParameters, TypeParametersProps } from "./TypeParameters.jsx";
|
|
8
8
|
|
|
9
9
|
export interface InterfaceProps
|
|
10
10
|
extends DeclarationProps,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
extends?: Children;
|
|
11
|
+
ModifierProps,
|
|
12
|
+
TypeParametersProps {
|
|
13
|
+
extends?: Children[];
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export function Interface(props: InterfaceProps) {
|
|
17
17
|
const name = useJavaNamePolicy().getName(props.name, "interface");
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
18
|
+
return (
|
|
19
|
+
<Declaration {...props} name={name}>
|
|
20
|
+
<group>
|
|
21
|
+
<Modifiers {...props} />
|
|
22
|
+
interface <Name />
|
|
23
|
+
<TypeParameters generics={props.generics} />
|
|
24
|
+
<ExtendsClause extends={props.extends} />{" "}
|
|
25
|
+
</group>
|
|
26
|
+
<Scope name={name} kind="interface">
|
|
27
|
+
<Block>{props.children}</Block>
|
|
28
|
+
</Scope>
|
|
29
|
+
</Declaration>
|
|
30
|
+
);
|
|
31
31
|
}
|