/** Create a JvmType for a Python type. * * @param pythonName the python type name. * @return the type. */ @SuppressWarnings("static-method") protected JvmType newType(String pythonName) { final JvmGenericType type = TypesFactory.eINSTANCE.createJvmGenericType(); final int index = pythonName.indexOf("."); //$NON-NLS-1$ if (index <= 0) { type.setSimpleName(pythonName); } else { type.setPackageName(pythonName.substring(0, index - 1)); type.setSimpleName(pythonName.substring(index + 1)); } return type; }
@Override public void apply(final JvmGenericType it) { it.setPackageName(packageName); EList<JvmTypeReference> _superTypes = it.getSuperTypes(); JvmTypeReference _typeRef = EMFPatternLanguageJvmModelInferrer.this._typeReferenceBuilder.typeRef(BasePatternMatch.class); EMFPatternLanguageJvmModelInferrer.this._eMFJvmTypesBuilder.<JvmTypeReference>operator_add(_superTypes, _typeRef); } };
@Override public void apply(final JvmGenericType it) { it.setPackageName(packageName); EList<JvmTypeReference> _superTypes = it.getSuperTypes(); JvmTypeReference _typeRef = EMFPatternLanguageJvmModelInferrer.this._typeReferenceBuilder.typeRef(matchClass); JvmTypeReference _typeRef_1 = EMFPatternLanguageJvmModelInferrer.this._typeReferenceBuilder.typeRef(BaseMatcher.class, _typeRef); EMFPatternLanguageJvmModelInferrer.this._eMFJvmTypesBuilder.<JvmTypeReference>operator_add(_superTypes, _typeRef_1); } };
@Override public void apply(final JvmGenericType it) { String _packageName = model.getPackageName(); it.setPackageName(_packageName); it.setFinal(true); EList<JvmTypeReference> _superTypes = it.getSuperTypes(); JvmTypeReference _typeRef = PatternGroupClassInferrer.this.builder.typeRef(BaseGeneratedPatternGroup.class); PatternGroupClassInferrer.this._eMFJvmTypesBuilder.<JvmTypeReference>operator_add(_superTypes, _typeRef); } };
@Override public void apply(final JvmGenericType it) { it.setPackageName(processorPackageName); CharSequence _javadocProcessorClass = PatternMatchProcessorClassInferrer.this._javadocInferrer.javadocProcessorClass(pattern); String _string = _javadocProcessorClass.toString(); PatternMatchProcessorClassInferrer.this._eMFJvmTypesBuilder.setDocumentation(it, _string); it.setAbstract(true); EList<JvmTypeReference> _superTypes = it.getSuperTypes(); JvmTypeReference _typeRef = PatternMatchProcessorClassInferrer.this.builder.typeRef(matchClass); JvmTypeReference _typeRef_1 = PatternMatchProcessorClassInferrer.this.builder.typeRef(IMatchProcessor.class, _typeRef); PatternMatchProcessorClassInferrer.this._eMFJvmTypesBuilder.<JvmTypeReference>operator_add(_superTypes, _typeRef_1); } };
protected JvmGenericType createJvmGenericType(/* @Nullable */ EObject sourceElement, /* @Nullable */ String name) { if (sourceElement == null || name == null) return null; Pair<String, String> fullName = splitQualifiedName(name); final JvmGenericType result = typesFactory.createJvmGenericType(); result.setSimpleName(fullName.getSecond()); if (fullName.getFirst() != null) result.setPackageName(fullName.getFirst()); result.setVisibility(JvmVisibility.PUBLIC); return result; }
result.setSimpleName(clazz.getSimpleName()); if (clazz.getDeclaringClass() == null && clazz.getPackage() != null) result.setPackageName(clazz.getPackage().getName());
result.setSimpleName(clazz.getSimpleName()); if (clazz.getDeclaringClass() == null && clazz.getPackage() != null) result.setPackageName(clazz.getPackage().getName());
public JvmGenericType inferPatternGroupClass(final PatternModel model, final JvmTypeReferenceBuilder builder, final EMFPatternLanguageGeneratorConfig config, final boolean includePrivate) { JvmGenericType _xblockexpression = null; { this.builder = builder; final Procedure1<JvmGenericType> _function = (JvmGenericType it) -> { it.setPackageName(this.groupPackageName(model, includePrivate)); it.setFinal(true); EList<JvmTypeReference> _superTypes = it.getSuperTypes(); JvmTypeReference _typeRef = this.builder.typeRef(BaseGeneratedPatternGroup.class); this._eMFJvmTypesBuilder.<JvmTypeReference>operator_add(_superTypes, _typeRef); this._eMFJvmTypesBuilder.setFileHeader(it, this._eMFPatternLanguageJvmModelInferrerUtil.getFileComment(model)); }; _xblockexpression = this._eMFJvmTypesBuilder.toClass(model, this.groupClassName(model, includePrivate), _function); } return _xblockexpression; }
/** * Infers the {@link Consumer} implementation class from a {@link Pattern}. */ public JvmDeclaredType inferProcessorClass(final Pattern pattern, final boolean isPrelinkingPhase, final String processorPackageName, final JvmType matchClass, final JvmTypeReferenceBuilder builder, final JvmAnnotationReferenceBuilder annBuilder, final EMFPatternLanguageGeneratorConfig config) { this.builder = builder; this.annBuilder = annBuilder; final Procedure1<JvmGenericType> _function = (JvmGenericType it) -> { EMFPatternLanguageGeneratorConfig.MatcherGenerationStrategy _matcherGenerationStrategy = config.getMatcherGenerationStrategy(); boolean _equals = Objects.equal(_matcherGenerationStrategy, EMFPatternLanguageGeneratorConfig.MatcherGenerationStrategy.NESTED_CLASS); it.setStatic(_equals); it.setPackageName(processorPackageName); this._eMFJvmTypesBuilder.setDocumentation(it, this._javadocInferrer.javadocProcessorClass(pattern).toString()); it.setAbstract(true); EList<JvmTypeReference> _superTypes = it.getSuperTypes(); JvmTypeReference _typeRef = this.builder.typeRef(Consumer.class, this.builder.typeRef(matchClass)); this._eMFJvmTypesBuilder.<JvmTypeReference>operator_add(_superTypes, _typeRef); this._eMFJvmTypesBuilder.setFileHeader(it, this._eMFPatternLanguageJvmModelInferrerUtil.getFileComment(pattern)); }; final JvmGenericType processorClass = this._eMFJvmTypesBuilder.toClass(pattern, this._eMFPatternLanguageJvmModelInferrerUtil.processorClassName(pattern, config.getMatcherGenerationStrategy()), _function); return processorClass; }
@Override public void apply(final JvmGenericType it) { it.setPackageName(querySpecificationPackageName); CharSequence _javadocQuerySpecificationClass = PatternQuerySpecificationClassInferrer.this._javadocInferrer.javadocQuerySpecificationClass(pattern); String _string = _javadocQuerySpecificationClass.toString(); PatternQuerySpecificationClassInferrer.this._eMFJvmTypesBuilder.setDocumentation(it, _string); it.setFinal(true); boolean _isPublic = PatternQuerySpecificationClassInferrer.this.util.isPublic(pattern); if (_isPublic) { EList<JvmTypeReference> _superTypes = it.getSuperTypes(); JvmTypeReference _typeRef = PatternQuerySpecificationClassInferrer.this.builder.typeRef(matcherClass); JvmTypeReference _typeRef_1 = PatternQuerySpecificationClassInferrer.this.builder.typeRef(BaseGeneratedEMFQuerySpecification.class, _typeRef); PatternQuerySpecificationClassInferrer.this._eMFJvmTypesBuilder.<JvmTypeReference>operator_add(_superTypes, _typeRef_1); } else { EList<JvmTypeReference> _superTypes_1 = it.getSuperTypes(); JvmTypeReference _typeRef_2 = PatternQuerySpecificationClassInferrer.this.builder.typeRef(IPatternMatch.class); JvmTypeReference _typeRef_3 = PatternQuerySpecificationClassInferrer.this.builder.typeRef(matcherClass, _typeRef_2); JvmTypeReference _typeRef_4 = PatternQuerySpecificationClassInferrer.this.builder.typeRef(BaseGeneratedEMFQuerySpecification.class, _typeRef_3); PatternQuerySpecificationClassInferrer.this._eMFJvmTypesBuilder.<JvmTypeReference>operator_add(_superTypes_1, _typeRef_4); } } };
/** * Infers the {@link IQuerySpecification} implementation class from {@link Pattern}. */ public JvmDeclaredType inferQuerySpecificationClass(final Pattern pattern, final boolean isPrelinkingPhase, final String querySpecificationPackageName, final JvmType matcherClass, final JvmTypeReferenceBuilder builder, final JvmAnnotationReferenceBuilder annBuilder, final EMFPatternLanguageGeneratorConfig config) { this.builder = builder; this.annBuilder = annBuilder; final Procedure1<JvmGenericType> _function = (JvmGenericType it) -> { it.setPackageName(querySpecificationPackageName); this._eMFJvmTypesBuilder.setDocumentation(it, this._javadocInferrer.javadocQuerySpecificationClass(pattern).toString()); it.setFinal(true); if ((this.util.isPublic(pattern) && (config.getMatcherGenerationStrategy() != EMFPatternLanguageGeneratorConfig.MatcherGenerationStrategy.USE_GENERIC))) { EList<JvmTypeReference> _superTypes = it.getSuperTypes(); JvmTypeReference _typeRef = this.builder.typeRef(BaseGeneratedEMFQuerySpecification.class, this.builder.typeRef(matcherClass)); this._eMFJvmTypesBuilder.<JvmTypeReference>operator_add(_superTypes, _typeRef); } else { EList<JvmTypeReference> _superTypes_1 = it.getSuperTypes(); JvmTypeReference _typeRef_1 = this.builder.typeRef(BaseGeneratedEMFQuerySpecificationWithGenericMatcher.class); this._eMFJvmTypesBuilder.<JvmTypeReference>operator_add(_superTypes_1, _typeRef_1); } this._eMFJvmTypesBuilder.setFileHeader(it, this.util.getFileComment(pattern)); }; final JvmGenericType querySpecificationClass = this._eMFJvmTypesBuilder.toClass(pattern, this.util.querySpecificationClassName(pattern, config.getMatcherGenerationStrategy()), _function); return querySpecificationClass; }
it.setStatic(true); } else { it.setPackageName(packageName); this._eMFJvmTypesBuilder.setFileHeader(it, this._eMFPatternLanguageJvmModelInferrerUtil.getFileComment(pattern)); it.setStatic(true); } else { it.setPackageName(packageName); this._eMFJvmTypesBuilder.setFileHeader(it, this._eMFPatternLanguageJvmModelInferrerUtil.getFileComment(pattern));