-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update definitions.json * add NetworkId wrapper class, and add NetworkId as an Optional field in all Transactions. * add network_id to ServerInfo * remove old codec fields from data-driven-tests.json * pr feedback
- Loading branch information
Showing
27 changed files
with
1,569 additions
and
562 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/jackson/modules/NetworkIdDeserializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package org.xrpl.xrpl4j.model.jackson.modules; | ||
|
||
/*- | ||
* ========================LICENSE_START================================= | ||
* xrpl4j :: core | ||
* %% | ||
* Copyright (C) 2020 - 2023 XRPL Foundation and its contributors | ||
* %% | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* =========================LICENSE_END================================== | ||
*/ | ||
|
||
import com.fasterxml.jackson.core.JsonParser; | ||
import com.fasterxml.jackson.databind.DeserializationContext; | ||
import com.fasterxml.jackson.databind.deser.std.StdDeserializer; | ||
import com.google.common.primitives.UnsignedInteger; | ||
import org.xrpl.xrpl4j.model.transactions.NetworkId; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* Custom Jackson deserializer for {@link NetworkId}s. | ||
*/ | ||
public class NetworkIdDeserializer extends StdDeserializer<NetworkId> { | ||
|
||
/** | ||
* No-args constructor. | ||
*/ | ||
public NetworkIdDeserializer() { | ||
super(NetworkId.class); | ||
} | ||
|
||
@Override | ||
public NetworkId deserialize(JsonParser jsonParser, DeserializationContext ctxt) throws IOException { | ||
return NetworkId.of(UnsignedInteger.valueOf(jsonParser.getValueAsLong())); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/jackson/modules/NetworkIdSerializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package org.xrpl.xrpl4j.model.jackson.modules; | ||
|
||
/*- | ||
* ========================LICENSE_START================================= | ||
* xrpl4j :: core | ||
* %% | ||
* Copyright (C) 2020 - 2023 XRPL Foundation and its contributors | ||
* %% | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* =========================LICENSE_END================================== | ||
*/ | ||
|
||
import com.fasterxml.jackson.core.JsonGenerator; | ||
import com.fasterxml.jackson.databind.SerializerProvider; | ||
import com.fasterxml.jackson.databind.ser.std.StdScalarSerializer; | ||
import org.xrpl.xrpl4j.model.transactions.NetworkId; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* Custom Jackson serializer for {@link NetworkId}s. | ||
*/ | ||
public class NetworkIdSerializer extends StdScalarSerializer<NetworkId> { | ||
|
||
/** | ||
* No-args constructor. | ||
*/ | ||
public NetworkIdSerializer() { | ||
super(NetworkId.class); | ||
} | ||
|
||
@Override | ||
public void serialize(NetworkId networkId, JsonGenerator gen, SerializerProvider provider) throws IOException { | ||
gen.writeNumber(networkId.value().longValue()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.