java

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 18, 2022 License: Apache-2.0 Imports: 27 Imported by: 10

Documentation

Overview

Copyright 2022, Pulumi Corporation. All rights reserved.

Default value and config value code-generation facilities for SDK generation are kept in this separate file as they are a bit intricate.

Index

Constants

View Source
const (
	// MissingKeyErrorOption is the renderer option to stop execution immediately with an error on missing key
	MissingKeyErrorOption = "missingkey=error"
)

Variables

View Source
var Importer schema.Language = importer(0)

Importer implements schema.Language for Java

Functions

func GeneratePackage

func GeneratePackage(tool string, pkg *schema.Package, extraFiles map[string][]byte) (map[string][]byte, error)

func GenerateProgram

func GenerateProgram(program *pcl.Program) (map[string][]byte, hcl.Diagnostics, error)

func GenerateProject

func GenerateProject(directory string, project workspace.Project, program *pcl.Program) error

func LanguageResources

func LanguageResources(tool string, pkg *schema.Package) (map[string]LanguageResource, error)

LanguageResources returns a map of resources that can be used by downstream codegen. The map key is the resource schema token.

func Template

func Template(name string, text string) *tmplt.Template

Types

type DocLanguageHelper

type DocLanguageHelper struct{}

DocLanguageHelper is the Java-specific implementation of the similarly named codegen interface.

func (DocLanguageHelper) GetDocLinkForFunctionInputOrOutputType

func (d DocLanguageHelper) GetDocLinkForFunctionInputOrOutputType(
	pkg *schema.Package, modName, typeName string, input bool) string

func (DocLanguageHelper) GetDocLinkForPulumiType

func (d DocLanguageHelper) GetDocLinkForPulumiType(pkg *schema.Package, typeName string) string

TODO revisit once javadocs are published.

Not every language currently supports this. For Python docsgen the implementation returns "" also.

For an example of a language that supports this, check out Go.

When visiting https://www.pulumi.com/registry/packages/aws/api-docs/s3/bucket/ see:

func NewBucket(ctx *Context, name string, args *BucketArgs, opts ...ResourceOption)

Context, BucketARgs and ResourceOption get linked to Go API docs.

For Java we could link to JavaDoc when appropriate.

func (DocLanguageHelper) GetDocLinkForResourceInputOrOutputType

func (d DocLanguageHelper) GetDocLinkForResourceInputOrOutputType(
	pkg *schema.Package, modName, typeName string, input bool) string

func (DocLanguageHelper) GetDocLinkForResourceType

func (d DocLanguageHelper) GetDocLinkForResourceType(pkg *schema.Package, modName, typeName string) string

func (DocLanguageHelper) GetEnumName

func (d DocLanguageHelper) GetEnumName(e *schema.Enum, typeName string) (string, error)

func (DocLanguageHelper) GetFunctionName

func (d DocLanguageHelper) GetFunctionName(modName string, f *schema.Function) string

func (DocLanguageHelper) GetLanguageTypeString

func (d DocLanguageHelper) GetLanguageTypeString(
	pkg *schema.Package, moduleName string, t schema.Type, input bool) string

func (DocLanguageHelper) GetMethodName

func (d DocLanguageHelper) GetMethodName(m *schema.Method) string

func (DocLanguageHelper) GetMethodResultName

func (d DocLanguageHelper) GetMethodResultName(
	pkg *schema.Package, modName string, r *schema.Resource, m *schema.Method) string
func (d DocLanguageHelper) GetModuleDocLink(pkg *schema.Package, modName string) (string, string)

func (DocLanguageHelper) GetPropertyName

func (d DocLanguageHelper) GetPropertyName(p *schema.Property) (string, error)

func (DocLanguageHelper) GetResourceFunctionResultName

func (d DocLanguageHelper) GetResourceFunctionResultName(modName string, f *schema.Function) string

type LanguageResource

type LanguageResource struct {
	*schema.Resource

	Name    string // The resource name (e.g. Deployment)
	Package string // The package name (e.g. apps.v1)
}

LanguageResource is derived from the schema and can be used by downstream codegen.

type MethodCall

type MethodCall struct {
	This   string
	Method string
	Args   []string
}

func (MethodCall) String

func (m MethodCall) String() string

type PackageInfo

type PackageInfo struct {
	PackageReferences      map[string]string `json:"packageReferences,omitempty"`
	Packages               map[string]string `json:"packages,omitempty"`
	DictionaryConstructors bool              `json:"dictionaryConstructors,omitempty"`
	BasePackage            string            `json:"basePackage"`

	// If set to "gradle" generates a basic set of Gradle build files.
	BuildFiles string `json:"buildFiles"`
}

PackageInfo represents a Java language-specific info for a package.

func (PackageInfo) BasePackageOrDefault

func (i PackageInfo) BasePackageOrDefault() string

type PropertyInfo

type PropertyInfo struct {
	Name string `json:"name,omitempty"`
}

PropertyInfo represents a Java language-specific info for a property.

type TypeShape

type TypeShape struct {
	Type        names.FQN
	Parameters  []TypeShape
	Annotations []string
}

func (TypeShape) Equal

func (ts TypeShape) Equal(other TypeShape) bool

func (TypeShape) ListType

func (ts TypeShape) ListType(ctx *classFileContext) string

func (TypeShape) Optional

func (ts TypeShape) Optional() TypeShape

func (TypeShape) ParameterTypes

func (ts TypeShape) ParameterTypes(imports *names.Imports) []string

func (TypeShape) ParameterTypesTransformed

func (ts TypeShape) ParameterTypesTransformed(f func(TypeShape) string) []string

func (TypeShape) StringJavaTypeShape

func (ts TypeShape) StringJavaTypeShape(imports *names.Imports) string

StringJavaTypeShape returns a Java code representation if this TypeShape

Basically rewrites itself to Java.

func (TypeShape) ToCode

func (ts TypeShape) ToCode(imports *names.Imports) string

ToCode converts to Java code, may add imports to use short names.

func (TypeShape) ToCodeClassLiteral

func (ts TypeShape) ToCodeClassLiteral(imports *names.Imports) string

ToCodeClassLiteral converts to Java class literal, may add imports to use short names.

func (TypeShape) ToCodeCommentedAnnotations

func (ts TypeShape) ToCodeCommentedAnnotations(imports *names.Imports) string

func (TypeShape) ToCodeErased

func (ts TypeShape) ToCodeErased(imports *names.Imports) string

ToCodeErased converts to Java code with erased generics, may add imports to use short names.

func (TypeShape) ToCodeWithOptions

func (ts TypeShape) ToCodeWithOptions(imports *names.Imports, opts TypeShapeStringOptions) string

func (TypeShape) UnEither

func (ts TypeShape) UnEither() (bool, TypeShape, TypeShape)

func (TypeShape) UnList

func (ts TypeShape) UnList() (bool, TypeShape)

func (TypeShape) UnNullable

func (ts TypeShape) UnNullable() (bool, TypeShape)

func (TypeShape) UnOptional

func (ts TypeShape) UnOptional() (bool, TypeShape)

func (TypeShape) UnOutput

func (ts TypeShape) UnOutput() (bool, TypeShape)

func (TypeShape) WithoutAnnotations

func (ts TypeShape) WithoutAnnotations() TypeShape

type TypeShapeStringOptions

type TypeShapeStringOptions struct {
	// useful for type parameters because (most) annotations are not allowed on a generic parameter type
	CommentOutAnnotations bool
	// useful for annotation parameters and other contexts where comments or annotations are not allowed
	SkipAnnotations bool
	// useful for .class or [].class to skip the generic part of the type
	GenericErasure bool
	// useful to append .class
	AppendClassLiteral bool
	// useful to append [].class
	AppendClassArrayLiteral bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL