public class TypesRegistry extends Object
| Constructor and Description |
|---|
TypesRegistry() |
| Modifier and Type | Method and Description |
|---|---|
protected String |
_getSimpleNameForErrorType(GenDeclaredType errorType) |
protected String |
_getSimpleNameForErrorType(TypeMirror errorType) |
protected CharSequence |
_getSimpleOrPartiallyQualifiedName(Element element) |
protected CharSequence |
_getSimpleOrPartiallyQualifiedName(TypeElement typeElement)
For top level classes, that method returns the simple name.
|
protected void |
_registerTypeDependencyForAnnotatedClass(TypeElement annotatedClass,
DeclaredType type) |
protected void |
_registerTypeDependencyForAnnotatedClass(TypeElement annotatedClass,
TypeMirror type) |
protected String |
_tryToGetFqnForErrorType(GenDeclaredType errorType) |
protected String |
_tryToGetFqnForErrorType(TypeMirror errorType) |
Set<String> |
annotatedClassesOnWhichThatOneDependsOn(String annotatedClassFqn)
Based on the dependencies and generated type elements registered so far, this method examines, on which
other annotated classes the given class depends on.
|
TypeElement |
asTypeElement(TypeMirror declType)
Get the TypeElement for the type.
|
void |
cleanUpTypesAtEndOfRound()
Removes all type elements from cache.
|
void |
clearCaches() |
void |
commitGeneratedTypeElement(GenTypeElement genTypeElement)
DEPRECATED ...
|
boolean |
dependOnOtherAnnotatedClasses(Set<String> annotatedClassesFqn)
Determines, whether the given annotated classes depend on any other annotated class not within the set.
|
boolean |
dependOnUnknownTypes(Set<String> annotatedClassesFqn) |
boolean |
dependsOnOtherAnnotatedClasses(String annotatedClassFqn) |
boolean |
dependsOnUnknownTypes(CharSequence annotatedClassFqn)
Does the annotated class have type dependencies where javac has only returned the String "error" instead of an ErrorType
with the short name of the missing type?
|
boolean |
dependsOnUnknownTypes(CharSequence annotatedClassFqn,
CharSequence genClassFqn) |
Iterable<TypeElement> |
findAllTypeElementsWithTriggerAnnotation(String triggerFqn,
boolean shadow) |
Iterable<TypeElement> |
findAllTypeElementsWithTriggerAnnotation(String clienAnnotatedClassFqn,
String triggerFqn,
boolean shadow) |
Iterable<TypeElement> |
findAllTypeElementsWithTriggerAnnotation(TypeElement annotatedClass,
String triggerFqn,
boolean shadow) |
Iterable<Set<String>> |
findCyclesInAnnotatedClasses(Set<String> annotatedClasses)
Returns a list of strongly connected components within the graph of the given annotated classes.
|
AnnotationMirror |
findGenAnnotation(TypeElement typeElement) |
TypeElement |
findGenTypeElementForFqn(String fqn) |
TypeElement |
findGenTypeElementForShortName(String shortname) |
Element |
findNestedElement(Element e,
String[] path) |
TypeElement |
findTypeElement(String typeFqn) |
protected TypeElement |
findTypeInCurrentGeneratedClass(String typeFqnOrShortname) |
Set<String> |
getAnnotatedClassesDependingGenericallyOnThatTriggerAnnotation(String triggerFqn,
boolean shadow) |
Iterable<TypeElement> |
getAnnotatedClassesDependingGenericallyOnThatTriggerAnnotations(Iterable<AnnotationMirror> triggers) |
Set<String> |
getAnnotatedClassesThatDependentOn(TypeElement type) |
TypeElement |
getAnnotatedClassForGenClassOnDisk(TypeElement typeElement) |
String |
getGenAnnotationFqn() |
String |
getSimpleNameForErrorType(TypeMirror errorType) |
CharSequence |
getSimpleOrPartiallyQualifiedName(Element typeElement) |
Set<String> |
getTriggerAnnotationsForMetaTypeElements(Iterable<TypeElement> metaTypeElements) |
Map<String,GenTypeElement> |
getTypeElementInCurrentRoundByFqn() |
Set<org.eclipse.xtext.xbase.lib.Pair<String,String>> |
getTypesByGenClassOnWhichThatAnnotatedClassDependsOn(CharSequence annotatedClassFqn) |
Set<String> |
getTypesOnWhichThatAnnotatedClassDependsOn(CharSequence annotatedClassFqn) |
void |
handleTypeElementNotFound(CharSequence msg,
String typeFqnOrShortname) |
void |
handleTypeElementNotFound(CharSequence msg,
String typeFqnOrShortname,
TypeElement annotatedClass) |
void |
handleTypeElementNotFound(CharSequence msg,
TypeElement annotatedClass,
org.eclipse.xtext.xbase.lib.Procedures.Procedure1<? super Object> closure) |
<T> T |
handleTypeElementNotFound(T defaultValue,
CharSequence msg,
org.eclipse.xtext.xbase.lib.Functions.Function1<? super Object,? extends T> closure) |
<T> T |
handleTypeElementNotFound(T defaultValue,
CharSequence msg,
TypeElement annotatedClass,
org.eclipse.xtext.xbase.lib.Functions.Function1<? super Object,? extends T> closure) |
void |
handleTypeElementNotFound(TypeElementNotFoundException e,
TypeElement annotatedClass) |
boolean |
hasGenericDependencyOnTriggerShadowAnnotation(TypeElement annotatedClass,
Iterable<AnnotationMirror> triggers) |
boolean |
hasUnresolvedTypeDependencies(String annotatedClassFqn,
Set<String> annotatedClassesInSameCycle)
An annotated class is said to have unresolved type dependencies if it depends on types that do not yet exist
or that exist but are re-generated in current round.
|
boolean |
isCommitted(String fqn) |
boolean |
isCommitted(TypeElement typeElement) |
boolean |
isGenerated(TypeElement typeElement) |
boolean |
isThrowTypeElementNotFoundExceptionWhenResolvingSimpleTypeNames() |
void |
load() |
void |
loadAnnotatedClasses() |
void |
loadGenericDependencies() |
<K,V> void |
loadMultiMap(Map<K,Set<V>> map,
String fileName,
org.eclipse.xtext.xbase.lib.Functions.Function1<? super List<String>,? extends org.eclipse.xtext.xbase.lib.Pair<K,V>> lineParser) |
void |
markAsGenerated(GenTypeElement typeElement,
TypeElement original) |
void |
persist() |
void |
persistAnnotatedClasses() |
void |
persistGenericDependencies() |
<K,V> void |
persistMultiMap(Map<K,Set<V>> map,
String fileName,
org.eclipse.xtext.xbase.lib.Functions.Function2<? super K,? super V,? extends List<String>> lineCreator) |
void |
registerAnnotatedClass(TypeElement annotatedClass,
List<org.eclipse.xtext.xbase.lib.Pair<AnnotationMirror,Boolean>> triggers) |
void |
registerGeneratedTypeElement(GenTypeElement genTypeElement) |
void |
registerGeneratedTypeElement(GenTypeElement genTypeElement,
TypeElement annotatedClass,
AnnotationMirror trigger) |
boolean |
registerMetaTypeElement(TypeElement rootMetaTypeElement,
TypeElement triggerAnnotation) |
void |
registerTypeDependencyForAnnotatedClass(TypeElement annotatedClass,
TypeMirror type) |
void |
registerTypeDependencyForCurrentAnnotatedClass(TypeMirror type) |
void |
removeDependenciesForAnnotatedClass(String annotatedClassFqn) |
void |
setThrowTypeElementNotFoundExceptionWhenResolvingSimpleTypeNames(boolean throwTypeElementNotFoundExceptionWhenResolvingSimpleTypeNames) |
boolean |
startUsingUncomittedGenTypes()
For cycle resolution, we need to be able to lookup GenTypes that are "half-done"
|
boolean |
stopUsingUncommitedGenTypes()
Stop using uncommitted generated type elements.
|
String |
tryToGetFqnForErrorType(TypeMirror errorType) |
Iterable<String> |
unresolvableTypesOnWhichThatAnnotatedClassDependsOn(String annotatedClassFqn,
boolean ignoreUnknownTypes)
Based on the dependencies and generated type elements registered so far, this method examines, on which
types the given class depends on that are not to be generated from some other annotated class and thus will never be resolved.
|
public String getGenAnnotationFqn()
public void markAsGenerated(GenTypeElement typeElement, TypeElement original)
public boolean isGenerated(TypeElement typeElement)
public AnnotationMirror findGenAnnotation(TypeElement typeElement)
public TypeElement getAnnotatedClassForGenClassOnDisk(TypeElement typeElement)
public void clearCaches()
public void persist()
public void load()
public void persistAnnotatedClasses()
public void loadAnnotatedClasses()
public void persistGenericDependencies()
public void loadGenericDependencies()
public void registerAnnotatedClass(TypeElement annotatedClass, List<org.eclipse.xtext.xbase.lib.Pair<AnnotationMirror,Boolean>> triggers)
public Map<String,GenTypeElement> getTypeElementInCurrentRoundByFqn()
public Set<String> annotatedClassesOnWhichThatOneDependsOn(String annotatedClassFqn)
public Iterable<Set<String>> findCyclesInAnnotatedClasses(Set<String> annotatedClasses)
public boolean dependsOnOtherAnnotatedClasses(String annotatedClassFqn)
public boolean dependOnOtherAnnotatedClasses(Set<String> annotatedClassesFqn)
public Iterable<String> unresolvableTypesOnWhichThatAnnotatedClassDependsOn(String annotatedClassFqn, boolean ignoreUnknownTypes)
With the flag ignoreUnknowTypes the caller can control how to cope with type references where javac only returns "
public boolean dependsOnUnknownTypes(CharSequence annotatedClassFqn)
public boolean dependsOnUnknownTypes(CharSequence annotatedClassFqn, CharSequence genClassFqn)
public void registerGeneratedTypeElement(GenTypeElement genTypeElement)
public void registerGeneratedTypeElement(GenTypeElement genTypeElement, TypeElement annotatedClass, AnnotationMirror trigger)
protected CharSequence _getSimpleOrPartiallyQualifiedName(TypeElement typeElement)
protected CharSequence _getSimpleOrPartiallyQualifiedName(Element element)
protected String _tryToGetFqnForErrorType(GenDeclaredType errorType)
protected String _tryToGetFqnForErrorType(TypeMirror errorType)
protected String _getSimpleNameForErrorType(GenDeclaredType errorType)
protected String _getSimpleNameForErrorType(TypeMirror errorType)
public void commitGeneratedTypeElement(GenTypeElement genTypeElement)
public void removeDependenciesForAnnotatedClass(String annotatedClassFqn)
public boolean isCommitted(TypeElement typeElement)
public boolean isCommitted(String fqn)
public Set<String> getAnnotatedClassesThatDependentOn(TypeElement type)
protected void _registerTypeDependencyForAnnotatedClass(TypeElement annotatedClass, DeclaredType type)
protected void _registerTypeDependencyForAnnotatedClass(TypeElement annotatedClass, TypeMirror type)
public void registerTypeDependencyForCurrentAnnotatedClass(TypeMirror type)
public boolean hasUnresolvedTypeDependencies(String annotatedClassFqn, Set<String> annotatedClassesInSameCycle)
When resolving cyclic dependencies, all classes of the cycle must be passed as annotatedClassesInSameCycle. Type dependencies within the cycle are ignored.
public Set<String> getTypesOnWhichThatAnnotatedClassDependsOn(CharSequence annotatedClassFqn)
public Set<org.eclipse.xtext.xbase.lib.Pair<String,String>> getTypesByGenClassOnWhichThatAnnotatedClassDependsOn(CharSequence annotatedClassFqn)
public void handleTypeElementNotFound(CharSequence msg, TypeElement annotatedClass, org.eclipse.xtext.xbase.lib.Procedures.Procedure1<? super Object> closure)
public <T> T handleTypeElementNotFound(T defaultValue,
CharSequence msg,
TypeElement annotatedClass,
org.eclipse.xtext.xbase.lib.Functions.Function1<? super Object,? extends T> closure)
public <T> T handleTypeElementNotFound(T defaultValue,
CharSequence msg,
org.eclipse.xtext.xbase.lib.Functions.Function1<? super Object,? extends T> closure)
public void handleTypeElementNotFound(TypeElementNotFoundException e, TypeElement annotatedClass)
public void handleTypeElementNotFound(CharSequence msg, String typeFqnOrShortname)
public void handleTypeElementNotFound(CharSequence msg, String typeFqnOrShortname, TypeElement annotatedClass)
public boolean startUsingUncomittedGenTypes()
public boolean stopUsingUncommitedGenTypes()
public void cleanUpTypesAtEndOfRound()
public TypeElement asTypeElement(TypeMirror declType)
public boolean hasGenericDependencyOnTriggerShadowAnnotation(TypeElement annotatedClass, Iterable<AnnotationMirror> triggers)
public Set<String> getAnnotatedClassesDependingGenericallyOnThatTriggerAnnotation(String triggerFqn, boolean shadow)
public Iterable<TypeElement> getAnnotatedClassesDependingGenericallyOnThatTriggerAnnotations(Iterable<AnnotationMirror> triggers)
public Iterable<TypeElement> findAllTypeElementsWithTriggerAnnotation(String triggerFqn, boolean shadow)
public Iterable<TypeElement> findAllTypeElementsWithTriggerAnnotation(TypeElement annotatedClass, String triggerFqn, boolean shadow)
public Iterable<TypeElement> findAllTypeElementsWithTriggerAnnotation(String clienAnnotatedClassFqn, String triggerFqn, boolean shadow)
public TypeElement findTypeElement(String typeFqn)
public TypeElement findGenTypeElementForShortName(String shortname)
public TypeElement findGenTypeElementForFqn(String fqn)
protected TypeElement findTypeInCurrentGeneratedClass(String typeFqnOrShortname)
public boolean registerMetaTypeElement(TypeElement rootMetaTypeElement, TypeElement triggerAnnotation)
public Set<String> getTriggerAnnotationsForMetaTypeElements(Iterable<TypeElement> metaTypeElements)
public <K,V> void persistMultiMap(Map<K,Set<V>> map, String fileName, org.eclipse.xtext.xbase.lib.Functions.Function2<? super K,? super V,? extends List<String>> lineCreator)
public <K,V> void loadMultiMap(Map<K,Set<V>> map, String fileName, org.eclipse.xtext.xbase.lib.Functions.Function1<? super List<String>,? extends org.eclipse.xtext.xbase.lib.Pair<K,V>> lineParser)
public CharSequence getSimpleOrPartiallyQualifiedName(Element typeElement)
public String tryToGetFqnForErrorType(TypeMirror errorType)
public String getSimpleNameForErrorType(TypeMirror errorType)
public void registerTypeDependencyForAnnotatedClass(TypeElement annotatedClass, TypeMirror type)
@Pure public boolean isThrowTypeElementNotFoundExceptionWhenResolvingSimpleTypeNames()
public void setThrowTypeElementNotFoundExceptionWhenResolvingSimpleTypeNames(boolean throwTypeElementNotFoundExceptionWhenResolvingSimpleTypeNames)
Copyright © 2018. All rights reserved.