/** * @since 2.8 */ public String getJavaSourceVersion() { return generatorConfig.getJavaSourceVersion().getQualifier(); }
@Override public GeneratorConfig get(EObject context) { GeneratorConfig config = new GeneratorConfig(); config.setJavaSourceVersion(targetVersion); return config; }
/** * @since 2.8 */ public String getGeneratedAnnotationComment() { return generatorConfig.getGeneratedAnnotationComment(); }
GeneratorConfig generatorConfig = generatorConfigProvider.get(jvmType); boolean generateSuppressWarnings = !(jvmType instanceof JvmAnnotationType) && generatorConfig.isGenerateSyntheticSuppressWarnings() && annotationLookup.findAnnotation(jvmType, SuppressWarnings.class) == null && references.findDeclaredType(SuppressWarnings.class, jvmType) instanceof JvmAnnotationType; JvmType generatedJvmType = references.findDeclaredType("javax.annotation.Generated", jvmType); boolean generateGenerated = generatorConfig.isGenerateGeneratedAnnotation() && generatedJvmType instanceof JvmAnnotationType; if (generateSuppressWarnings || generateGenerated) { annotationValue.getValues().add(generator.getClass().getName()); annotationRef.getExplicitValues().add(annotationValue); if (generatorConfig.isIncludeDateInGeneratedAnnotation()) { if (dateFormat == null) { dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ"); annotationRef.getExplicitValues().add(annotationValue); if (!Strings.isNullOrEmpty(generatorConfig.getGeneratedAnnotationComment())) { String transformedComment = replaceVariables(generatorConfig.getGeneratedAnnotationComment(), jvmType); annotationValue = typesFactory.createJvmStringAnnotationValue(); annotationValue.setOperation(getOperation(generatedAnnotationType, "comments"));
/** Replies the compiler generate the Xbase expressions. * * @return <code>true</code> if the compiler generates the expressions */ @Pure public boolean isGenerateExpressions() { return getGeneratorConfig().isGenerateExpressions(); }
/** * @since 2.8 */ public boolean isGenerateGeneratedAnnotation() { return generatorConfig.isGenerateGeneratedAnnotation(); }
/** * @since 2.8 */ public void setJavaSourceVersion(final String javaSourceVersion) { JavaVersion javaVersion = JavaVersion.fromQualifier(javaSourceVersion); if(javaVersion == null) { List<String> qualifiers = Lists.newArrayList(); for (JavaVersion version : JavaVersion.values()) qualifiers.addAll(version.getAllQualifiers()); throw new IllegalArgumentException("Unknown Java Version Qualifier: '" + javaSourceVersion + "'. Valid values are: '" + Joiner.on(", ").join(qualifiers) + "'"); } generatorConfig.setJavaSourceVersion(javaVersion); }
/** * @since 2.8 */ public boolean isGenerateSyntheticSuppressWarnings() { return generatorConfig.isGenerateSyntheticSuppressWarnings(); }
/** * @since 2.8 */ public boolean isIncludeDateInGeneratedAnnotation() { return generatorConfig.isIncludeDateInGeneratedAnnotation(); }
@Override public GeneratorConfig get(final EObject context) { Resource _eResource = null; if (context!=null) { _eResource=context.eResource(); } ResourceSet _resourceSet = null; if (_eResource!=null) { _resourceSet=_eResource.getResourceSet(); } final ResourceSet resourceSet = _resourceSet; if ((resourceSet != null)) { final GeneratorConfigProvider.GeneratorConfigAdapter adapter = GeneratorConfigProvider.GeneratorConfigAdapter.findInEmfObject(resourceSet); if (((adapter != null) && adapter.language2GeneratorConfig.containsKey(this.languageId))) { return adapter.language2GeneratorConfig.get(this.languageId); } } return new GeneratorConfig(); } }
/** * @since 2.8 */ public void setGenerateSyntheticSuppressWarnings(final boolean generateSyntheticSuppressWarnings) { generatorConfig.setGenerateSyntheticSuppressWarnings(generateSyntheticSuppressWarnings); }
/** * @since 2.8 */ public void setGenerateGeneratedAnnotation(final boolean generateGeneratedAnnotation) { generatorConfig.setGenerateGeneratedAnnotation(generateGeneratedAnnotation); }
if (((expression != null) && config.isGenerateExpressions())) { boolean _hasErrors = this._errorSafeExtensions.hasErrors(expression); if (_hasErrors) {
/** Replies the <code>@Generated</code> is generated. * * @return <code>true</code> if the compiler generates the generated annotations. */ @Pure public boolean isGenerateGeneratedAnnotation() { return getGeneratorConfig().isGenerateGeneratedAnnotation(); }
/** Change the version of the Java source to be used for the generated Java files. * * @param version the Java version. */ public void setJavaSourceVersion(String version) { final JavaVersion javaVersion = JavaVersion.fromQualifier(version); if (javaVersion == null) { final List<String> qualifiers = new ArrayList<>(); for (final JavaVersion vers : JavaVersion.values()) { qualifiers.add(vers.getQualifier()); } throw new RuntimeException(MessageFormat.format( Messages.SarlBatchCompiler_0, version, Joiner.on(Messages.SarlBatchCompiler_1).join(qualifiers))); } getGeneratorConfig().setJavaSourceVersion(javaVersion); }
/** Replies the <code>@SuppressWarnings</code> is generated. * * @return <code>true</code> if the compiler generates the warning supression annotations. */ @Pure public boolean isGenerateSyntheticSuppressWarnings() { return getGeneratorConfig().isGenerateSyntheticSuppressWarnings(); }
/** Replies if the generation date is included in the <code>@Generated</code> annotations. * * @return <code>true</code> if the generation date is added. */ @Pure public boolean isIncludeDateInGeneratedAnnotation() { return getGeneratorConfig().isIncludeDateInGeneratedAnnotation(); }
/** Set if the <code>@SuppressWarnings</code> is generated. * * @param generateAnnotations <code>true</code> if the compiler generates the warning supression annotations. */ public void setGenerateSyntheticSuppressWarnings(boolean generateAnnotations) { getGeneratorConfig().setGenerateSyntheticSuppressWarnings(generateAnnotations); }
/** Set if the <code>@Generated</code> is generated. * * @param generateAnnotations <code>true</code> if the compiler generates the generated annotations. */ public void setGenerateGeneratedAnnotation(boolean generateAnnotations) { getGeneratorConfig().setGenerateGeneratedAnnotation(generateAnnotations); }
protected String getComplianceLevelArg() { JavaVersion javaVersion = JavaVersion.JAVA5; if (generatorConfigProvider != null) { GeneratorConfig generatorConfig = generatorConfigProvider.get(null); javaVersion = generatorConfig.getJavaSourceVersion(); } return javaVersion.getComplianceLevelArg(); }