-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2b19a12
commit de211e2
Showing
2 changed files
with
83 additions
and
19 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
guava/src/main/java/com/fasterxml/jackson/datatype/guava/deser/util/RangeHelper.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,45 @@ | ||
package com.fasterxml.jackson.datatype.guava.deser.util; | ||
|
||
import com.fasterxml.jackson.databind.PropertyNamingStrategy; | ||
import com.fasterxml.jackson.databind.cfg.MapperConfig; | ||
|
||
/** | ||
* @since 2.10 | ||
*/ | ||
public class RangeHelper | ||
{ | ||
public static class RangeProperties implements java.io.Serializable | ||
{ | ||
private static final long serialVersionUID = 2L; | ||
|
||
public final String lowerEndpoint, upperEndpoint; | ||
public final String lowerBoundType, upperBoundType; | ||
|
||
public RangeProperties(String lowerEP, String upperEP, | ||
String lowerBT, String upperBT) { | ||
lowerEndpoint = lowerEP; | ||
upperEndpoint = upperEP; | ||
lowerBoundType = lowerBT; | ||
upperBoundType = upperBT; | ||
} | ||
} | ||
|
||
private final static RangeProperties STD_NAMES = getPropertyNames(null, null); | ||
|
||
public static RangeProperties standardNames() { | ||
return STD_NAMES; | ||
} | ||
|
||
public static RangeProperties getPropertyNames(MapperConfig<?> config, PropertyNamingStrategy pns) { | ||
return new RangeProperties( | ||
_find(config, pns, "lowerEndpoint"), | ||
_find(config, pns, "upperEndpoint"), | ||
_find(config, pns, "lowerBoundType"), | ||
_find(config, pns, "upperBoundType") | ||
); | ||
} | ||
|
||
private static String _find(MapperConfig<?> config, PropertyNamingStrategy pns, String origName) { | ||
return (pns == null) ? origName : pns.nameForField(config, null, origName); | ||
} | ||
} |
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