-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve serialization performance in some cases
When we can, we don't escape string name/value. We could also do it on bean property name by escaping the string during the compilation
- Loading branch information
Showing
19 changed files
with
325 additions
and
77 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
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
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
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
51 changes: 51 additions & 0 deletions
51
...n/src/main/java/com/github/nmorel/gwtjackson/client/ser/map/key/BooleanKeySerializer.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,51 @@ | ||
/* | ||
* Copyright 2015 Nicolas Morel | ||
* | ||
* 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. | ||
*/ | ||
|
||
package com.github.nmorel.gwtjackson.client.ser.map.key; | ||
|
||
import javax.annotation.Nonnull; | ||
|
||
import com.github.nmorel.gwtjackson.client.JsonSerializationContext; | ||
|
||
/** | ||
* Default {@link KeySerializer} implementation for {@link Boolean}. | ||
* | ||
* @author Nicolas Morel | ||
*/ | ||
public final class BooleanKeySerializer extends KeySerializer<Boolean> { | ||
|
||
private static final BooleanKeySerializer INSTANCE = new BooleanKeySerializer(); | ||
|
||
/** | ||
* @return an instance of {@link BooleanKeySerializer} | ||
*/ | ||
@SuppressWarnings( "unchecked" ) | ||
public static BooleanKeySerializer getInstance() { | ||
return INSTANCE; | ||
} | ||
|
||
private BooleanKeySerializer() { } | ||
|
||
@Override | ||
public boolean mustBeEscaped( JsonSerializationContext ctx ) { | ||
return false; | ||
} | ||
|
||
@Override | ||
protected String doSerialize( @Nonnull Boolean value, JsonSerializationContext ctx ) { | ||
return value.toString(); | ||
} | ||
} |
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
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
51 changes: 51 additions & 0 deletions
51
...on/src/main/java/com/github/nmorel/gwtjackson/client/ser/map/key/NumberKeySerializer.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,51 @@ | ||
/* | ||
* Copyright 2015 Nicolas Morel | ||
* | ||
* 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. | ||
*/ | ||
|
||
package com.github.nmorel.gwtjackson.client.ser.map.key; | ||
|
||
import javax.annotation.Nonnull; | ||
|
||
import com.github.nmorel.gwtjackson.client.JsonSerializationContext; | ||
|
||
/** | ||
* Default {@link KeySerializer} implementation for {@link Number}. | ||
* | ||
* @author Nicolas Morel | ||
*/ | ||
public final class NumberKeySerializer extends KeySerializer<Number> { | ||
|
||
private static final NumberKeySerializer INSTANCE = new NumberKeySerializer(); | ||
|
||
/** | ||
* @return an instance of {@link NumberKeySerializer} | ||
*/ | ||
@SuppressWarnings( "unchecked" ) | ||
public static NumberKeySerializer getInstance() { | ||
return INSTANCE; | ||
} | ||
|
||
private NumberKeySerializer() { } | ||
|
||
@Override | ||
public boolean mustBeEscaped( JsonSerializationContext ctx ) { | ||
return false; | ||
} | ||
|
||
@Override | ||
protected String doSerialize( @Nonnull Number value, JsonSerializationContext ctx ) { | ||
return value.toString(); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
...kson/src/main/java/com/github/nmorel/gwtjackson/client/ser/map/key/UUIDKeySerializer.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,53 @@ | ||
/* | ||
* Copyright 2015 Nicolas Morel | ||
* | ||
* 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. | ||
*/ | ||
|
||
package com.github.nmorel.gwtjackson.client.ser.map.key; | ||
|
||
import javax.annotation.Nonnull; | ||
|
||
import java.util.UUID; | ||
|
||
import com.github.nmorel.gwtjackson.client.JsonSerializationContext; | ||
|
||
/** | ||
* Default {@link KeySerializer} implementation for {@link UUID}. | ||
* | ||
* @author Nicolas Morel | ||
*/ | ||
public final class UUIDKeySerializer extends KeySerializer<UUID> { | ||
|
||
private static final UUIDKeySerializer INSTANCE = new UUIDKeySerializer(); | ||
|
||
/** | ||
* @return an instance of {@link UUIDKeySerializer} | ||
*/ | ||
@SuppressWarnings( "unchecked" ) | ||
public static UUIDKeySerializer getInstance() { | ||
return INSTANCE; | ||
} | ||
|
||
private UUIDKeySerializer() { } | ||
|
||
@Override | ||
public boolean mustBeEscaped( JsonSerializationContext ctx ) { | ||
return false; | ||
} | ||
|
||
@Override | ||
protected String doSerialize( @Nonnull UUID value, JsonSerializationContext ctx ) { | ||
return value.toString(); | ||
} | ||
} |
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.