org.eclipse.xtext.common.types.util.AnnotationLookup Java Examples
The following examples show how to use
org.eclipse.xtext.common.types.util.AnnotationLookup.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SARLUIStrings.java From sarl with Apache License 2.0 | 5 votes |
/** Format the parameters. * * @param elements the list of the formal parameters. * @param isVarArgs indicates if the function has var args. * @param includeName indicates if the names are included in the replied valued. * @param keywords the keyword provider. * @param annotationFinder the finder of attached annotations. * @param utils the utility. * @return the string representation of the parameters. */ public static String getParameterString(Iterable<? extends JvmFormalParameter> elements, boolean isVarArgs, boolean includeName, SARLGrammarKeywordAccess keywords, AnnotationLookup annotationFinder, UIStrings utils) { final StringBuilder result = new StringBuilder(); boolean needsSeparator = false; final Iterator<? extends JvmFormalParameter> iterator = elements.iterator(); while (iterator.hasNext()) { final JvmFormalParameter parameter = iterator.next(); if (needsSeparator) { result.append(keywords.getCommaKeyword()).append(" "); //$NON-NLS-1$ } needsSeparator = true; final boolean isDefaultValued = annotationFinder.findAnnotation(parameter, DefaultValue.class) != null; if (isDefaultValued) { result.append(keywords.getLeftSquareBracketKeyword()); } if (includeName) { result.append(parameter.getName()).append(" "); //$NON-NLS-1$ result.append(keywords.getColonKeyword()).append(" "); //$NON-NLS-1$ } JvmTypeReference typeRef = parameter.getParameterType(); if (isVarArgs && !iterator.hasNext() && typeRef instanceof JvmGenericArrayTypeReference) { typeRef = ((JvmGenericArrayTypeReference) typeRef).getComponentType(); result.append(utils.referenceToString(typeRef, NULL_TYPE)); result.append(keywords.getWildcardAsteriskKeyword()); } else { result.append(utils.referenceToString(typeRef, NULL_TYPE)); } if (isDefaultValued) { result.append(keywords.getRightSquareBracketKeyword()); } } return result.toString(); }
Example #2
Source File: SARLUIStrings.java From sarl with Apache License 2.0 | 5 votes |
/** Format the parameters. * * @param elements the list of the formal parameters. * @param isVarArgs indicates if the function has var args. * @param includeName indicates if the names are included in the replied valued. * @param keywords the keyword provider. * @param annotationFinder the finder of attached annotations. * @param utils the utility. * @return the string representation of the parameters. * @since 0.6 */ public static StyledString getParameterStyledString(Iterable<? extends JvmFormalParameter> elements, boolean isVarArgs, boolean includeName, SARLGrammarKeywordAccess keywords, AnnotationLookup annotationFinder, UIStrings utils) { final StyledString result = new StyledString(); boolean needsSeparator = false; final Iterator<? extends JvmFormalParameter> iterator = elements.iterator(); while (iterator.hasNext()) { final JvmFormalParameter parameter = iterator.next(); if (needsSeparator) { result.append(keywords.getCommaKeyword()).append(" "); //$NON-NLS-1$ } needsSeparator = true; final boolean isDefaultValued = annotationFinder.findAnnotation(parameter, DefaultValue.class) != null; final Styler styler; if (isDefaultValued) { styler = OPTIONAL_ELEMENT_STYLER; result.append(keywords.getLeftSquareBracketKeyword(), styler); } else { styler = null; } if (includeName) { result.append(parameter.getName(), styler).append(" ", styler); //$NON-NLS-1$ result.append(keywords.getColonKeyword(), styler).append(" ", styler); //$NON-NLS-1$ } JvmTypeReference typeRef = parameter.getParameterType(); if (isVarArgs && !iterator.hasNext() && typeRef instanceof JvmGenericArrayTypeReference) { typeRef = ((JvmGenericArrayTypeReference) typeRef).getComponentType(); result.append(utils.referenceToString(typeRef, NULL_TYPE), styler); result.append(keywords.getWildcardAsteriskKeyword(), styler); } else { result.append(utils.referenceToString(typeRef, NULL_TYPE), styler); } if (isDefaultValued) { result.append(keywords.getRightSquareBracketKeyword(), styler); } } return result; }
Example #3
Source File: JvmFormalParameterProvider.java From sarl with Apache License 2.0 | 5 votes |
/** Constructor. * @param parameters the list of the formal parameters. * @param annotationFinder the finder of annotations. * @param prototypeProvider the provider of prototype which generates this parameter provider. */ JvmFormalParameterProvider(List<JvmFormalParameter> parameters, AnnotationLookup annotationFinder, IActionPrototypeProvider prototypeProvider) { this.parameters = parameters; this.annotationFinder = annotationFinder; this.prototypeProvider = new WeakReference<>(prototypeProvider); }
Example #4
Source File: LogicalContainerAwareReentrantTypeResolver.java From xtext-extras with Eclipse Public License 2.0 | 4 votes |
protected AnnotationLookup getAnnotationLookup() { return annotationLookup; }