Skip to content

Commit a7daa67

Browse files
committed
JAVA-925: Deprecate more methods in AggregationOutput. The only undeprecated method is the one to get the results.
1 parent b9e793e commit a7daa67

File tree

1 file changed

+26
-14
lines changed

1 file changed

+26
-14
lines changed

src/main/com/mongodb/AggregationOutput.java

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,54 +16,66 @@
1616

1717
package com.mongodb;
1818

19+
@SuppressWarnings("deprecation")
1920
public class AggregationOutput {
2021

2122
/**
2223
* returns an iterator to the results of the aggregation
23-
* @return
24+
* @return the results of the aggregation
2425
*/
2526
public Iterable<DBObject> results() {
2627
return _resultSet;
2728
}
2829

2930
/**
3031
* returns the command result of the aggregation
31-
* @return
32+
* @return the command result
33+
*
34+
* @deprecated there is no replacement for this method
3235
*/
36+
@Deprecated
3337
public CommandResult getCommandResult(){
3438
return _commandResult;
3539
}
3640

3741
/**
3842
* returns the original aggregation command
39-
* @return
43+
* @return the command
44+
*
45+
* @deprecated there is no replacement for this method
4046
*/
47+
@Deprecated
4148
public DBObject getCommand() {
4249
return _cmd;
4350
}
4451

4552
/**
4653
* returns the address of the server used to execute the aggregation
47-
* @return
54+
* @return the server which executed the aggregation
55+
*
56+
* @deprecated there is no replacement for this method
4857
*/
58+
@Deprecated
4959
public ServerAddress getServerUsed() {
5060
return _commandResult.getServerUsed();
5161
}
5262

5363
/**
54-
* string representation of the aggregation command
64+
* Constructs a new instance
65+
*
66+
* @param command the aggregation command
67+
* @param commandResult the aggregation command result
68+
*
69+
* @deprecated there is no replacement for this constructor
5570
*/
56-
public String toString(){
57-
return _commandResult.toString();
58-
}
59-
6071
@SuppressWarnings("unchecked")
61-
public AggregationOutput(DBObject cmd, CommandResult raw) {
62-
_commandResult = raw;
63-
_cmd = cmd;
72+
@Deprecated
73+
public AggregationOutput(DBObject command, CommandResult commandResult) {
74+
_commandResult = commandResult;
75+
_cmd = command;
6476

65-
if(raw.containsField("result"))
66-
_resultSet = (Iterable<DBObject>) raw.get( "result" );
77+
if(commandResult.containsField("result"))
78+
_resultSet = (Iterable<DBObject>) commandResult.get( "result" );
6779
else
6880
throw new IllegalArgumentException("result undefined");
6981
}

0 commit comments

Comments
 (0)