# Uses of Class
com.squareup.javawriter.JavaWriter

## Uses of JavaWriter in com.squareup.javawriter

Methods in com.squareup.javawriter that return JavaWriter
Modifier and Type
Method
Description
`JavaWriter`
JavaWriter.`beginConstructor(Set<Modifier> modifiers, String... parameters)`
`JavaWriter`
JavaWriter.`beginConstructor(Set<Modifier> modifiers, List<String> parameters, List<String> throwsTypes)`
`JavaWriter`
JavaWriter.`beginControlFlow(String controlFlow)`
`JavaWriter`
JavaWriter.`beginControlFlow(String controlFlow, Object... args)`
`JavaWriter`
JavaWriter.`beginInitializer(boolean isStatic)`
Emits an initializer declaration.
`JavaWriter`
JavaWriter.`beginMethod(String returnType, String name, Set<Modifier> modifiers, String... parameters)`
Emit a method declaration.
`JavaWriter`
JavaWriter.`beginMethod(String returnType, String name, Set<Modifier> modifiers, List<String> parameters, List<String> throwsTypes)`
Emit a method declaration.
`JavaWriter`
JavaWriter.`beginType(String type, String kind)`
Emits a type declaration.
`JavaWriter`
JavaWriter.`beginType(String type, String kind, Set<Modifier> modifiers)`
Emits a type declaration.
`JavaWriter`
JavaWriter.`beginType(String type, String kind, Set<Modifier> modifiers, String extendsType, String... implementsTypes)`
Emits a type declaration.
`JavaWriter`
JavaWriter.`emitAnnotation(Class<? extends Annotation> annotationType)`
Equivalent to `annotation(annotationType.getName(), emptyMap())`.
`JavaWriter`
JavaWriter.`emitAnnotation(Class<? extends Annotation> annotationType, Object value)`
Annotates the next element with `annotationType` and a `value`.
`JavaWriter`
JavaWriter.`emitAnnotation(Class<? extends Annotation> annotationType, Map<String,?> attributes)`
Equivalent to `annotation(annotationType.getName(), attributes)`.
`JavaWriter`
JavaWriter.`emitAnnotation(String annotation)`
Equivalent to `annotation(annotation, emptyMap())`.
`JavaWriter`
JavaWriter.`emitAnnotation(String annotation, Object value)`
Annotates the next element with `annotation` and a `value`.
`JavaWriter`
JavaWriter.`emitAnnotation(String annotation, Map<String,?> attributes)`
Annotates the next element with `annotation` and `attributes`.
`JavaWriter`
JavaWriter.`emitEmptyLine()`
`JavaWriter`
JavaWriter.`emitEnumValue(String name)`
`JavaWriter`
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`
JavaWriter.`emitEnumValues(Iterable<String> names)`
Emit a list of enum values followed by a semi-colon (`;`).
`JavaWriter`
JavaWriter.`emitField(String type, String name)`
Emits a field declaration.
`JavaWriter`
JavaWriter.`emitField(String type, String name, Set<Modifier> modifiers)`
Emits a field declaration.
`JavaWriter`
JavaWriter.`emitField(String type, String name, Set<Modifier> modifiers, String initialValue)`
Emits a field declaration.
`JavaWriter`
JavaWriter.`emitImports(Class<?>... types)`
Emit an import for each `type` provided.
`JavaWriter`
JavaWriter.`emitImports(String... types)`
Emit an import for each `type` provided.
`JavaWriter`
JavaWriter.`emitImports(Collection<String> types)`
Emit an import for each `type` in the provided `Collection`.
`JavaWriter`
JavaWriter.`emitJavadoc(String javadoc, Object... params)`
Emits some Javadoc comments with line separated by `\n`.
`JavaWriter`
JavaWriter.`emitPackage(String packageName)`
Emit a package declaration and empty line.
`JavaWriter`
JavaWriter.`emitSingleLineComment(String comment, Object... args)`
Emits a single line comment.
`JavaWriter`
JavaWriter.`emitStatement(String pattern, Object... args)`
`JavaWriter`
JavaWriter.`emitStaticImports(String... types)`
Emit a static import for each `type` provided.
`JavaWriter`
JavaWriter.`emitStaticImports(Collection<String> types)`
Emit a static import for each `type` in the provided `Collection`.
`JavaWriter`
JavaWriter.`endConstructor()`
Completes the current constructor declaration.
`JavaWriter`
JavaWriter.`endControlFlow()`
`JavaWriter`
JavaWriter.`endControlFlow(String controlFlow)`
`JavaWriter`
JavaWriter.`endControlFlow(String controlFlow, Object... args)`
`JavaWriter`
JavaWriter.`endInitializer()`
Ends the current initializer declaration.
`JavaWriter`
JavaWriter.`endMethod()`
Completes the current method declaration.
`JavaWriter`
JavaWriter.`endType()`
Completes the current type declaration.
`JavaWriter`
JavaWriter.`nextControlFlow(String controlFlow)`
`JavaWriter`
JavaWriter.`nextControlFlow(String controlFlow, Object... args)`