Package com.sun.mirror.declaration

Examples of com.sun.mirror.declaration.ConstructorDeclaration


  @Nonnull
  protected JInvocation createDomainObjectCreationExpression( @Nonnull DomainObjectDescriptor domainObjectDescriptor ) {
    JInvocation invocation = JExpr._new( codeGenerator.ref( domainObjectDescriptor.getQualifiedName() ) );

    ConstructorDeclaration constructor = domainObjectDescriptor.findBestConstructor();
    for ( ParameterDeclaration parameterDeclaration : constructor.getParameters() ) {
      invocation.arg( codeGenerator.getNewInstanceFactory().create( parameterDeclaration.getType(), parameterDeclaration.getSimpleName() ) );
    }

    return invocation;
  }
View Full Code Here


  @NotNull
  protected JInvocation createDomainObjectCreationExpression() {
    JInvocation invocation = JExpr._new( codeGenerator.ref( descriptor.getQualifiedName() ) );

    ConstructorDeclaration constructor = descriptor.findBestConstructor();
    for ( ParameterDeclaration parameterDeclaration : constructor.getParameters() ) {
      invocation.arg( codeGenerator.getNewInstanceFactory().create( parameterDeclaration.getType(), parameterDeclaration.getSimpleName() ) );
    }

    return invocation;
  }
View Full Code Here

  @NotNull
  protected JInvocation createDomainObjectCreationExpression( @NotNull DomainObjectDescriptor domainObjectDescriptor ) {
    JInvocation invocation = JExpr._new( codeGenerator.ref( domainObjectDescriptor.getQualifiedName() ) );

    ConstructorDeclaration constructor = domainObjectDescriptor.findBestConstructor();
    for ( ParameterDeclaration parameterDeclaration : constructor.getParameters() ) {
      invocation.arg( codeGenerator.getNewInstanceFactory().create( parameterDeclaration.getType(), parameterDeclaration.getSimpleName() ) );
    }

    return invocation;
  }
View Full Code Here

    return findConstructorCallInfoForField( fieldDeclaration.getSimpleName(), fieldDeclaration.getType() );
  }

  @NotNull
  public ConstructorCallInfo findConstructorCallInfoForField( @NotNull @NonNls String simpleName, @NotNull TypeMirror type ) throws IllegalArgumentException {
    ConstructorDeclaration constructorDeclaration = TypeUtils.findBestConstructor( classDeclaration );

    int index = 0;

    for ( ParameterDeclaration parameterDeclaration : constructorDeclaration.getParameters() ) {
      if ( parameterDeclaration.getSimpleName().equals( simpleName ) ) {
        //Found a fitting type
        if ( TypeUtils.mightBeConstructorCallFor( parameterDeclaration.getType(), type ) ) {
          return new ConstructorCallInfo( constructorDeclaration, index, parameterDeclaration );
        } else {
View Full Code Here

    return returnBinaryName ? classWithWildcard.binaryName() : classWithWildcard.fullName();
  }

  @NotNull
  public static ConstructorDeclaration findBestConstructor( @NotNull ClassDeclaration classDeclaration ) {
    ConstructorDeclaration currentlyBest = null;
    for ( ConstructorDeclaration constructorDeclaration : classDeclaration.getConstructors() ) {
      if ( currentlyBest == null || constructorDeclaration.getParameters().size() > currentlyBest.getParameters().size() ) {
        currentlyBest = constructorDeclaration;
      }
    }

    if ( currentlyBest == null ) {
View Full Code Here

  @Nonnull
  protected JInvocation createDomainObjectCreationExpression( @Nonnull DomainObjectDescriptor domainObjectDescriptor ) {
    JInvocation invocation = JExpr._new( codeGenerator.ref( domainObjectDescriptor.getQualifiedName() ) );

    ConstructorDeclaration constructor = domainObjectDescriptor.findBestConstructor();
    for ( ParameterDeclaration parameterDeclaration : constructor.getParameters() ) {
      invocation.arg( codeGenerator.getNewInstanceFactory().create( parameterDeclaration.getType(), parameterDeclaration.getSimpleName() ) );
    }

    return invocation;
  }
View Full Code Here

    return findConstructorCallInfoForField( fieldDeclaration.getSimpleName(), fieldDeclaration.getType() );
  }

  @NotNull
  public ConstructorCallInfo findConstructorCallInfoForField( @NotNull @NonNls String simpleName, @NotNull TypeMirror type ) throws IllegalArgumentException {
    ConstructorDeclaration constructorDeclaration = DomainObjectDescriptor.findBestConstructor( classDeclaration );

    int index = 0;

    for ( ParameterDeclaration parameterDeclaration : constructorDeclaration.getParameters() ) {
      if ( parameterDeclaration.getSimpleName().equals( simpleName ) ) {
        //Found a fitting type
        if ( TypeUtils.mightBeConstructorCallFor( parameterDeclaration.getType(), type ) ) {
          return new ConstructorCallInfo( constructorDeclaration, index, parameterDeclaration );
        } else {
View Full Code Here

    return returnBinaryName ? classWithWildcard.binaryName() : classWithWildcard.fullName();
  }

  @Nonnull
  public static ConstructorDeclaration findBestConstructor( @Nonnull ClassDeclaration classDeclaration ) {
    ConstructorDeclaration currentlyBest = null;
    for ( ConstructorDeclaration constructorDeclaration : classDeclaration.getConstructors() ) {
      if ( currentlyBest == null || constructorDeclaration.getParameters().size() > currentlyBest.getParameters().size() ) {
        currentlyBest = constructorDeclaration;
      }
    }

    if ( currentlyBest == null ) {
View Full Code Here

  @NotNull
  protected JInvocation createDomainObjectCreationExpression( @NotNull DomainObjectDescriptor domainObjectDescriptor ) {
    JInvocation invocation = JExpr._new( codeGenerator.ref( domainObjectDescriptor.getQualifiedName() ) );

    ConstructorDeclaration constructor = domainObjectDescriptor.findBestConstructor();
    for ( ParameterDeclaration parameterDeclaration : constructor.getParameters() ) {
      invocation.arg( codeGenerator.getNewInstanceFactory().create( parameterDeclaration.getType(), parameterDeclaration.getSimpleName() ) );
    }

    return invocation;
  }
View Full Code Here

  @NotNull
  protected JInvocation createDomainObjectCreationExpression( @NotNull DomainObjectDescriptor domainObjectDescriptor ) {
    JInvocation invocation = JExpr._new( codeGenerator.ref( domainObjectDescriptor.getQualifiedName() ) );

    ConstructorDeclaration constructor = domainObjectDescriptor.findBestConstructor();
    for ( ParameterDeclaration parameterDeclaration : constructor.getParameters() ) {
      invocation.arg( codeGenerator.getNewInstanceFactory().create( parameterDeclaration.getType(), parameterDeclaration.getSimpleName() ) );
    }

    return invocation;
  }
View Full Code Here

TOP

Related Classes of com.sun.mirror.declaration.ConstructorDeclaration

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.