Package org.eclipse.xtend.lib.macro.declaration

Examples of org.eclipse.xtend.lib.macro.declaration.Type


        TypeReference _primitiveBoolean = context.getPrimitiveBoolean();
        boolean _equals = Objects.equal(fieldType, _primitiveBoolean);
        if (_equals) {
          _or = true;
        } else {
          Type _type = fieldType.getType();
          String _simpleName = _type.getSimpleName();
          boolean _equals_1 = Objects.equal(_simpleName, "Boolean");
          _or = _equals_1;
        }
        if (_or) {
          _xifexpression = "is";
View Full Code Here


 
  protected final CharSequence cacheFieldInit(@Extension final CompilationStrategy.CompilationContext context) {
    CharSequence _xblockexpression = null;
    {
      TypeReference _newTypeReference = this.context.newTypeReference(Memoize.class);
      Type _type = _newTypeReference.getType();
      final AnnotationReference memoizeAnnotation = this.method.findAnnotation(_type);
      final Object cacheDuration = memoizeAnnotation.getValue("cacheDuration");
      final Object maxSize = memoizeAnnotation.getValue("maxSize");
      StringConcatenation _builder = new StringConcatenation();
      _builder.append("com.google.common.cache.CacheBuilder.newBuilder()");
View Full Code Here

      return _xifexpression;
    }
  }
 
  public void doTransform(final MutableClassDeclaration it, @Extension final TransformationContext context) {
    Type _findTypeGlobally = context.findTypeGlobally(Data.class);
    AnnotationReference _findAnnotation = it.findAnnotation(_findTypeGlobally);
    boolean _tripleNotEquals = (_findAnnotation != null);
    if (_tripleNotEquals) {
      return;
    }
    @Extension
    final EqualsHashCodeProcessor.Util util = new EqualsHashCodeProcessor.Util(context);
    boolean _hasEquals = util.hasEquals(it);
    if (_hasEquals) {
      Type _findTypeGlobally_1 = context.findTypeGlobally(EqualsHashCode.class);
      final AnnotationReference annotation = it.findAnnotation(_findTypeGlobally_1);
      context.addWarning(annotation, "equals is already defined, this annotation has no effect");
    } else {
      boolean _hasHashCode = util.hasHashCode(it);
      if (_hasHashCode) {
View Full Code Here

        boolean _hasEquals = this.hasEquals(cls);
        if (_hasEquals) {
          _xifexpression_1 = true;
        } else {
          TypeReference _extendedClass = cls.getExtendedClass();
          Type _type = _extendedClass.getType();
          _xifexpression_1 = this.hasSuperEquals(((ClassDeclaration) _type));
        }
        _xifexpression = _xifexpression_1;
      }
      return _xifexpression;
View Full Code Here

 
  private String getVisitorName(final MethodDeclaration it) {
    Iterable<? extends ParameterDeclaration> _parameters = it.getParameters();
    ParameterDeclaration _head = IterableExtensions.head(_parameters);
    TypeReference _type = _head.getType();
    Type _type_1 = _type.getType();
    return _type_1.getQualifiedName();
  }
View Full Code Here

                      _builder.append("return ");
                    }
                  }
                  _builder.append("visit");
                  TypeReference _extendedClass = inheritor.getExtendedClass();
                  Type _type = _extendedClass.getType();
                  String _simpleName = ((TypeDeclaration) _type).getSimpleName();
                  _builder.append(_simpleName, "");
                  _builder.append("(");
                  Iterable<? extends MutableParameterDeclaration> _parameters = method.getParameters();
                  final Function1<MutableParameterDeclaration, String> _function = new Function1<MutableParameterDeclaration, String>() {
View Full Code Here

        boolean valid = true;
        for (final TypeReference iface : listedInterfaces) {
          {
            final Function1<TypeReference, Boolean> _function = new Function1<TypeReference, Boolean>() {
              public Boolean apply(final TypeReference it) {
                Type _type = it.getType();
                Type _type_1 = iface.getType();
                return Boolean.valueOf(Objects.equal(_type, _type_1));
              }
            };
            boolean _exists = IterableExtensions.exists(availableInterfaces, _function);
            boolean _not = (!_exists);
            if (_not) {
              StringConcatenation _builder = new StringConcatenation();
              TypeReference _type_1 = this.getType(delegate);
              String _simpleName = _type_1.getSimpleName();
              _builder.append(_simpleName, "");
              _builder.append(" does not implement ");
              String _simpleName_1 = iface.getSimpleName();
              _builder.append(_simpleName_1, "");
              this.context.addError(delegate, _builder.toString());
              valid = false;
            }
            final Function1<TypeReference, Boolean> _function_1 = new Function1<TypeReference, Boolean>() {
              public Boolean apply(final TypeReference it) {
                Type _type = it.getType();
                Type _type_1 = iface.getType();
                return Boolean.valueOf(Objects.equal(_type, _type_1));
              }
            };
            boolean _exists_1 = IterableExtensions.exists(interfacesOfDeclaringType, _function_1);
            boolean _not_1 = (!_exists_1);
            if (_not_1) {
              StringConcatenation _builder_1 = new StringConcatenation();
              String _simpleName_2 = declaringType.getSimpleName();
              _builder_1.append(_simpleName_2, "");
              _builder_1.append(" does not implement ");
              String _simpleName_3 = iface.getSimpleName();
              _builder_1.append(_simpleName_3, "");
              this.context.addError(delegate, _builder_1.toString());
              valid = false;
            }
          }
        }
        boolean _and = false;
        boolean _isEmpty = listedInterfaces.isEmpty();
        if (!_isEmpty) {
          _and = false;
        } else {
          Sets.SetView<? extends TypeReference> _intersection = Sets.intersection(interfacesOfDeclaringType, availableInterfaces);
          boolean _isEmpty_1 = _intersection.isEmpty();
          _and = _isEmpty_1;
        }
        if (_and) {
          StringConcatenation _builder = new StringConcatenation();
          TypeReference _type_1 = this.getType(delegate);
          String _simpleName = _type_1.getSimpleName();
          _builder.append(_simpleName, "");
          _builder.append(" and ");
          String _simpleName_1 = declaringType.getSimpleName();
          _builder.append(_simpleName_1, "");
          _builder.append(" have no interfaces in common");
View Full Code Here

   
    public Iterable<? extends MemberDeclaration> getDelegates(final TypeDeclaration it) {
      Iterable<? extends MemberDeclaration> _declaredMembers = it.getDeclaredMembers();
      final Function1<MemberDeclaration, Boolean> _function = new Function1<MemberDeclaration, Boolean>() {
        public Boolean apply(final MemberDeclaration it) {
          Type _findTypeGlobally = Util.this.context.findTypeGlobally(Delegate.class);
          AnnotationReference _findAnnotation = it.findAnnotation(_findTypeGlobally);
          return Boolean.valueOf((_findAnnotation != null));
        }
      };
      return IterableExtensions.filter(_declaredMembers, _function);
View Full Code Here

      };
      return IterableExtensions.filter(_declaredMembers, _function);
    }
   
    public Set<TypeReference> listedInterfaces(final MemberDeclaration it) {
      Type _findTypeGlobally = this.context.findTypeGlobally(Delegate.class);
      AnnotationReference _findAnnotation = it.findAnnotation(_findTypeGlobally);
      TypeReference[] _classArrayValue = _findAnnotation.getClassArrayValue("value");
      return IterableExtensions.<TypeReference>toSet(((Iterable<TypeReference>)Conversions.doWrapArray(_classArrayValue)));
    }
View Full Code Here

      Iterable<Set<? extends TypeReference>> _map = IterableExtensions.map(_declaredSuperTypes, _function);
      Iterable<TypeReference> _flatten = Iterables.<TypeReference>concat(_map);
      Iterable<TypeReference> _plus = Iterables.<TypeReference>concat(Collections.<TypeReference>unmodifiableList(CollectionLiterals.<TypeReference>newArrayList(it)), _flatten);
      final Function1<TypeReference, Boolean> _function_1 = new Function1<TypeReference, Boolean>() {
        public Boolean apply(final TypeReference it) {
          Type _type = it.getType();
          return Boolean.valueOf((_type instanceof InterfaceDeclaration));
        }
      };
      Iterable<TypeReference> _filter = IterableExtensions.<TypeReference>filter(_plus, _function_1);
      return IterableExtensions.<TypeReference>toSet(_filter);
View Full Code Here

TOP

Related Classes of org.eclipse.xtend.lib.macro.declaration.Type

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.