| /** |
| * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf), Loetz GmbH&Co.KG (Heidelberg) |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Florian Pirchner - Initial implementation |
| */ |
| grammar org.eclipse.osbp.dsl.dto.xtext.DtoGrammar with org.eclipse.osbp.dsl.common.xtext.CommonGrammar |
| |
| import "http://osbp.eclipse.org/dsl/dto/v1" as dto |
| import "http://osbp.eclipse.org/dsl/common/types/v1" as common |
| import "http://osbp.eclipse.org/dsl/entity/v1" as entity |
| import "http://www.eclipse.org/xtext/xbase/Xbase" as xbase |
| import "http://www.eclipse.org/xtext/xbase/Xtype" as xtype |
| import "http://www.eclipse.org/Xtext/Xbase/XAnnotations" as xannotation |
| import "http://www.eclipse.org/xtext/common/JavaVMTypes" as types |
| |
| LDTOModel returns dto::LDtoModel: |
| importSection=XImportSection? |
| packages+=TypedPackage*; |
| |
| Class returns dto::LDto: |
| {dto::LDto} annotations+=AnnotationDef* |
| |
| (({dto::LDto.annotationInfo=current} |
| (abstract?='abstract')? 'dto' name=ValidIDWithKeywords ('extends' superType=[dto::LDto|TYPE_CROSS_REFERENCE])? ('wraps' wrappedType=[entity::LEntity|TYPE_CROSS_REFERENCE])? |
| '{' |
| features+=DtoFeature* |
| '}') |
| | |
| ({dto::LAutoInheritDto.annotationInfo=current} |
| (abstract?='abstract')? 'autoDto' name=ValidIDWithKeywords ('extends' superType=[dto::LDto|TYPE_CROSS_REFERENCE])? 'wraps' wrappedType=[entity::LEntity|TYPE_CROSS_REFERENCE] |
| '{' |
| features+=DtoFeature* |
| '}') |
| ) |
| ; |
| |
| DtoFeature returns dto::LDtoFeature: |
| {dto::LDtoFeature} |
| annotations+=AnnotationDef* |
| ((({dto::LDtoInheritedAttribute.annotationInfo=current} |
| 'inheritVar' inheritedFeature=[entity::LEntityAttribute|ValidIDWithKeywords]) ('mapto' type=[dto::LDto|TYPE_CROSS_REFERENCE])? ('properties' '(' properties+=KeyAndValue (',' properties+=KeyAndValue)* ')')? (mapper=DtoMapper?)) |
| | |
| ({dto::LDtoInheritedReference.annotationInfo=current} |
| ('inheritRef' inheritedFeature=[entity::LEntityReference|ValidIDWithKeywords]) 'mapto' type=[dto::LDto|TYPE_CROSS_REFERENCE] ('properties' '(' properties+=KeyAndValue (',' properties+=KeyAndValue)* ')')? (mapper=DtoMapper?)) |
| | |
| ({dto::LDtoAttribute.annotationInfo=current} |
| (transient?='transient' type=[common::LScalarType|TYPE_CROSS_REFERENCE] ('['constraints+=AllConstraints* ']')? name=ValidIDWithKeywords ('properties' '(' properties+=KeyAndValue (',' properties+=KeyAndValue)* ')')?)) |
| | |
| ({dto::LDtoAttribute.annotationInfo=current} |
| (dirty?='dirty' type=[common::LScalarType|TYPE_CROSS_REFERENCE] name=ValidIDWithKeywords ('properties' '(' properties+=KeyAndValue (',' properties+=KeyAndValue)* ')')?)) |
| | |
| ({dto::LDtoAttribute.annotationInfo=current} |
| (derived?='derived' (domainDescription?='domainDescription')? type=[common::LScalarType|TYPE_CROSS_REFERENCE] name=ValidIDWithKeywords ('properties' '(' properties+=KeyAndValue (',' properties+=KeyAndValue)* ')')? derivedGetterExpression=XBlockExpression)) |
| | |
| ({dto::LDtoAttribute.annotationInfo=current} |
| (id?='id' | version?="version" | uuid?="uuid" | domainDescription?='domainDescription' | domainKey?='domainKey') type=[common::LScalarType|TYPE_CROSS_REFERENCE] multiplicity=Multiplicity? ('['constraints+=AllConstraints* ']')? |
| name=ValidIDWithKeywords ('properties' '(' properties+=KeyAndValue (',' properties+=KeyAndValue)* ')')? |
| ) |
| | |
| ({dto::LDtoReference.annotationInfo=current} |
| ('ref' ((cascadeMergePersist?='cascadeMergePersist')? & (lazy?='lazy')?) (cascadeRemove?='cascadeRemove')? type=[dto::LDto|TYPE_CROSS_REFERENCE] multiplicity=Multiplicity? ('['constraints+=AllConstraints* ']')? name=ValidIDWithKeywords |
| ('opposite' opposite=[dto::LDtoReference|LFQN])? ('properties' '(' properties+=KeyAndValue (',' properties+=KeyAndValue)* ')')?) |
| (mapper=LimitedMapperDtoMapper?)) |
| | |
| ({dto::LDtoAttribute.annotationInfo=current} |
| 'var' type=[common::LScalarType|TYPE_CROSS_REFERENCE] multiplicity=Multiplicity? ('['constraints+=AllConstraints* ']')? |
| name=ValidIDWithKeywords ('properties' '(' properties+=KeyAndValue (',' properties+=KeyAndValue)* ')')? (mapper=LimitedMapperDtoMapper?)) |
| | |
| ({dto::LDtoOperation.annotationInfo=current} |
| ('def' type=JvmTypeReference name=ValidIDWithKeywords |
| '(' (params+=FullJvmFormalParameter (',' params+=FullJvmFormalParameter)*)? ')' |
| body=XExpression))); |
| |
| DtoMapper returns dto::LDtoMapper: |
| '{' 'toDTO' |
| toDTO=XExpression |
| ('fromDTO' |
| fromDTO=XExpression)? |
| '}'; |
| |
| // custom vars and refs should not be mapped to entity. |
| LimitedMapperDtoMapper returns dto::LDtoMapper: |
| '{' 'toDTO' |
| toDTO=XExpression |
| '}'; |
| |
| RefFQN: |
| ID ('.' ID)*; |