Uses of Class
com.squareup.javawriter.JavaWriter
-
Uses of JavaWriter in com.squareup.javawriter
Methods in com.squareup.javawriter that return JavaWriterModifier and TypeMethodDescriptionJavaWriter.beginConstructor
(Set<Modifier> modifiers, String... parameters) JavaWriter.beginConstructor
(Set<Modifier> modifiers, List<String> parameters, List<String> throwsTypes) JavaWriter.beginControlFlow
(String controlFlow) JavaWriter.beginControlFlow
(String controlFlow, Object... args) JavaWriter.beginInitializer
(boolean isStatic) Emits an initializer declaration.JavaWriter.beginMethod
(String returnType, String name, Set<Modifier> modifiers, String... parameters) Emit a method declaration.JavaWriter.beginMethod
(String returnType, String name, Set<Modifier> modifiers, List<String> parameters, List<String> throwsTypes) Emit a method declaration.Emits a type declaration.Emits a type declaration.JavaWriter.beginType
(String type, String kind, Set<Modifier> modifiers, String extendsType, String... implementsTypes) Emits a type declaration.JavaWriter.emitAnnotation
(Class<? extends Annotation> annotationType) Equivalent toannotation(annotationType.getName(), emptyMap())
.JavaWriter.emitAnnotation
(Class<? extends Annotation> annotationType, Object value) Annotates the next element withannotationType
and avalue
.JavaWriter.emitAnnotation
(Class<? extends Annotation> annotationType, Map<String, ?> attributes) Equivalent toannotation(annotationType.getName(), attributes)
.JavaWriter.emitAnnotation
(String annotation) Equivalent toannotation(annotation, emptyMap())
.JavaWriter.emitAnnotation
(String annotation, Object value) Annotates the next element withannotation
and avalue
.JavaWriter.emitAnnotation
(String annotation, Map<String, ?> attributes) Annotates the next element withannotation
andattributes
.JavaWriter.emitEmptyLine()
JavaWriter.emitEnumValue
(String name) JavaWriter.emitEnumValue
(String name, boolean isLast) A simple switch to emit the proper enum depending if its last causing it to be terminated by a semi-colon (;
).JavaWriter.emitEnumValues
(Iterable<String> names) Emit a list of enum values followed by a semi-colon (;
).Emits a field declaration.Emits a field declaration.Emits a field declaration.JavaWriter.emitImports
(Class<?>... types) Emit an import for eachtype
provided.JavaWriter.emitImports
(String... types) Emit an import for eachtype
provided.JavaWriter.emitImports
(Collection<String> types) Emit an import for eachtype
in the providedCollection
.JavaWriter.emitJavadoc
(String javadoc, Object... params) Emits some Javadoc comments with line separated by\n
.JavaWriter.emitPackage
(String packageName) Emit a package declaration and empty line.JavaWriter.emitSingleLineComment
(String comment, Object... args) Emits a single line comment.JavaWriter.emitStatement
(String pattern, Object... args) JavaWriter.emitStaticImports
(String... types) Emit a static import for eachtype
provided.JavaWriter.emitStaticImports
(Collection<String> types) Emit a static import for eachtype
in the providedCollection
.JavaWriter.endConstructor()
Completes the current constructor declaration.JavaWriter.endControlFlow()
JavaWriter.endControlFlow
(String controlFlow) JavaWriter.endControlFlow
(String controlFlow, Object... args) JavaWriter.endInitializer()
Ends the current initializer declaration.JavaWriter.endMethod()
Completes the current method declaration.JavaWriter.endType()
Completes the current type declaration.JavaWriter.nextControlFlow
(String controlFlow) JavaWriter.nextControlFlow
(String controlFlow, Object... args)