Package org.eclipse.xtext.common.types

Examples of org.eclipse.xtext.common.types.JvmTypeReference


    if (_equals) {
      String _name_1 = it.getName();
      String _plus = ("__" + _name_1);
      this.error("Illegal property name \'dbObject\'", MongoBeansPackage.Literals.ABSTRACT_FEATURE__NAME, MongoBeansValidator.ILLEGAL_PROPERTY_NAME, _plus);
    }
    JvmTypeReference _type = it.getType();
    boolean _notEquals = (!Objects.equal(_type, null));
    if (_notEquals) {
      JvmTypeReference _type_1 = it.getType();
      boolean _isMongoType = this.mongoTypes.isMongoType(_type_1);
      boolean _not = (!_isMongoType);
      if (_not) {
        this.error("Only MongoBeans and mappable types are allowed", MongoBeansPackage.Literals.MONGO_PROPERTY__TYPE, MongoBeansValidator.ILLEGAL_TYPE);
      }
View Full Code Here


    final String className = _trimFileExtension.lastSegment();
    JvmGenericType _class = this._jvmTypesBuilder.toClass(script, className);
    final Procedure1<JvmGenericType> _function = new Procedure1<JvmGenericType>() {
      public void apply(final JvmGenericType it) {
        EList<JvmMember> _members = it.getMembers();
        JvmTypeReference _typeRef = ScriptingJvmModelInferrer.this._typeReferenceBuilder.typeRef(Void.TYPE);
        final Procedure1<JvmOperation> _function = new Procedure1<JvmOperation>() {
          public void apply(final JvmOperation it) {
            EList<JvmFormalParameter> _parameters = it.getParameters();
            JvmTypeReference _typeRef = ScriptingJvmModelInferrer.this._typeReferenceBuilder.typeRef(String.class);
            JvmTypeReference _addArrayTypeDimension = ScriptingJvmModelInferrer.this._jvmTypesBuilder.addArrayTypeDimension(_typeRef);
            JvmFormalParameter _parameter = ScriptingJvmModelInferrer.this._jvmTypesBuilder.toParameter(script, "args", _addArrayTypeDimension);
            ScriptingJvmModelInferrer.this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter);
            it.setStatic(true);
            it.setVarArgs(true);
            ScriptingJvmModelInferrer.this._jvmTypesBuilder.setBody(it, script);
View Full Code Here

   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetType(JvmTypeReference newType, NotificationChain msgs)
  {
    JvmTypeReference oldType = type;
    type = newType;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, MongoBeansPackage.MONGO_PROPERTY__TYPE, oldType, newType);
      if (msgs == null) msgs = notification; else msgs.add(notification);
View Full Code Here

  protected void _infer(final Program program, final IJvmDeclaredTypeAcceptor acceptor, final boolean isPreIndexingPhase) {
    JvmGenericType _class = this._jvmTypesBuilder.toClass(program, TortoiseShellJvmModelInferrer.INFERRED_CLASS_NAME);
    final Procedure1<JvmGenericType> _function = new Procedure1<JvmGenericType>() {
      public void apply(final JvmGenericType it) {
        EList<JvmTypeReference> _superTypes = it.getSuperTypes();
        JvmTypeReference _typeRef = TortoiseShellJvmModelInferrer.this._typeReferenceBuilder.typeRef(Tortoise.class);
        TortoiseShellJvmModelInferrer.this._jvmTypesBuilder.<JvmTypeReference>operator_add(_superTypes, _typeRef);
        XBlockExpression _body = program.getBody();
        boolean _notEquals = (!Objects.equal(_body, null));
        if (_notEquals) {
          EList<JvmMember> _members = it.getMembers();
          JvmTypeReference _typeRef_1 = TortoiseShellJvmModelInferrer.this._typeReferenceBuilder.typeRef(void.class);
          final Procedure1<JvmOperation> _function = new Procedure1<JvmOperation>() {
            public void apply(final JvmOperation it) {
              XBlockExpression _body = program.getBody();
              TortoiseShellJvmModelInferrer.this._jvmTypesBuilder.setBody(it, _body);
            }
          };
          JvmOperation _method = TortoiseShellJvmModelInferrer.this._jvmTypesBuilder.toMethod(program, "main", _typeRef_1, _function);
          TortoiseShellJvmModelInferrer.this._jvmTypesBuilder.<JvmOperation>operator_add(_members, _method);
        }
        EList<SubProgram> _subPrograms = program.getSubPrograms();
        for (final SubProgram subProgram : _subPrograms) {
          EList<JvmMember> _members_1 = it.getMembers();
          String _name = subProgram.getName();
          JvmTypeReference _elvis = null;
          JvmTypeReference _returnType = subProgram.getReturnType();
          if (_returnType != null) {
            _elvis = _returnType;
          } else {
            XBlockExpression _body_1 = subProgram.getBody();
            JvmTypeReference _inferredType = TortoiseShellJvmModelInferrer.this._jvmTypesBuilder.inferredType(_body_1);
            _elvis = _inferredType;
          }
          final Procedure1<JvmOperation> _function_1 = new Procedure1<JvmOperation>() {
            public void apply(final JvmOperation it) {
              EList<JvmFormalParameter> _parameters = subProgram.getParameters();
              for (final JvmFormalParameter subParameter : _parameters) {
                EList<JvmFormalParameter> _parameters_1 = it.getParameters();
                String _name = subParameter.getName();
                JvmTypeReference _parameterType = subParameter.getParameterType();
                JvmFormalParameter _parameter = TortoiseShellJvmModelInferrer.this._jvmTypesBuilder.toParameter(subParameter, _name, _parameterType);
                TortoiseShellJvmModelInferrer.this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters_1, _parameter);
              }
              XBlockExpression _body = subProgram.getBody();
              TortoiseShellJvmModelInferrer.this._jvmTypesBuilder.setBody(it, _body);
View Full Code Here

      final Procedure1<JvmGenericType> _function = new Procedure1<JvmGenericType>() {
        public void apply(final JvmGenericType it) {
          String _documentation = MongoBeansJvmModelInferrer.this._jvmTypesBuilder.getDocumentation(bean);
          MongoBeansJvmModelInferrer.this._jvmTypesBuilder.setDocumentation(it, _documentation);
          EList<JvmTypeReference> _superTypes = it.getSuperTypes();
          JvmTypeReference _typeRef = MongoBeansJvmModelInferrer.this._typeReferenceBuilder.typeRef(IMongoBean.class);
          MongoBeansJvmModelInferrer.this._jvmTypesBuilder.<JvmTypeReference>operator_add(_superTypes, _typeRef);
          MongoBeansJvmModelInferrer.this.addConstructors(it, bean);
          MongoBeansJvmModelInferrer.this.addDbObjectProperty(it, bean);
          EList<AbstractFeature> _features = bean.getFeatures();
          for (final AbstractFeature feature : _features) {
View Full Code Here

  }
 
  protected boolean addConstructors(final JvmDeclaredType inferredType, final MongoBean bean) {
    boolean _xblockexpression = false;
    {
      final JvmTypeReference typeRef1 = this._typeReferenceBuilder.typeRef(DBObject.class);
      EList<JvmMember> _members = inferredType.getMembers();
      final Procedure1<JvmConstructor> _function = new Procedure1<JvmConstructor>() {
        public void apply(final JvmConstructor it) {
          StringConcatenation _builder = new StringConcatenation();
          _builder.append("Creates a new ");
View Full Code Here

 
  protected boolean addDbObjectProperty(final JvmDeclaredType inferredType, final MongoBean bean) {
    boolean _xblockexpression = false;
    {
      EList<JvmMember> _members = inferredType.getMembers();
      JvmTypeReference _typeRef = this._typeReferenceBuilder.typeRef(DBObject.class);
      JvmField _field = this._jvmTypesBuilder.toField(bean, "_dbObject", _typeRef);
      this._jvmTypesBuilder.<JvmField>operator_add(_members, _field);
      EList<JvmMember> _members_1 = inferredType.getMembers();
      JvmTypeReference _typeRef_1 = this._typeReferenceBuilder.typeRef(DBObject.class);
      JvmOperation _getter = this._jvmTypesBuilder.toGetter(bean, "dbObject", "_dbObject", _typeRef_1);
      _xblockexpression = this._jvmTypesBuilder.<JvmOperation>operator_add(_members_1, _getter);
    }
    return _xblockexpression;
  }
View Full Code Here

  }
 
  protected boolean addListAccessor(final JvmDeclaredType inferredType, final MongoProperty property) {
    boolean _xblockexpression = false;
    {
      JvmTypeReference _jvmType = this.getJvmType(property);
      final JvmTypeReference propertyType = this._primitives.asWrapperTypeIfPrimitive(_jvmType);
      boolean _xifexpression = false;
      boolean _isMongoPrimitiveType = this._mongoTypes.isMongoPrimitiveType(propertyType);
      if (_isMongoPrimitiveType) {
        EList<JvmMember> _members = inferredType.getMembers();
        String _name = property.getName();
        String _firstUpper = StringExtensions.toFirstUpper(_name);
        String _plus = ("get" + _firstUpper);
        JvmTypeReference _typeRef = this._typeReferenceBuilder.typeRef(List.class, propertyType);
        final Procedure1<JvmOperation> _function = new Procedure1<JvmOperation>() {
          public void apply(final JvmOperation it) {
            String _documentation = MongoBeansJvmModelInferrer.this._jvmTypesBuilder.getDocumentation(property);
            MongoBeansJvmModelInferrer.this._jvmTypesBuilder.setDocumentation(it, _documentation);
            StringConcatenationClient _client = new StringConcatenationClient() {
              @Override
              protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
                _builder.append("return (");
                _builder.append(List.class, "");
                _builder.append("<");
                _builder.append(propertyType, "");
                _builder.append(">) _dbObject.get(\"");
                String _name = property.getName();
                _builder.append(_name, "");
                _builder.append("\");");
                _builder.newLineIfNotEmpty();
              }
            };
            MongoBeansJvmModelInferrer.this._jvmTypesBuilder.setBody(it, _client);
          }
        };
        JvmOperation _method = this._jvmTypesBuilder.toMethod(property, _plus, _typeRef, _function);
        _xifexpression = this._jvmTypesBuilder.<JvmOperation>operator_add(_members, _method);
      } else {
        boolean _xblockexpression_1 = false;
        {
          EList<JvmMember> _members_1 = inferredType.getMembers();
          String _name_1 = property.getName();
          String _plus_1 = ("_" + _name_1);
          JvmTypeReference _typeRef_1 = this._typeReferenceBuilder.typeRef(MongoBeanList.class, propertyType);
          JvmField _field = this._jvmTypesBuilder.toField(property, _plus_1, _typeRef_1);
          this._jvmTypesBuilder.<JvmField>operator_add(_members_1, _field);
          EList<JvmMember> _members_2 = inferredType.getMembers();
          String _name_2 = property.getName();
          String _firstUpper_1 = StringExtensions.toFirstUpper(_name_2);
          String _plus_2 = ("get" + _firstUpper_1);
          JvmTypeReference _typeRef_2 = this._typeReferenceBuilder.typeRef(List.class, propertyType);
          final Procedure1<JvmOperation> _function_1 = new Procedure1<JvmOperation>() {
            public void apply(final JvmOperation it) {
              String _documentation = MongoBeansJvmModelInferrer.this._jvmTypesBuilder.getDocumentation(property);
              MongoBeansJvmModelInferrer.this._jvmTypesBuilder.setDocumentation(it, _documentation);
              StringConcatenationClient _client = new StringConcatenationClient() {
View Full Code Here

    {
      EList<JvmMember> _members = inferredType.getMembers();
      String _name = property.getName();
      String _firstUpper = StringExtensions.toFirstUpper(_name);
      String _plus = ("get" + _firstUpper);
      JvmTypeReference _jvmType = this.getJvmType(property);
      final Procedure1<JvmOperation> _function = new Procedure1<JvmOperation>() {
        public void apply(final JvmOperation it) {
          String _documentation = MongoBeansJvmModelInferrer.this._jvmTypesBuilder.getDocumentation(property);
          MongoBeansJvmModelInferrer.this._jvmTypesBuilder.setDocumentation(it, _documentation);
          StringConcatenationClient _client = new StringConcatenationClient() {
            @Override
            protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
              {
                JvmTypeReference _jvmType = MongoBeansJvmModelInferrer.this.getJvmType(property);
                JvmType _type = _jvmType.getType();
                boolean _isMongoBean = MongoBeansJvmModelInferrer.this._mongoTypes.isMongoBean(_type);
                if (_isMongoBean) {
                  _builder.append("return ");
                  _builder.append(WrappingUtil.class, "");
                  _builder.append(".wrapAndCast((");
                  _builder.append(DBObject.class, "");
                  _builder.append(") _dbObject.get(\"");
                  String _name = property.getName();
                  _builder.append(_name, "");
                  _builder.append("\"));");
                  _builder.newLineIfNotEmpty();
                } else {
                  _builder.append("return (");
                  JvmTypeReference _jvmType_1 = MongoBeansJvmModelInferrer.this.getJvmType(property);
                  JvmTypeReference _asWrapperTypeIfPrimitive = MongoBeansJvmModelInferrer.this._primitives.asWrapperTypeIfPrimitive(_jvmType_1);
                  _builder.append(_asWrapperTypeIfPrimitive, "");
                  _builder.append(") _dbObject.get(\"");
                  String _name_1 = property.getName();
                  _builder.append(_name_1, "");
                  _builder.append("\");");
                  _builder.newLineIfNotEmpty();
                }
              }
            }
          };
          MongoBeansJvmModelInferrer.this._jvmTypesBuilder.setBody(it, _client);
        }
      };
      JvmOperation _method = this._jvmTypesBuilder.toMethod(property, _plus, _jvmType, _function);
      this._jvmTypesBuilder.<JvmOperation>operator_add(_members, _method);
      EList<JvmMember> _members_1 = inferredType.getMembers();
      String _name_1 = property.getName();
      String _firstUpper_1 = StringExtensions.toFirstUpper(_name_1);
      String _plus_1 = ("set" + _firstUpper_1);
      JvmTypeReference _typeRef = this._typeReferenceBuilder.typeRef(Void.TYPE);
      final Procedure1<JvmOperation> _function_1 = new Procedure1<JvmOperation>() {
        public void apply(final JvmOperation it) {
          String _documentation = MongoBeansJvmModelInferrer.this._jvmTypesBuilder.getDocumentation(property);
          MongoBeansJvmModelInferrer.this._jvmTypesBuilder.setDocumentation(it, _documentation);
          EList<JvmFormalParameter> _parameters = it.getParameters();
          String _name = property.getName();
          JvmTypeReference _jvmType = MongoBeansJvmModelInferrer.this.getJvmType(property);
          JvmFormalParameter _parameter = MongoBeansJvmModelInferrer.this._jvmTypesBuilder.toParameter(property, _name, _jvmType);
          MongoBeansJvmModelInferrer.this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter);
          StringConcatenationClient _client = new StringConcatenationClient() {
            @Override
            protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
              {
                JvmTypeReference _jvmType = MongoBeansJvmModelInferrer.this.getJvmType(property);
                JvmType _type = _jvmType.getType();
                boolean _isMongoBean = MongoBeansJvmModelInferrer.this._mongoTypes.isMongoBean(_type);
                if (_isMongoBean) {
                  _builder.append("_dbObject.put(\"");
                  String _name = property.getName();
                  _builder.append(_name, "");
View Full Code Here

  }
 
  protected boolean addMethod(final JvmDeclaredType inferredType, final MongoOperation operation) {
    EList<JvmMember> _members = inferredType.getMembers();
    String _name = operation.getName();
    JvmTypeReference _returnType = operation.getReturnType();
    final Procedure1<JvmOperation> _function = new Procedure1<JvmOperation>() {
      public void apply(final JvmOperation it) {
        String _documentation = MongoBeansJvmModelInferrer.this._jvmTypesBuilder.getDocumentation(operation);
        MongoBeansJvmModelInferrer.this._jvmTypesBuilder.setDocumentation(it, _documentation);
        EList<JvmFormalParameter> _parameters = it.getParameters();
        EList<JvmFormalParameter> _parameters_1 = operation.getParameters();
        final Function1<JvmFormalParameter, JvmFormalParameter> _function = new Function1<JvmFormalParameter, JvmFormalParameter>() {
          public JvmFormalParameter apply(final JvmFormalParameter it) {
            String _name = it.getName();
            JvmTypeReference _parameterType = it.getParameterType();
            return MongoBeansJvmModelInferrer.this._jvmTypesBuilder.toParameter(operation, _name, _parameterType);
          }
        };
        List<JvmFormalParameter> _map = ListExtensions.<JvmFormalParameter, JvmFormalParameter>map(_parameters_1, _function);
        MongoBeansJvmModelInferrer.this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _map);
View Full Code Here

TOP

Related Classes of org.eclipse.xtext.common.types.JvmTypeReference

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.