OrderRequest.java: add toString()
This commit is contained in:
@ -9,10 +9,15 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|||||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||||
import com.fasterxml.jackson.datatype.joda.JodaModule;
|
import com.fasterxml.jackson.datatype.joda.JodaModule;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for order requests to send to the OANDA API.
|
* Base class for order requests to send to the OANDA API.
|
||||||
*/
|
*/
|
||||||
public class OrderRequest {
|
public class OrderRequest {
|
||||||
|
final Logger log = LoggerFactory.getLogger(OrderRequest.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of the Order to Create.
|
* The type of the Order to Create.
|
||||||
*/
|
*/
|
||||||
@ -51,4 +56,17 @@ public class OrderRequest {
|
|||||||
mapper.setSerializationInclusion(Include.NON_NULL);
|
mapper.setSerializationInclusion(Include.NON_NULL);
|
||||||
return mapper;
|
return mapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a better description of the order.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
try {
|
||||||
|
return toJSON();
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
log.warn("Error converting to JSON", e);
|
||||||
|
return super.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user