Class EnumSpecImpl
java.lang.Object
org.tquadrat.foundation.javacomposer.internal.TypeSpecImpl
org.tquadrat.foundation.javacomposer.internal.EnumSpecImpl
- All Implemented Interfaces:
TypeSpec
@ClassVersion(sourceVersion="$Id: EnumSpecImpl.java 1063 2023-09-26 15:14:16Z tquadrat $")
@API(status=INTERNAL,
since="0.2.0")
public final class EnumSpecImpl
extends TypeSpecImpl
The implementation of
TypeSpec
for an enum type.- Author:
- Square,Inc.
- Modified by:
- Thomas Thrien (thomas.thrien@tquadrat.org)
- Version:
- $Id: EnumSpecImpl.java 1063 2023-09-26 15:14:16Z tquadrat $
- Since:
- 0.2.0
- UML Diagram
-
UML Diagram for "org.tquadrat.foundation.javacomposer.internal.EnumSpecImpl"
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classThe implementation ofTypeSpec.Builderforenumtypes.Nested classes/interfaces inherited from class TypeSpecImpl
TypeSpecImpl.KindNested classes/interfaces inherited from interface TypeSpec
TypeSpec.Builder -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<String, ClassSpecImpl> Theenumconstants for this type.Fields inherited from class TypeSpecImpl
NAME_ANONYMOUS_TYPE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateEnumSpecImpl(EnumSpecImpl type) Creates a dummy type spec for type-resolution in CodeWriter only while emitting the type declaration but before entering the type body.EnumSpecImpl(EnumSpecImpl.BuilderImpl builder) Creates a newTypeSpecImplinstance. -
Method Summary
Modifier and TypeMethodDescriptionprotected final TypeSpecImplCreates a dummy copy of the type spec that is used byTypeSpecImpl.emit(CodeWriter, String, Set)internally.protected final voidemit4Foundation(CodeWriter codeWriter, String enumName, Set<Modifier> implicitModifiers) Emits the type to the given code writer, using the layout as defined by the Foundation library code.protected final voidemit4JavaPoet(CodeWriter codeWriter, String enumName, Set<Modifier> implicitModifiers) Emits the type to the given code writer, using the layout as defined by the original JavaPoet code.final booleanprotected final Map<String, ClassSpecImpl> Returns theenumvalues for this type.final inthashCode()final EnumSpecImpl.BuilderImplReturns a new builder that is initialised with thisTypeSpecinstance.Methods inherited from class TypeSpecImpl
anonymousTypeArguments, compareMethodSpecs, emit, getAnnotations, getFactory, getFieldSpecs, getInitializerBlock, getJavadoc, getMethodSpecs, getStaticBlock, getStaticImports, getSuperClass, getSuperInterfaces, getSuppressableWarnings, getTypeVariables, hasModifier, innerClasses, modifiers, name, originatingElements, toString, typeSpecs
-
Field Details
-
m_EnumConstants
Theenumconstants for this type.
-
-
Constructor Details
-
EnumSpecImpl
Creates a newTypeSpecImplinstance.- Parameters:
builder- The builder for this instance.
-
EnumSpecImpl
Creates a dummy type spec for type-resolution in CodeWriter only while emitting the type declaration but before entering the type body.- Parameters:
type- The source type.
-
-
Method Details
-
createCopy
Creates a dummy copy of the type spec that is used byTypeSpecImpl.emit(CodeWriter, String, Set)internally.- Specified by:
createCopyin classTypeSpecImpl- Returns:
- The dummy copy.
-
emit4Foundation
protected final void emit4Foundation(CodeWriter codeWriter, String enumName, Set<Modifier> implicitModifiers) throws UncheckedIOException Emits the type to the given code writer, using the layout as defined by the Foundation library code.- Specified by:
emit4Foundationin classTypeSpecImpl- Parameters:
codeWriter- The target code writer.enumName- The name of the enum; can benull.implicitModifiers- The implicit modifiers.- Throws:
UncheckedIOException- A problem occurred when writing to the output target.
-
emit4JavaPoet
protected final void emit4JavaPoet(CodeWriter codeWriter, String enumName, Set<Modifier> implicitModifiers) throws UncheckedIOException Emits the type to the given code writer, using the layout as defined by the original JavaPoet code.- Specified by:
emit4JavaPoetin classTypeSpecImpl- Parameters:
codeWriter- The target code writer.enumName- The name of the enum; can benull.implicitModifiers- The implicit modifiers.- Throws:
UncheckedIOException- A problem occurred when writing to the output target.
-
equals
-
getEnumConstants
Returns theenumvalues for this type.- Overrides:
getEnumConstantsin classTypeSpecImpl- Returns:
- The
enumvalues.
-
hashCode
- Specified by:
hashCodein interfaceTypeSpec- Specified by:
hashCodein classTypeSpecImpl
-
toBuilder
Returns a new builder that is initialised with thisTypeSpecinstance.- Specified by:
toBuilderin interfaceTypeSpec- Specified by:
toBuilderin classTypeSpecImpl- Returns:
- The new builder.
-
