當前位置: 首頁>>代碼示例>>Java>>正文


Java Version類代碼示例

本文整理匯總了Java中org.codehaus.jackson.Version的典型用法代碼示例。如果您正苦於以下問題:Java Version類的具體用法?Java Version怎麽用?Java Version使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Version類屬於org.codehaus.jackson包,在下文中一共展示了Version類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: read

import org.codehaus.jackson.Version; //導入依賴的package包/類
private void read(DataInput in) throws IOException {
  ObjectMapper mapper = new ObjectMapper();
  mapper.configure(
      DeserializationConfig.Feature.CAN_OVERRIDE_ACCESS_MODIFIERS, true);
  
  // define a module
  SimpleModule module = new SimpleModule("State Serializer",  
      new Version(0, 1, 1, "FINAL"));
  // add the state deserializer
  module.addDeserializer(StatePair.class, new StateDeserializer());

  // register the module with the object-mapper
  mapper.registerModule(module);

  JsonParser parser = 
    mapper.getJsonFactory().createJsonParser((DataInputStream)in);
  StatePool statePool = mapper.readValue(parser, StatePool.class);
  this.setStates(statePool.getStates());
  parser.close();
}
 
開發者ID:Nextzero,項目名稱:hadoop-2.6.0-cdh5.4.3,代碼行數:21,代碼來源:StatePool.java

示例2: JsonObjectMapperWriter

import org.codehaus.jackson.Version; //導入依賴的package包/類
public JsonObjectMapperWriter(OutputStream output, boolean prettyPrint) throws IOException {
  ObjectMapper mapper = new ObjectMapper();
  mapper.configure(
      SerializationConfig.Feature.CAN_OVERRIDE_ACCESS_MODIFIERS, true);

  // define a module
  SimpleModule module = new SimpleModule("Default Serializer",  
                                         new Version(0, 1, 1, "FINAL"));
  // add various serializers to the module
  //   add default (all-pass) serializer for all rumen specific data types
  module.addSerializer(DataType.class, new DefaultRumenSerializer());
  //   add a serializer to use object.toString() while serializing
  module.addSerializer(ID.class, new ObjectStringSerializer<ID>());
  
  // register the module with the object-mapper
  mapper.registerModule(module);

  mapper.getJsonFactory();
  writer = mapper.getJsonFactory().createJsonGenerator(
      output, JsonEncoding.UTF8);
  if (prettyPrint) {
    writer.useDefaultPrettyPrinter();
  }
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:25,代碼來源:JsonObjectMapperWriter.java

示例3: write

import org.codehaus.jackson.Version; //導入依賴的package包/類
private void write(DataOutput out) throws IOException {
  // This is just a JSON experiment
  System.out.println("Dumping the StatePool's in JSON format.");
  ObjectMapper outMapper = new ObjectMapper();
  outMapper.configure(
      SerializationConfig.Feature.CAN_OVERRIDE_ACCESS_MODIFIERS, true);
  // define a module
  SimpleModule module = new SimpleModule("State Serializer",  
      new Version(0, 1, 1, "FINAL"));
  // add the state serializer
  //module.addSerializer(State.class, new StateSerializer());

  // register the module with the object-mapper
  outMapper.registerModule(module);

  JsonFactory outFactory = outMapper.getJsonFactory();
  JsonGenerator jGen = 
    outFactory.createJsonGenerator((DataOutputStream)out, JsonEncoding.UTF8);
  jGen.useDefaultPrettyPrinter();

  jGen.writeObject(this);
  jGen.close();
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:24,代碼來源:StatePool.java

示例4: addDiscoverableDeserializers

import org.codehaus.jackson.Version; //導入依賴的package包/類
/**
 * Search for any registered JsonDeserialize instances that have been declared using the
 * ServiceLoader. Add any found to the given mapper in a 'magic' module.
 */
private static void addDiscoverableDeserializers(final ObjectMapper mapper) {

    final ServiceLoader<JsonDeserializer> loader = ServiceLoader.load(JsonDeserializer.class);
    final Iterator<JsonDeserializer> iterator = loader.iterator();
    final SimpleModule magic = new SimpleModule("magic", new Version(1, 0, 0, ""));

    while (iterator.hasNext()) {

        final JsonDeserializer<?> deserializer = iterator.next();

        try {
            final Method deserialeMethod = deserializer.getClass()
                    .getDeclaredMethod("deserialize", JsonParser.class, DeserializationContext.class);
            final Class<?> jsonType = deserialeMethod.getReturnType();
            //noinspection unchecked
            magic.addDeserializer(jsonType, (JsonDeserializer) deserializer);
        }
        catch(Exception e) {
            throw new IllegalStateException(e);
        }
    }

    mapper.registerModule(magic);
}
 
開發者ID:NovaOrdis,項目名稱:playground,代碼行數:29,代碼來源:BasicObjectMapperProvider.java

示例5: load

import org.codehaus.jackson.Version; //導入依賴的package包/類
@Override
public SchemaType load(ApplicationConfiguration applicationConfiguration, SchemaType schemaType) throws Exception {

    log.info(" load() ");

    Meta meta = new Meta();
    meta.setLocation(applicationConfiguration.getBaseEndpoint() + "/scim/v2/Schemas/" + schemaType.getId());
    meta.setResourceType("Schema");
    schemaType.setMeta(meta);

    // Use serializer to walk the class structure
    ObjectMapper mapper = new ObjectMapper();
    mapper.disable(SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS);
    SimpleModule userCoreLoadingStrategyModule = new SimpleModule("UserCoreLoadingStrategyModule", new Version(1, 0, 0, ""));
    SchemaTypeUserSerializer serializer = new SchemaTypeUserSerializer();
    serializer.setSchemaType(schemaType);
    userCoreLoadingStrategyModule.addSerializer(User.class, serializer);
    mapper.registerModule(userCoreLoadingStrategyModule);

    mapper.writeValueAsString(createDummyUser());

    return serializer.getSchemaType();
}
 
開發者ID:AgarwalNeha1,項目名稱:gluu,代碼行數:24,代碼來源:UserCoreLoadingStrategy.java

示例6: load

import org.codehaus.jackson.Version; //導入依賴的package包/類
@Override
public SchemaType load(ApplicationConfiguration applicationConfiguration, SchemaType schemaType) throws Exception {

    log.info(" load() ");

    Meta meta = new Meta();
    meta.setLocation(applicationConfiguration.getBaseEndpoint() + "/scim/v2/Schemas/" + schemaType.getId());
    meta.setResourceType("Schema");
    schemaType.setMeta(meta);

    // Use serializer to walk the class structure
    ObjectMapper mapper = new ObjectMapper();
    mapper.disable(SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS);
    SimpleModule groupCoreLoadingStrategyModule = new SimpleModule("GroupCoreLoadingStrategyModule", new Version(1, 0, 0, ""));
    SchemaTypeGroupSerializer serializer = new SchemaTypeGroupSerializer();
    serializer.setSchemaType(schemaType);
    groupCoreLoadingStrategyModule.addSerializer(Group.class, serializer);
    mapper.registerModule(groupCoreLoadingStrategyModule);

    mapper.writeValueAsString(createDummyGroup());

    return serializer.getSchemaType();
}
 
開發者ID:AgarwalNeha1,項目名稱:gluu,代碼行數:24,代碼來源:GroupCoreLoadingStrategy.java

示例7: load

import org.codehaus.jackson.Version; //導入依賴的package包/類
@Override
public SchemaType load(ApplicationConfiguration applicationConfiguration, SchemaType schemaType) throws Exception {

	log.info(" load() ");

	Meta meta = new Meta();
	meta.setLocation(applicationConfiguration.getBaseEndpoint() + "/scim/v2/Schemas/" + schemaType.getId());
	meta.setResourceType("Schema");
	schemaType.setMeta(meta);

	// Use serializer to walk the class structure
	ObjectMapper mapper = new ObjectMapper();
	mapper.disable(SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS);
	SimpleModule userCoreLoadingStrategyModule = new SimpleModule("FidoDeviceCoreLoadingStrategyModule", new Version(1, 0, 0, ""));
	SchemaTypeFidoDeviceSerializer serializer = new SchemaTypeFidoDeviceSerializer();
	serializer.setSchemaType(schemaType);
	userCoreLoadingStrategyModule.addSerializer(FidoDevice.class, serializer);
	mapper.registerModule(userCoreLoadingStrategyModule);

	mapper.writeValueAsString(createDummyFidoDevice());

	return serializer.getSchemaType();
}
 
開發者ID:AgarwalNeha1,項目名稱:gluu,代碼行數:24,代碼來源:FidoDeviceCoreLoadingStrategy.java

示例8: convertJsonToDataWrapper

import org.codehaus.jackson.Version; //導入依賴的package包/類
/**
 * Takes a JSON string that came from the frontend form submission and deserializes it into its {@link DataWrapper} dto
 * representation so that it can be converted to an MVEL expression
 * @param json
 * @return
 */
public DataWrapper convertJsonToDataWrapper(String json) {
    ObjectMapper mapper = new ObjectMapper();
    DataDTODeserializer dtoDeserializer = new DataDTODeserializer();
    SimpleModule module = new SimpleModule("DataDTODeserializerModule", new Version(1, 0, 0, null));
    module.addDeserializer(DataDTO.class, dtoDeserializer);
    mapper.registerModule(module);
    if (json == null || "[]".equals(json)) {
        return null;
    }

    try {
        return mapper.readValue(json, DataWrapper.class);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
 
開發者ID:passion1014,項目名稱:metaworks_framework,代碼行數:23,代碼來源:RuleFieldExtractionUtility.java

示例9: addSerializers

import org.codehaus.jackson.Version; //導入依賴的package包/類
private void addSerializers() {
	SimpleModule simpleModule = new SimpleModule("AHRDFModule", new Version(1,0, 0, null));

	//simpleModule.addSerializer(new LangStringSerializer());
	simpleModule.addSerializer(new XMLGregorianCalendarSerializer());
	simpleModule.addSerializer(new OfferingSerializer());

	simpleModule.addSerializer(EventType.class, new AHRDFObjectSerializer());
	simpleModule.addSerializer(EventStatus.class, new AHRDFObjectSerializer());
	simpleModule.addSerializer(Room.class, new AHRDFObjectSerializer());
	simpleModule.addSerializer(AttachmentType.class, new AHRDFObjectSerializer());
	simpleModule.addSerializer(ProductionType.class, new AHRDFObjectSerializer());
	simpleModule.addSerializer(VenueType.class, new AHRDFObjectSerializer());
	simpleModule.addSerializer(Genre.class, new AHRDFObjectSerializer());
	
	registerModule(simpleModule);
}
 
開發者ID:erfgoed-en-locatie,項目名稱:artsholland-platform,代碼行數:18,代碼來源:AHObjectMapper.java

示例10: QdsClientImpl

import org.codehaus.jackson.Version; //導入依賴的package包/類
public QdsClientImpl(QdsConfiguration configuration)
{
    this.configuration = Preconditions.checkNotNull(configuration, "configuration cannot be null");
    client = configuration.newClient();
    target = client.target(configuration.getApiEndpoint()).path(configuration.getApiVersion());
    commandApi = new CommandApiImpl(this);
    clusterApi = new ClusterApiImpl(this);
    hiveMetadataApi = new HiveMetadataApiImpl(this);
    dbTapsApi = new DbTapApiImpl(this);
    reportApi = new ReportApiImpl(this);
    schedulerApi = new SchedulerApiImpl(this);
    appApi = new AppApiImpl(this);
    notebookApi = new NotebookApiImpl(this);

    // register the deserialization handler for composite command
    SimpleModule module =
            new SimpleModule("CommandResponseDeserializerModule",
                    new Version(1, 0, 0, null));
    SubCommandsDeserializer ccDeserializer = new SubCommandsDeserializer();
    module.addDeserializer(SubCommands.class, ccDeserializer);
    MAPPER.registerModule(module);
}
 
開發者ID:qubole,項目名稱:qds-sdk-java,代碼行數:23,代碼來源:QdsClientImpl.java

示例11: toJson

import org.codehaus.jackson.Version; //導入依賴的package包/類
public static String toJson(Object object) {
	ObjectMapper mapper = new ObjectMapper(new MyJsonFactory());
	SimpleModule module = new SimpleModule("fullcalendar", new Version(1, 0, 0, null));
	module.addSerializer(new DateTimeSerializer());
	module.addSerializer(new LocalTimeSerializer());
	mapper.registerModule(module);
	mapper.getSerializationConfig().setSerializationInclusion(Inclusion.NON_NULL);

	String json = null;
	try {
		json = mapper.writeValueAsString(object);
	} catch (Exception e) {
		throw new RuntimeException("Error encoding object: " + object + " into JSON string", e);
	}
	return json;
}
 
開發者ID:micromata,項目名稱:projectforge-webapp,代碼行數:17,代碼來源:Json.java

示例12: CustomJSONProvider

import org.codehaus.jackson.Version; //導入依賴的package包/類
public CustomJSONProvider() {
    super();

    ObjectMapper mapper = new ObjectMapper();

    SimpleModule myModule = new SimpleModule("MyOpenDaylightOFFlowJSONSerializerDeserializerModule", new Version(1, 0, 0, null));
    myModule.addSerializer(new OpenDaylightOFFlowJSONSerializer()); // assuming OpenDaylightOFFlowJSONSerializer declares correct class to bind to
    myModule.addDeserializer(OpenDaylightOFFlow.class, new OpenDaylightOFFlowJSONDeserializer());
    myModule.addDeserializer(OpenDaylightOFFlowsWrapper.class, new OpenDaylightOFFlowsWrapperJSONDeserializer());
    mapper.registerModule(myModule);

    mapper.configure(org.codehaus.jackson.map.SerializationConfig.Feature.WRAP_ROOT_VALUE, false);
    mapper.configure(org.codehaus.jackson.map.SerializationConfig.Feature.INDENT_OUTPUT, true);
    // mapper.configure(org.codehaus.jackson.map.DeserializationConfig.Feature.UNWRAP_ROOT_VALUE, true);
    mapper.configure(org.codehaus.jackson.map.DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, true);

    super.setMapper(mapper);
}
 
開發者ID:dana-i2cat,項目名稱:opennaas-routing-nfv,代碼行數:19,代碼來源:CustomJSONProvider.java

示例13: CustomJSONProvider

import org.codehaus.jackson.Version; //導入依賴的package包/類
public CustomJSONProvider() {
	super();

	ObjectMapper mapper = new ObjectMapper();

	SimpleModule myModule = new SimpleModule("MyFloodlightOFFlowJSONSerializerDeserializerModule", new Version(1, 0, 0, null));
	myModule.addSerializer(new FloodlightOFFlowJSONSerializer()); // assuming FloodlightOFFlowJSONSerializer declares correct class to bind to
	myModule.addDeserializer(FloodlightOFFlow.class, new FloodlightOFFlowJSONDeserializer());
	myModule.addDeserializer(FloodlightOFFlowsWrapper.class, new FloodlightOFFlowsWrapperJSONDeserializer());
	mapper.registerModule(myModule);

	mapper.configure(org.codehaus.jackson.map.SerializationConfig.Feature.WRAP_ROOT_VALUE, false);
	mapper.configure(org.codehaus.jackson.map.SerializationConfig.Feature.INDENT_OUTPUT, true);
	// mapper.configure(org.codehaus.jackson.map.DeserializationConfig.Feature.UNWRAP_ROOT_VALUE, true);
	mapper.configure(org.codehaus.jackson.map.DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, true);

	super.setMapper(mapper);
}
 
開發者ID:dana-i2cat,項目名稱:opennaas-routing-nfv,代碼行數:19,代碼來源:CustomJSONProvider.java

示例14: getObjectMapper

import org.codehaus.jackson.Version; //導入依賴的package包/類
@Provides
public ObjectMapper getObjectMapper() {
	// configure objectmapper and provide it
	SimpleModule module = new SimpleModule("SimpleAbstractTypeResolver", Version.unknownVersion());
	module.addAbstractTypeMapping(MutableBlobProperties.class, MutableBlobPropertiesImpl.class);
	module.addAbstractTypeMapping(MutableContentMetadata.class, BaseMutableContentMetadata.class);
	module.addAbstractTypeMapping(OrionSpecificFileMetadata.class, OrionSpecificFileMetadataImpl.class);
	module.addAbstractTypeMapping(Attributes.class, AttributesImpl.class);
	module.addAbstractTypeMapping(OrionError.class, OrionErrorImpl.class);
	module.addAbstractTypeMapping(OrionChildMetadata.class, OrionChildMetadataImpl.class);
	ObjectMapper mapper = new ObjectMapper();
	mapper.registerModule(module);
	mapper.setSerializationInclusion(Inclusion.NON_NULL);
	mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
	return mapper;
}
 
開發者ID:timur-han,項目名稱:orion-jclouds,代碼行數:17,代碼來源:OrionCustomModule.java

示例15: newJodaModule

import org.codehaus.jackson.Version; //導入依賴的package包/類
/** Return a new module for serializing and deserializing Joda-Time classes. */
private static SimpleModule newJodaModule() {
    final SimpleModule joda = new SimpleModule("Joda", new Version(1, 0, 0, null));
    addJodaDeserializers(joda);
    addJodaSerializers(joda);
    return joda;
}
 
開發者ID:NovaOrdis,項目名稱:playground,代碼行數:8,代碼來源:BasicObjectMapperProvider.java


注:本文中的org.codehaus.jackson.Version類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。