-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Added @JsonIgnore to getLogger in JsonSerializable #5951
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,7 @@ | |
|
|
||
| import com.azure.data.cosmos.internal.Strings; | ||
| import com.azure.data.cosmos.internal.Utils; | ||
| import com.fasterxml.jackson.annotation.JsonIgnore; | ||
| import com.fasterxml.jackson.core.JsonProcessingException; | ||
| import com.fasterxml.jackson.databind.JsonNode; | ||
| import com.fasterxml.jackson.databind.ObjectMapper; | ||
|
|
@@ -32,14 +33,14 @@ public class JsonSerializable { | |
| private final static ObjectMapper OBJECT_MAPPER = Utils.getSimpleObjectMapper(); | ||
| private ObjectMapper om; | ||
| transient ObjectNode propertyBag = null; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please refrain from making unrelated formatting changes, you can configure intellij to stop doing this automatically
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I really wanted to, but couldn't stop it. :( |
||
|
|
||
| protected JsonSerializable() { | ||
| this.propertyBag = OBJECT_MAPPER.createObjectNode(); | ||
| } | ||
|
|
||
| /** | ||
| * Constructor. | ||
| * | ||
| * | ||
| * @param jsonString the json string that represents the JsonSerializable. | ||
| * @param objectMapper the custom object mapper | ||
| */ | ||
|
|
@@ -48,10 +49,10 @@ protected JsonSerializable() { | |
| this.propertyBag = fromJson(jsonString); | ||
| this.om = objectMapper; | ||
| } | ||
|
|
||
| /** | ||
| * Constructor. | ||
| * | ||
| * | ||
| * @param jsonString the json string that represents the JsonSerializable. | ||
| */ | ||
| protected JsonSerializable(String jsonString) { | ||
|
|
@@ -76,7 +77,7 @@ private ObjectMapper getMapper() { | |
| void setMapper(ObjectMapper om) { | ||
| this.om = om; | ||
| } | ||
|
|
||
| private static void checkForValidPOJO(Class<?> c) { | ||
| if (c.isAnonymousClass() || c.isLocalClass()) { | ||
| throw new IllegalArgumentException( | ||
|
|
@@ -88,6 +89,7 @@ private static void checkForValidPOJO(Class<?> c) { | |
| } | ||
| } | ||
|
|
||
| @JsonIgnore | ||
| public Logger getLogger() { | ||
| return logger; | ||
| } | ||
|
|
@@ -106,7 +108,7 @@ public Map<String, Object> getMap() { | |
|
|
||
| /** | ||
| * Checks whether a property exists. | ||
| * | ||
| * | ||
| * @param propertyName the property to look up. | ||
| * @return true if the property exists. | ||
| */ | ||
|
|
@@ -116,7 +118,7 @@ public boolean has(String propertyName) { | |
|
|
||
| /** | ||
| * Removes a value by propertyName. | ||
| * | ||
| * | ||
| * @param propertyName the property to remove. | ||
| */ | ||
| void remove(String propertyName) { | ||
|
|
@@ -125,7 +127,7 @@ void remove(String propertyName) { | |
|
|
||
| /** | ||
| * Sets the value of a property. | ||
| * | ||
| * | ||
| * @param <T> the type of the object. | ||
| * @param propertyName the property to set. | ||
| * @param value the value of the property. | ||
|
|
@@ -183,7 +185,7 @@ private <T> void internalSetCollection(String propertyName, Collection<T> collec | |
|
|
||
| /** | ||
| * Gets a property value as Object. | ||
| * | ||
| * | ||
| * @param propertyName the property to get. | ||
| * @return the value of the property. | ||
| */ | ||
|
|
@@ -194,10 +196,10 @@ public Object get(String propertyName) { | |
| return null; | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Gets a string value. | ||
| * | ||
| * | ||
| * @param propertyName the property to get. | ||
| * @return the string value. | ||
| */ | ||
|
|
@@ -211,7 +213,7 @@ public String getString(String propertyName) { | |
|
|
||
| /** | ||
| * Gets a boolean value. | ||
| * | ||
| * | ||
| * @param propertyName the property to get. | ||
| * @return the boolean value. | ||
| */ | ||
|
|
@@ -225,7 +227,7 @@ public Boolean getBoolean(String propertyName) { | |
|
|
||
| /** | ||
| * Gets an integer value. | ||
| * | ||
| * | ||
| * @param propertyName the property to get. | ||
| * @return the boolean value | ||
| */ | ||
|
|
@@ -239,7 +241,7 @@ public Integer getInt(String propertyName) { | |
|
|
||
| /** | ||
| * Gets a long value. | ||
| * | ||
| * | ||
| * @param propertyName the property to get. | ||
| * @return the long value | ||
| */ | ||
|
|
@@ -253,7 +255,7 @@ public Long getLong(String propertyName) { | |
|
|
||
| /** | ||
| * Gets a double value. | ||
| * | ||
| * | ||
| * @param propertyName the property to get. | ||
| * @return the double value. | ||
| */ | ||
|
|
@@ -267,7 +269,7 @@ public Double getDouble(String propertyName) { | |
|
|
||
| /** | ||
| * Gets an object value. | ||
| * | ||
| * | ||
| * @param <T> the type of the object. | ||
| * @param propertyName the property to get. | ||
| * @param c the class of the object. If c is a POJO class, it must be a member (and not an anonymous or local) | ||
|
|
@@ -390,7 +392,7 @@ public <T> List<T> getList(String propertyName, Class<T> c, boolean ... convertF | |
|
|
||
| /** | ||
| * Gets an object collection. | ||
| * | ||
| * | ||
| * @param <T> the type of the objects in the collection. | ||
| * @param propertyName the property to get | ||
| * @param c the class of the object. If c is a POJO class, it must be a member (and not an anonymous or local) | ||
|
|
@@ -405,7 +407,7 @@ public <T> Collection<T> getCollection(String propertyName, Class<T> c, boolean | |
|
|
||
| /** | ||
| * Gets a JSONObject. | ||
| * | ||
| * | ||
| * @param propertyName the property to get. | ||
| * @return the JSONObject. | ||
| */ | ||
|
|
@@ -419,7 +421,7 @@ ObjectNode getObject(String propertyName) { | |
|
|
||
| /** | ||
| * Gets a JSONObject collection. | ||
| * | ||
| * | ||
| * @param propertyName the property to get. | ||
| * @return the JSONObject collection. | ||
| */ | ||
|
|
@@ -433,12 +435,12 @@ Collection<ObjectNode> getCollection(String propertyName) { | |
| } | ||
| } | ||
|
|
||
| return result; | ||
| return result; | ||
| } | ||
|
|
||
| /** | ||
| * Gets the value of a property identified by an array of property names that forms the path. | ||
| * | ||
| * | ||
| * @param propertyNames that form the path to the property to get. | ||
| * @return the value of the property. | ||
| */ | ||
|
|
@@ -462,12 +464,12 @@ public Object getObjectByPath(List<String> propertyNames) { | |
| break; | ||
| } | ||
| } while (iterator.hasNext()); | ||
|
|
||
| if (value != null && matchedProperties == propertyNames.size()) { | ||
| return getValue(value); | ||
| } | ||
| } | ||
|
|
||
| return null; | ||
| } | ||
|
|
||
|
|
@@ -517,7 +519,7 @@ private String toPrettyJson(Object object){ | |
|
|
||
| /** | ||
| * Converts to an Object (only POJOs and JSONObject are supported). | ||
| * | ||
| * | ||
| * @param <T> the type of the object. | ||
| * @param c the class of the object, either a POJO class or JSONObject. If c is a POJO class, it must be a member | ||
| * (and not an anonymous or local) and a static one. | ||
|
|
@@ -547,16 +549,16 @@ public <T> T toObject(Class<T> c) { | |
|
|
||
| /** | ||
| * Converts to a JSON string. | ||
| * | ||
| * | ||
| * @return the JSON string. | ||
| */ | ||
| public String toJson() { | ||
| return this.toJson(SerializationFormattingPolicy.NONE); | ||
| } | ||
|
|
||
| /** | ||
| * Converts to a JSON string. | ||
| * | ||
| * | ||
| * @param formattingPolicy the formatting policy to be used. | ||
| * @return the JSON string. | ||
| */ | ||
|
|
@@ -571,10 +573,10 @@ public String toJson(SerializationFormattingPolicy formattingPolicy) { | |
|
|
||
| /** | ||
| * Gets Simple STRING representation of property bag. | ||
| * | ||
| * For proper conversion to json and inclusion of the default values | ||
| * | ||
| * For proper conversion to json and inclusion of the default values | ||
| * use {@link #toJson()}. | ||
| * | ||
| * | ||
| * @return string representation of property bag. | ||
| */ | ||
| public String toString() { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to double check - 3.4.0 was just a snapshot right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not anymore.
The practice has been changed to update the versions to next to be released version.