Class JavaGenericTypeFromSource
java.lang.Object
io.github.mmm.code.base.item.BaseItem
io.github.mmm.code.base.item.BaseMutableItem
io.github.mmm.code.base.node.BaseNodeItem
io.github.mmm.code.base.element.BaseElement
io.github.mmm.code.base.element.BaseElementWithDeclaringType
io.github.mmm.code.base.type.BaseGenericType
io.github.mmm.code.base.type.BaseGenericTypeProxy
io.github.mmm.code.impl.java.parser.JavaGenericTypeFromSource
- All Implemented Interfaces:
io.github.mmm.code.api.CodeWithContext,io.github.mmm.code.api.element.CodeElement,io.github.mmm.code.api.element.CodeElementWithDeclaringType,io.github.mmm.code.api.item.CodeItem,io.github.mmm.code.api.item.CodeItemWithComment,io.github.mmm.code.api.item.CodeItemWithDeclaration,io.github.mmm.code.api.item.CodeItemWithDeclaringType,io.github.mmm.code.api.item.CodeItemWithQualifiedFlag,io.github.mmm.code.api.item.CodeItemWithQualifiedName,io.github.mmm.code.api.item.CodeMutableItem,io.github.mmm.code.api.item.CodeMutableItemWithComment,io.github.mmm.code.api.node.CodeNode,io.github.mmm.code.api.node.CodeNodeItem,io.github.mmm.code.api.object.CodeMutable,io.github.mmm.code.api.type.CodeGenericType
BaseGenericTypeProxy used to create types from source code with lazy evaluation. In Java types can be
referenced before they are actually declared (e.g. a nested class can be used in its parent class before it is
defined in the source code). Therefore instances of this class can be created whilst parsing the source code and will
be resolved via lazy initialization after the parsing has completed.- Since:
- 1.0.0
- Author:
- Joerg Hohwiller (hohwille at users.sourceforge.net)
-
Field Summary
Fields inherited from interface io.github.mmm.code.api.item.CodeItem
DEFAULT_INDENT, DEFAULT_NEWLINE -
Constructor Summary
ConstructorsConstructorDescriptionJavaGenericTypeFromSource(io.github.mmm.code.api.element.CodeElementWithTypeVariables parent, String name, BaseFile file) The constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddComposedType(BaseGenericType composedType) voidaddTypeParameter(BaseGenericType typeParameter) copy()copy(io.github.mmm.code.api.copy.CodeCopyMapper mapper) voidEnsures thattype parametersare initialized.intgetName()voidIncrements thearray count.booleanvoidsetArrayCount(int arrayCount) voidsetArrayLengthExpression(String arrayLengthExpression) voidsetExtendsBound(BaseGenericType extendsBound) voidsetSuperBound(BaseGenericType superBound) Methods inherited from class io.github.mmm.code.base.type.BaseGenericTypeProxy
asType, doWrite, doWrite, getAnnotations, getAnnotations, getComment, getComment, getDeclaringType, getDoc, getParent, getQualifiedName, getReflectiveObject, getSimpleName, getTypeParameters, isQualified, resolve, writeReferenceMethods inherited from class io.github.mmm.code.base.type.BaseGenericType
asComposedType, asTypePlaceholder, asTypeVariable, asTypeWildcard, asUnqualifiedType, createArray, getComponentType, getSourceCodeObject, isArray, isAssignableFromMethods inherited from class io.github.mmm.code.base.element.BaseElement
doInitialize, doMerge, doSetImmutable, doWriteAnnotations, doWriteComment, doWriteDoc, removeFromParent, setCommentMethods inherited from class io.github.mmm.code.base.node.BaseNodeItem
getContainerItem, getContainerItemDeclared, getContext, getLanguage, getSource, toPathStringMethods inherited from class io.github.mmm.code.base.item.BaseMutableItem
doCopyNode, doCopyNodeUnsafe, doMapList, doneInitialize, getDefaultCopyMapper, getDefaultEncoding, initialize, initialize, isImmutable, isInitialized, isInitializing, isSystemImmutable, isSystemImmutable, makeImmutable, makeImmutable, setImmutable, setImmutableIfNotSystemImmutable, verifyMutalbe, writeItemMethods inherited from class io.github.mmm.code.base.item.BaseItem
getOwningType, getSourceCode, getSpaces, toString, writeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.github.mmm.code.api.element.CodeElement
removeFromParentMethods inherited from interface io.github.mmm.code.api.type.CodeGenericType
getCategory, isAnnotation, isAssignableTo, isClass, isEnumeration, isInterfaceMethods inherited from interface io.github.mmm.code.api.item.CodeItem
getLanguage, getSourceCode, write, write, write, write, writeMethods inherited from interface io.github.mmm.code.api.item.CodeItemWithDeclaration
writeReferenceMethods inherited from interface io.github.mmm.code.api.object.CodeMutable
isImmutable, isMutableMethods inherited from interface io.github.mmm.code.api.item.CodeMutableItem
setImmutableMethods inherited from interface io.github.mmm.code.api.item.CodeMutableItemWithComment
setCommentMethods inherited from interface io.github.mmm.code.api.CodeWithContext
getContext, getSource
-
Constructor Details
-
Method Details
-
getDelegate
- Specified by:
getDelegatein classBaseGenericTypeProxy
-
getName
- Returns:
- the raw name from source code.
-
isDiamonOperator
public boolean isDiamonOperator()- Returns:
trueif diamond operator (<>) was present in source-code for this type reference,falseotherwise. E.g. needed for constructor references.
-
ensureTypeParameters
public void ensureTypeParameters()Ensures thattype parametersare initialized.- See Also:
-
addTypeParameter
- Parameters:
typeParameter- the type parameter to add.
-
addComposedType
- Parameters:
composedType- the composed type to add.
-
getExtendsBound
- Returns:
- the upper bound of a wildcard or
null.
-
setExtendsBound
- Parameters:
extendsBound- the new value ofgetExtendsBound().
-
getSuperBound
- Returns:
- the lower bound of a wildcard or
null.
-
setSuperBound
- Parameters:
superBound- the new value ofgetSuperBound().
-
getArrayCount
public int getArrayCount()- Returns:
- the number of
arraydimensions. Will be zero (0) for no array.
-
setArrayCount
public void setArrayCount(int arrayCount) - Parameters:
arrayCount- the new value ofgetArrayCount().
-
incArrayCount
public void incArrayCount()Increments thearray count. -
getArrayLengthExpression
- Returns:
- the length of the array (in case of an array initializer such as 1024 in
new byte[1024]but may also be a variable, field reference, calculation expression, etc.) ornullif not an array initializer.
-
setArrayLengthExpression
- Parameters:
arrayLengthExpression- the new value ofgetArrayLengthExpression().
-
copy
- Specified by:
copyin interfaceio.github.mmm.code.api.element.CodeElement- Specified by:
copyin interfaceio.github.mmm.code.api.element.CodeElementWithDeclaringType- Specified by:
copyin interfaceio.github.mmm.code.api.type.CodeGenericType- Specified by:
copyin interfaceio.github.mmm.code.api.item.CodeMutableItem- Specified by:
copyin interfaceio.github.mmm.code.api.node.CodeNodeItem- Specified by:
copyin classBaseGenericType
-
copy
- Specified by:
copyin interfaceio.github.mmm.code.api.type.CodeGenericType- Specified by:
copyin interfaceio.github.mmm.code.api.item.CodeMutableItem- Specified by:
copyin interfaceio.github.mmm.code.api.node.CodeNodeItem- Specified by:
copyin classBaseGenericType
-