次の C# コードと同様の機能を持つ GetAttributeRequest を Java で実装しようとしています。
try
{
  long epochWindowTime = ToEpochTimeInMilliseconds(DateTime.UtcNow.Subtract(this.SQSWindow));
  int numberOfMessages = 0;
   // 1st query to determine the # of Messages available in the queue
   using (AmazonSQSClient client = new AmazonSQSClient(
           this.AWSAccessKey, this.AWSSecretAccessKey,
           ew AmazonSQSConfig() { ServiceURL = this.AWSSQSServiceUrl }))
  {
  // get the NumberOfMessages to optimize how to Receive all of the messages from the queue
     GetQueueAttributesRequest attributesRequest = new GetQueueAttributesRequest();
     attributesRequest.QueueUrl = this.QueueUrl;
     attributesRequest.AttributeName.Add("ApproximateNumberOfMessages");
     numberOfMessages = client.GetQueueAttributes(attributesRequest).GetQueueAttributesResult.ApproximateNumberOfMessages;
  }
Java 実装での私の試みは次のようになります。
try
{
    long epochWindowTime;
    int numberOfMessages = 0;
    Map<String, String> attributes;
    // Setup the SQS client
    AmazonSQS client = new AmazonSQSClient(new 
            ClasspathPropertiesFileCredentialsProvider());
    client.setEndpoint(this.AWSSQSServiceUrl);
    // get the NumberOfMessages to optimize how to 
    // Receive all of the messages from the queue
    GetQueueAttributesRequest attributesRequest = 
            new GetQueueAttributesRequest();
    attributesRequest.setQueueUrl(this.QueueUrl);
    //attributesRequest.setAttributeNames();
    attributes = client.getQueueAttributes(attributesRequest).
            getAttributes();
    numberOfMessages = Integer.valueOf(attributes.get(
            "ApproximateNumberOfMessages")).intValue();
}catch (AmazonServiceException ase){
    ase.printStackTrace();
}catch (AmazonClientException ace) {
    ace.printStackTrace();
}
属性名を追加する Java AmazonSQS 実装には Collection が必要なため、「ApproximateNumberOfMessages」を適切に追加する方法がわかりません。
また、より良い代替手段があるかどうかも知りたいです
new AmazonSQSClient(new ClasspathPropertiesFileCredentialsProvider());
それは C# の実装に近いですか? これは、このメソッドが SDK の一部として使用されることを意図しており、AWSAccessKey と AWSSecretAccessKey が別の構成ファイルの一部になるためです。独自の AWSCredentialsProvider を作成する唯一のオプションですか?