当前位置: 首页>>代码示例>>Java>>正文


Java Version类代码示例

本文整理汇总了Java中com.fasterxml.jackson.core.Version的典型用法代码示例。如果您正苦于以下问题:Java Version类的具体用法?Java Version怎么用?Java Version使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Version类属于com.fasterxml.jackson.core包,在下文中一共展示了Version类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configObjectMapper

import com.fasterxml.jackson.core.Version; //导入依赖的package包/类
@Autowired
public void configObjectMapper(ObjectMapper objectMapper) {
    AggregationDeserializer deserializer = new AggregationDeserializer();
    deserializer.register("sterms", TermsAggregation.class);
    deserializer.register("histogram", HistogramAggregation.class);
    deserializer.register("date_histogram", DateHistogramAggregation.class);
    deserializer.register("avg", SingleValueMetricsAggregation.class);
    deserializer.register("sum", SingleValueMetricsAggregation.class);
    deserializer.register("max", SingleValueMetricsAggregation.class);
    deserializer.register("min", SingleValueMetricsAggregation.class);
    deserializer.register("cardinality", SingleValueMetricsAggregation.class);
    deserializer.register("value_count", SingleValueMetricsAggregation.class);


    SimpleModule module = new SimpleModule("AggregationDeserializer",
            new Version(1, 0, 0, null, "eu.luminis.elastic", "aggregation-elastic"));
    module.addDeserializer(Aggregation.class, deserializer);
    module.addKeyDeserializer(String.class, new AggregationKeyDeserializer());

    objectMapper.registerModule(module);
}
 
开发者ID:luminis-ams,项目名称:elastic-rest-spring-wrapper,代码行数:22,代码来源:RestClientConfig.java

示例2: 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);
	}
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-skipper,代码行数:23,代码来源:Status.java

示例3: createJacksonModule

import com.fasterxml.jackson.core.Version; //导入依赖的package包/类
/**
 * Creates Crnk Jackson module with all required serializers.<br />
 * Adds the {@link LinksInformationSerializer} if <code>serializeLinksAsObjects</code> is set to <code>true</code>.
 *
 * @param serializeLinksAsObjects flag which decides whether the {@link LinksInformationSerializer} should be added as
 * additional serializer or not.
 *
 * @return {@link com.fasterxml.jackson.databind.Module} with custom serializers
 */
public static SimpleModule createJacksonModule(boolean serializeLinksAsObjects) {
	SimpleModule simpleModule = new SimpleModule(JSON_API_JACKSON_MODULE_NAME,
			new Version(1, 0, 0, null, null, null));
	simpleModule.addSerializer(new ErrorDataSerializer());
	simpleModule.addDeserializer(ErrorData.class, new ErrorDataDeserializer());
	if (serializeLinksAsObjects) {
		simpleModule.addSerializer(new LinksInformationSerializer());
	}
	return simpleModule;
}
 
开发者ID:crnk-project,项目名称:crnk-framework,代码行数:20,代码来源:JacksonModule.java

示例4: getEditorOptions

import com.fasterxml.jackson.core.Version; //导入依赖的package包/类
private ObjectExpression getEditorOptions(HtmlEditorConfiguration config)
{
	final String options = config.getEditorOptions();
	if( options == null || options.trim().length() == 0 )
	{
		return null;
	}

	try
	{
		final ObjectMapper jsonMapper = objectMapperService.createObjectMapper(LenientMapperExtension.NAME);
		final SimpleModule module = new SimpleModule("equella", new Version(1, 0, 0, null));
		module.addDeserializer(ObjectExpression.class, new ObjectExpressionDeserialiser());
		jsonMapper.registerModule(module);
		final ObjectExpression obj = jsonMapper.readValue(options, ObjectExpression.class);
		return obj; // NOSONAR (kept local variable for readability)
	}
	catch( IOException io )
	{
		// Invalid editor options. Should never have happened.
		LOGGER.error("Invalid HTML editor options", io);
		return null;
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:25,代码来源:TinyMceServiceImpl.java

示例5: extendMapper

import com.fasterxml.jackson.core.Version; //导入依赖的package包/类
@Override
public void extendMapper(ObjectMapper mapper)
{
	SimpleModule restModule = new SimpleModule("RestModule", new Version(1, 0, 0, null));
	// TODO this probably should be somewhere else, but it can't be in
	// com.tle.core.jackson
	// as that would make it dependent on equella i18n
	restModule.addSerializer(new I18NSerializer());
	mapper.registerModule(restModule);
	mapper.registerModule(new JavaTypesModule());

	mapper.registerModule(new RestStringsModule());
	mapper.setSerializationInclusion(Include.NON_NULL);

	// dev mode!
	if( DebugSettings.isDebuggingMode() )
	{
		mapper.configure(SerializationFeature.INDENT_OUTPUT, true);
	}
	mapper.setDateFormat(new ISO8061DateFormatWithTZ());

}
 
开发者ID:equella,项目名称:Equella,代码行数:23,代码来源:RestEasyServlet.java

示例6: ZefiroModule

import com.fasterxml.jackson.core.Version; //导入依赖的package包/类
public ZefiroModule() {
	super("ZefiroModule", new Version(majorVersion, minorVersion, patchLevel, null, "it.makeit.zefiro",
	        "jersey-module-zefiro"));

	addSerializer(new ObjectTypeSerializer());
	addSerializer(new DocumentSerializer());
	addSerializer(new PropertySerializer());
	addSerializer(new RelationshipSerializer());

	// PropertyDefinition
	addSerializer(new PropertyDefinitionSerializer());
	addSerializer(new PropertyDecimalDefinitionSerializer());
	addSerializer(new PropertyIntegerDefinitionSerializer());
	addSerializer(new PropertyStringDefinitionSerializer());
	
	addDeserializer(DocumentPropertyBean.class, new DocumentPropertyDeserializer());
}
 
开发者ID:MakeITBologna,项目名称:zefiro,代码行数:18,代码来源:ZefiroModule.java

示例7: JacksonObjectMapperConfig

import com.fasterxml.jackson.core.Version; //导入依赖的package包/类
public JacksonObjectMapperConfig() {
	super();
	
	this.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);		
	//this.configure(SerializationFeature.WRITE_NULL_MAP_VALUES, false); 不增加,避免key值为null,而避免节点消失
	this.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
	this.configure(Feature.ALLOW_UNQUOTED_CONTROL_CHARS, true); 
	
	//this.setSerializationInclusion(Include.NON_EMPTY); //对象转字符串时,只转化非空字段 zjs 需要占位
	
	//SimpleModule module = new SimpleModule();
       SimpleModule module = new SimpleModule("HTML XSS Serializer",
               new Version(1, 0, 0, "FINAL", "com.simbest", "ep-jsonmodule"));
       module.addSerializer(new JsonHtmlXssSerializer(String.class));
       module.addDeserializer(Date.class, new CustomJsonDateDeseralizer());
       // Add more here ...
       registerModule(module);
}
 
开发者ID:simbest,项目名称:simbest-cores,代码行数:19,代码来源:JacksonObjectMapperConfig.java

示例8: 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));
        }
    };
}
 
开发者ID:leangen,项目名称:graphql-spqr,代码行数:19,代码来源:JacksonValueMapperFactory.java

示例9: newInstance

import com.fasterxml.jackson.core.Version; //导入依赖的package包/类
public static ObjectMapper newInstance() {
	ObjectMapper mapper = new ObjectMapper();
	//mapper.setSerializationInclusion(Inclusion.ALWAYS);
	//mapper.configure(SerializationConfig.Feature.WRITE_NULL_MAP_VALUES, false);
	//mapper.getSerializerProvider().setNullValueSerializer(new NullValueSerializer());
	
	/*Json反序列化时忽略多余的属性*/
	mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
	
	SimpleModule module = new SimpleModule("JsonUtil", new Version(1, 0, 0, null));
	//JavaObject to JSONString
	module.addSerializer(new ToJsonLongSerializer());
	module.addSerializer(new ToJsonSqlTimestampSerializer(DEFAULT_DATETIME_PATTERN));
	module.addSerializer(new ToJsonDateSerializer(DEFAULT_DATETIME_PATTERN));
	module.addSerializer(new ToJsonStringSerializer());
	//JSONString to JavaObject
	module.addDeserializer(Date.class, new CustomDateDeSerializer(Date.class,DEFAULT_FORMATS));
	module.addDeserializer(Timestamp.class, (JsonDeserializer)new CustomSqlTimestampDeSerializer(Timestamp.class,DEFAULT_FORMATS));
	module.addDeserializer(java.sql.Date.class,(JsonDeserializer)new CustomSqlDateDeSerializer(java.sql.Date.class, DEFAULT_FORMATS));
	
	mapper.registerModule(module);
	return mapper;
}
 
开发者ID:thinking-github,项目名称:nbone,代码行数:24,代码来源:JsonUtils.java

示例10: init

import com.fasterxml.jackson.core.Version; //导入依赖的package包/类
/**
 * Private method to register the custom serializers and deserializers
 */
private void init() {
    this.objectMapper = new ObjectMapper();
    SimpleModule module = new SimpleModule("UserProfileService",
            new Version(1, 0, 0, null, null, null));

    module.addSerializer(UserProfile.class, new UserProfileSerializer());
    module.addDeserializer(UserProfile.class, new UserProfileDeserializer());

    module.addSerializer(Publication.class, new PublicationSerializer());
    module.addDeserializer(Publication.class, new PublicationDeserializer());

    module.addSerializer(Institution.class, new InstitutionSerializer());
    module.addDeserializer(Institution.class, new InstitutionDeserializer());

    objectMapper.registerModule(module);
}
 
开发者ID:SciGaP,项目名称:allocateme,代码行数:20,代码来源:ModelConversionHelper.java

示例11: createMapper

import com.fasterxml.jackson.core.Version; //导入依赖的package包/类
public static ObjectMapper createMapper() {
        ObjectMapper mapper = new ObjectMapper();
//        mapper.configure(AUTO_DETECT_GETTERS, false);
//        mapper.configure(AUTO_DETECT_SETTERS, false);
//        mapper.setDeserializationConfig(mapper.getDeserializationConfig().without(FAIL_ON_UNKNOWN_PROPERTIES));
//        mapper.setSerializationConfig(mapper.getSerializationConfig().withSerializationInclusion(NON_DEFAULT));
//        mapper.setVisibilityChecker(Std.defaultInstance().withFieldVisibility(ANY));
// 
        mapper.registerModule(new SimpleModule("jersey", new Version(1, 0, 0, null,null,null)) //
                        .addSerializer(_id, _idSerializer()) //
                        .addDeserializer(_id, _idDeserializer()));
        mapper.registerModule(new JSR353Module());
        mapper.registerModule(new JsonOrgModule());
        
        return mapper;
    }
 
开发者ID:denkbar,项目名称:step,代码行数:17,代码来源:JacksonMapperProvider.java

示例12: getDefaultObjectMapper

import com.fasterxml.jackson.core.Version; //导入依赖的package包/类
/**
 * Generates an {@link ObjectMapper} to serialize and deserialize JSON.
 *
 * @return The generated {@link ObjectMapper}.
 */
@Bean
public ObjectMapper getDefaultObjectMapper() {
	final ObjectMapper mapper = new ObjectMapper();

	final SimpleModule module = new SimpleModule("AnalysisSerializers", new Version(1, 0, 0, null, null, null));

	// Add custom serializer & deserializer for AnalyzerType so that we can retrieve the correct singleton instance from spring
	module.addSerializer(AnalyzerType.class, new AnalyzerTypeSerializer());
	module.addDeserializer(AnalyzerType.class, new AnalyzerTypeDeserializer());

	// Add custom serializer & deserializer for Analyzer so that we can save the parameter values used to create the analyzer
	module.addSerializer(Analyzer.class, new AnalyzerSerializer());
	module.addDeserializer(Analyzer.class, new AnalyzerDeserializer());
	mapper.registerModule(module);

	// Save type information in JSON when declared type is object so it is deserialized correctly
	// Used because AnalyzerSpec has a map of string to object for saved parameter values
	mapper.enableDefaultTyping(ObjectMapper.DefaultTyping.JAVA_LANG_OBJECT);

	return mapper;
}
 
开发者ID:mizitch,项目名称:story-inspector,代码行数:27,代码来源:JsonMappingSpringConfig.java

示例13: 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);
	}
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-dataflow,代码行数:20,代码来源:SkipperStreamDeployer.java

示例14: afterPropertiesSet

import com.fasterxml.jackson.core.Version; //导入依赖的package包/类
/**
 * JAVADOC Method Level Comments
 *
 * @throws Exception JAVADOC.
 */
@SuppressWarnings({"rawtypes", "unchecked"})
@Override
public void afterPropertiesSet()
    throws Exception {
    //Set up 
    SimpleModule module = new SimpleModule("user",
            new Version(1, 0, 0, "User serializer/deserializer", null, null));

    if (CollectionUtils.isNotEmpty(serialisers)) {
        for (JsonSerializer<?> serialiser : serialisers) {
            module.addSerializer(serialiser);
        }
    }

    if (MapUtils.isNotEmpty(deserialisers)) {
        for (Map.Entry<Class, JsonDeserializer> deserialiserEntry : deserialisers.entrySet()) {
            module.addDeserializer(deserialiserEntry.getKey(), deserialiserEntry.getValue());
        }
    }

    mapper.registerModule(module);
}
 
开发者ID:cucina,项目名称:opencucina,代码行数:28,代码来源:JacksonMarshaller.java

示例15: shouldUpdateInstanceWithCustomModule

import com.fasterxml.jackson.core.Version; //导入依赖的package包/类
@Test
public void shouldUpdateInstanceWithCustomModule() throws Exception {
    // Given
    final JsonSerializer<String> serialiser = mock(JsonSerializer.class);
    TestCustomJsonModules1.modules = Collections.singletonList(
            new SimpleModule("module1", new Version(1, 0, 0, null, null, null))
                    .addSerializer(String.class, serialiser)
    );
    System.setProperty(JSONSerialiser.JSON_SERIALISER_MODULES, TestCustomJsonModules1.class.getName());

    // When
    JSONSerialiser.update();

    // Then
    assertEquals(JSONSerialiser.class, JSONSerialiser.getInstance().getClass());
    JSONSerialiser.serialise("test");
    verify(serialiser).serialize(Mockito.eq("test"), Mockito.any(), Mockito.any());
}
 
开发者ID:gchq,项目名称:Gaffer,代码行数:19,代码来源:JSONSerialiserTest.java


注:本文中的com.fasterxml.jackson.core.Version类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。