本文整理汇总了Java中com.fasterxml.jackson.core.Version.unknownVersion方法的典型用法代码示例。如果您正苦于以下问题:Java Version.unknownVersion方法的具体用法?Java Version.unknownVersion怎么用?Java Version.unknownVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.fasterxml.jackson.core.Version
的用法示例。
在下文中一共展示了Version.unknownVersion方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAppStatusList
import com.fasterxml.jackson.core.Version; //导入方法依赖的package包/类
@JsonIgnore
public List<AppStatus> getAppStatusList() {
try {
ObjectMapper mapper = new ObjectMapper();
mapper.addMixIn(AppStatus.class, AppStatusMixin.class);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
SimpleModule module = new SimpleModule("CustomModel", Version.unknownVersion());
SimpleAbstractTypeResolver resolver = new SimpleAbstractTypeResolver();
resolver.addMapping(AppInstanceStatus.class, AppInstanceStatusImpl.class);
module.setAbstractTypes(resolver);
mapper.registerModule(module);
TypeReference<List<AppStatus>> typeRef = new TypeReference<List<AppStatus>>() {
};
if (this.platformStatus != null) {
return mapper.readValue(this.platformStatus, typeRef);
}
return new ArrayList<AppStatus>();
}
catch (Exception e) {
throw new IllegalArgumentException("Could not parse Skipper Platfrom Status JSON:" + platformStatus, e);
}
}
示例2: getDeserializersModule
import com.fasterxml.jackson.core.Version; //导入方法依赖的package包/类
private Module getDeserializersModule(GlobalEnvironment environment) {
return new Module() {
@Override
public String getModuleName() {
return "graphql-spqr-deserializers";
}
@Override
public Version version() {
return Version.unknownVersion();
}
@Override
public void setupModule(SetupContext setupContext) {
setupContext.addDeserializers(new ConvertingDeserializers(environment));
}
};
}
示例3: deserializeAppStatus
import com.fasterxml.jackson.core.Version; //导入方法依赖的package包/类
public static List<AppStatus> deserializeAppStatus(String platformStatus) {
try {
ObjectMapper mapper = new ObjectMapper();
mapper.addMixIn(AppStatus.class, AppStatusMixin.class);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
SimpleModule module = new SimpleModule("CustomModel", Version.unknownVersion());
SimpleAbstractTypeResolver resolver = new SimpleAbstractTypeResolver();
resolver.addMapping(AppInstanceStatus.class, AppInstanceStatusImpl.class);
module.setAbstractTypes(resolver);
mapper.registerModule(module);
TypeReference<List<AppStatus>> typeRef = new TypeReference<List<AppStatus>>() {
};
List<AppStatus> result = mapper.readValue(platformStatus, typeRef);
return result;
}
catch (Exception e) {
throw new IllegalArgumentException("Could not parse Skipper Platform Status JSON:" + platformStatus, e);
}
}
示例4: jsonObjectMapper
import com.fasterxml.jackson.core.Version; //导入方法依赖的package包/类
@Bean
public ObjectMapper jsonObjectMapper() {
final ObjectMapper jsonMapper = new ObjectMapper();
jsonMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
jsonMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
jsonMapper.configure(Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);
jsonMapper.configure(Feature.ALLOW_SINGLE_QUOTES, true);
jsonMapper.configure(MapperFeature.DEFAULT_VIEW_INCLUSION, false);
final SimpleModule module = new SimpleModule("FieldsMapping", Version.unknownVersion());
module.setSerializerModifier(new BeanSerializerModifier() {
@Override
public JsonSerializer<?> modifyMapSerializer(final SerializationConfig config, final MapType valueType,
final BeanDescription beanDesc, final JsonSerializer<?> serializer) {
if (FieldsMap.class.isAssignableFrom(valueType.getRawClass())) {
return new FieldsMapMixInLikeSerializer();
} else {
return super.modifyMapSerializer(config, valueType, beanDesc, serializer);
}
}
});
jsonMapper.registerModule(module);
return jsonMapper;
}
示例5: testEncodeAndDecodeRegisterSerializerDirectlyToModule
import com.fasterxml.jackson.core.Version; //导入方法依赖的package包/类
@Test
public void testEncodeAndDecodeRegisterSerializerDirectlyToModule() {
JsonObjectMapper mapper = new JsonObjectMapper();
// first add serializer then register module
SimpleModule module = new SimpleModule("cemo", Version.unknownVersion());
module.addSerializer(Point.class, new PointSerializer());
mapper.registerModule(module);
transcoder = new JsonTranscoder(mapper);
Point p = new Point(40, 50);
CachedObject co = transcoder.encode(p);
assertNotNull(co);
assertNotNull(co.getData());
assertEquals("{\"v\":\"40x50\"}", new String(co.getData()));
}
示例6: VersionUtil
import com.fasterxml.jackson.core.Version; //导入方法依赖的package包/类
protected VersionUtil()
{
Version v = null;
try {
/* Class we pass only matters for resource-loading: can't use this Class
* (as it's just being loaded at this point), nor anything that depends on it.
*/
v = VersionUtil.versionFor(getClass());
} catch (Exception e) { // not good to dump to stderr; but that's all we have at this low level
System.err.println("ERROR: Failed to load Version information from "+getClass());
}
if (v == null) {
v = Version.unknownVersion();
}
_version = v;
}
示例7: versionFor
import com.fasterxml.jackson.core.Version; //导入方法依赖的package包/类
/**
* Helper method that will try to load version information for specified
* class. Implementation is as follows:
*
* First, tries to load version info from a class named
* "PackageVersion" in the same package as the class.
*
* Next, if that fails, class loader that loaded specified class is
* asked to load resource with name "VERSION" from same location
* (package) as class itself had.
*
* If no version information is found, {@link Version#unknownVersion()} is returned.
*/
@SuppressWarnings("resource")
public static Version versionFor(Class<?> cls)
{
Version packageVersion = packageVersionFor(cls);
if (packageVersion != null) {
return packageVersion;
}
final InputStream in = cls.getResourceAsStream("VERSION.txt");
if (in == null) {
return Version.unknownVersion();
}
try {
InputStreamReader reader = new InputStreamReader(in, "UTF-8");
return doReadVersion(reader);
} catch (UnsupportedEncodingException e) {
return Version.unknownVersion();
} finally {
_close(in);
}
}
示例8: mavenVersionFor
import com.fasterxml.jackson.core.Version; //导入方法依赖的package包/类
/**
* Will attempt to load the maven version for the given groupId and
* artifactId. Maven puts a pom.properties file in
* META-INF/maven/groupId/artifactId, containing the groupId,
* artifactId and version of the library.
*
* @param classLoader the ClassLoader to load the pom.properties file from
* @param groupId the groupId of the library
* @param artifactId the artifactId of the library
* @return The version
*/
@SuppressWarnings("resource")
public static Version mavenVersionFor(ClassLoader classLoader, String groupId, String artifactId)
{
InputStream pomProperties = classLoader.getResourceAsStream("META-INF/maven/"
+ groupId.replaceAll("\\.", "/")+ "/" + artifactId + "/pom.properties");
if (pomProperties != null) {
try {
Properties props = new Properties();
props.load(pomProperties);
String versionStr = props.getProperty("version");
String pomPropertiesArtifactId = props.getProperty("artifactId");
String pomPropertiesGroupId = props.getProperty("groupId");
return parseVersion(versionStr, pomPropertiesGroupId, pomPropertiesArtifactId);
} catch (IOException e) {
// Ignore
} finally {
_close(pomProperties);
}
}
return Version.unknownVersion();
}
示例9: ObjectifyJacksonModule
import com.fasterxml.jackson.core.Version; //导入方法依赖的package包/类
public ObjectifyJacksonModule() {
super( "Objectify", Version.unknownVersion() );
// Objectify Key
addSerializer( Key.class, new KeyStdSerializer() );
addDeserializer( Key.class, new KeyStdDeserializer() );
addKeySerializer( Key.class, new KeyJsonSerializer() );
addKeyDeserializer( Key.class, new KeyStdKeyDeserializer() );
// Objectify Ref
addSerializer( Ref.class, new RefStdSerializer() );
addDeserializer( Ref.class, new RefStdDeserializer() );
addKeySerializer( Ref.class, new RefJsonSerializer() );
addKeyDeserializer( Ref.class, new RefStdKeyDeserializer() );
// Native datastore Key
addSerializer( com.google.appengine.api.datastore.Key.class, new RawKeyStdSerializer() );
addDeserializer( com.google.appengine.api.datastore.Key.class, new RawKeyStdDeserializer() );
addKeySerializer( com.google.appengine.api.datastore.Key.class, new RawKeyJsonSerializer() );
addKeyDeserializer( com.google.appengine.api.datastore.Key.class, new RawKeyStdKeyDeserializer() );
}
示例10: deserialize
import com.fasterxml.jackson.core.Version; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public static Object deserialize(String json, String containerType, @SuppressWarnings("rawtypes") Class cls) throws ApiException {
try{
ObjectMapper mapper = JsonUtil.getJsonMapper();
SimpleModule m = new SimpleModule(PACKAGE_NAME, Version.unknownVersion());
m.addDeserializer(Date.class, new CustomDateDeserializer(new DateDeserializer()));
mapper.registerModule(m);
if("List".equals(containerType)) {
JavaType typeInfo = mapper.getTypeFactory().constructCollectionType(List.class, cls);
List<?> response = (List<?>) mapper.readValue(json, typeInfo);
return response;
}
else if(String.class.equals(cls)) {
return json;
}
else {
return mapper.readValue(json, cls);
}
}
catch (IOException e) {
throw new ApiException(500, e.getMessage());
}
}
示例11: deserialize
import com.fasterxml.jackson.core.Version; //导入方法依赖的package包/类
public static Object deserialize(String json, String containerType, Class cls) throws ApiException {
try{
ObjectMapper mapper = JsonUtil.getJsonMapper();
SimpleModule m = new SimpleModule(PACKAGE_NAME, Version.unknownVersion());
m.addDeserializer(Date.class, new CustomDateDeserializer(new DateDeserializer()));
mapper.registerModule(m);
if("List".equals(containerType)) {
JavaType typeInfo = mapper.getTypeFactory().constructCollectionType(List.class, cls);
List response = (List<?>) mapper.readValue(json, typeInfo);
return response;
}
else if(String.class.equals(cls)) {
return json;
}
else {
return mapper.readValue(json, cls);
}
}
catch (IOException e) {
throw new ApiException(500, e.getMessage());
}
}
示例12: jacksonObjectMapper
import com.fasterxml.jackson.core.Version; //导入方法依赖的package包/类
@Bean
public ObjectMapper jacksonObjectMapper() {
ObjectMapper mapper = new ObjectMapper();
mapper.setVisibility(
mapper.getSerializationConfig().getDefaultVisibilityChecker()
.withFieldVisibility(Visibility.ANY)
.withGetterVisibility(Visibility.NONE)
.withSetterVisibility(Visibility.NONE)
.withCreatorVisibility(Visibility.NONE)
.withIsGetterVisibility(Visibility.NONE));
SimpleModule module = new SimpleModule("bandwidth-on-demand", Version.unknownVersion());
module.addSerializer(new VlanJsonSerializer());
module.addDeserializer(Vlan.class, new VlanJsonDeserializer());
module.addSerializer(new ScheduleTypeJsonSerializer());
module.addDeserializer(ScheduleType.class, new ScheduleTypeJsonDeserializer());
mapper.registerModule(module);
mapper.registerModule(new Hibernate4Module());
mapper.registerModule(new JodaModule());
mapper.registerModule(new Jdk8Module());
mapper.registerModule(new JavaTimeModule());
mapper.registerSubtypes(new NamedType(LocalVirtualPort.class, "LOCAL"));
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
return mapper;
}
示例13: VersionUtil
import com.fasterxml.jackson.core.Version; //导入方法依赖的package包/类
protected VersionUtil()
{
Version v = null;
try {
/* Class we pass only matters for resource-loading: can't use this Class
* (as it's just being loaded at this point), nor anything that depends on it.
*/
v = VersionUtil.versionFor(getClass());
} catch (Exception e) { // not good to dump to stderr; but that's all we have at this low level
System.err.println("ERROR: Failed to load Version information for bundle (via "+getClass().getName()+").");
}
if (v == null) {
v = Version.unknownVersion();
}
_version = v;
}
示例14: parseVersion
import com.fasterxml.jackson.core.Version; //导入方法依赖的package包/类
/**
* Method used by <code>PackageVersion</code> classes to decode version injected by Maven build.
*/
public static Version parseVersion(String s, String groupId, String artifactId)
{
if (s != null && (s = s.trim()).length() > 0) {
String[] parts = V_SEP.split(s);
return new Version(parseVersionPart(parts[0]),
(parts.length > 1) ? parseVersionPart(parts[1]) : 0,
(parts.length > 2) ? parseVersionPart(parts[2]) : 0,
(parts.length > 3) ? parts[3] : null,
groupId, artifactId);
}
return Version.unknownVersion();
}
示例15: RestStringsModule
import com.fasterxml.jackson.core.Version; //导入方法依赖的package包/类
public RestStringsModule()
{
super("RestStringsModule", Version.unknownVersion());
addSerializer(I18NString.class, new StringSerializer());
addSerializer(I18NStrings.class, new StringsSerializer());
addAbstractTypeMapping(I18NString.class, SimpleI18NString.class);
addDeserializer(SimpleI18NString.class, new StringDeserializer());
addDeserializer(I18NStrings.class, new StringsDeserializer());
}