Returns a pre configured mapper using the EMF module and the specified jackson factory.
This method can be used to work with formats others than JSON (such as YAML).

@param factory
@return mapper
552000
public static ObjectMapper setupDefaultMapper(JsonFactory factory) {
		final ObjectMapper mapper = new ObjectMapper(factory);
		// same as emf
		final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.ENGLISH);
		dateFormat.setTimeZone(TimeZone.getDefault());

		mapper.configure(SerializationFeature.INDENT_OUTPUT, true);
		mapper.setDateFormat(dateFormat);
		mapper.setTimeZone(TimeZone.getDefault());
		mapper.registerModule(new EMFModule());

		return mapper;
	}
478885
public Configuration mappingProvider(MappingProvider newMappingProvider) {
        return Configuration.builder().jsonProvider(jsonProvider).mappingProvider(newMappingProvider).options(options).evaluationListener(evaluationListeners).build();
    }
1041060
private ObjectMapper getObjectMapper() {
		ObjectMapper mapper = new ObjectMapper();
		AnnotationIntrospector primary = new JacksonAnnotationIntrospector();
		AnnotationIntrospector secondary = new JaxbAnnotationIntrospector();
		AnnotationIntrospector pair = new AnnotationIntrospectorPair(primary, secondary);

		mapper.setAnnotationIntrospector(pair);
		mapper.setSerializationInclusion(Include.NON_NULL);

		return mapper;
	}
436234
public static <T extends MessageNano> Marshaller<T> marshaller(MessageNanoFactory<T> factory) {
    return new MessageMarshaller<>(factory);
  }
977225
public MapFactory<E, MutableInteger> getMapFactory() {
    return ErasureUtils.<MapFactory<E,MutableInteger>>uncheckedCast(mapFactory);
  }
592427
public Configuration jsonProvider(JsonProvider newJsonProvider) {
        return Configuration.builder().jsonProvider(newJsonProvider).mappingProvider(mappingProvider).options(options).evaluationListener(evaluationListeners).build();
    }
1339195
private POJOPropertyBuilder jackson27AndHigherInstance(
      MapperConfig<?> config,
      BeanPropertyDefinition beanProperty,
      AnnotationIntrospector annotationIntrospector,
      boolean forSerialization) {
    try {
      Constructor<POJOPropertyBuilder> constructor = constructorWithParams(
          MapperConfig.class,
          AnnotationIntrospector.class,
          Boolean.TYPE,
          PropertyName.class);

      return constructor.newInstance(
          config,
          annotationIntrospector,
          forSerialization,
          new PropertyName(beanProperty.getName()));
    } catch (Exception e) {
      throw new InstantiationError("Unable to create an instance of POJOPropertyBuilder");
    }
  }
129845
private static Map<String, String> findServiceBeanDefinitions(ConfigurableListableBeanFactory beanFactory) {
		final Map<String, String> serviceBeanNames = new HashMap<>();
		
		for (String beanName : beanFactory.getBeanDefinitionNames()) {
			AutoJsonRpcServiceImpl autoJsonRpcServiceImplAnnotation = beanFactory.findAnnotationOnBean(beanName, AutoJsonRpcServiceImpl.class);
			JsonRpcService jsonRpcServiceAnnotation = beanFactory.findAnnotationOnBean(beanName, JsonRpcService.class);
			
			if (null != autoJsonRpcServiceImplAnnotation) {
				
				if (null == jsonRpcServiceAnnotation) {
					throw new IllegalStateException("on the bean [" + beanName + "], @" +
							AutoJsonRpcServiceImpl.class.getSimpleName() + " was found, but not @" +
							JsonRpcService.class.getSimpleName() + " -- both are required");
				}
				
				List<String> paths = new ArrayList<>();
				Collections.addAll(paths, autoJsonRpcServiceImplAnnotation.additionalPaths());
				paths.add(jsonRpcServiceAnnotation.value());
				
				for (String path : paths) {
					if (!PATTERN_JSONRPC_PATH.matcher(path).matches()) {
						throw new RuntimeException("the path [" + path + "] for the bean [" + beanName + "] is not valid");
					}
					
					logger.info("exporting bean [{}] ---> [{}]", beanName, path);
					if (isNotDuplicateService(serviceBeanNames, beanName, path)) {
                        serviceBeanNames.put(path, beanName);
                    }
				}
				
			}
		}
		
		collectFromParentBeans(beanFactory, serviceBeanNames);
		return serviceBeanNames;
	}
1284756
@Override
   public <C extends ConnectionFactoryConfigurationBuilder<?>> C connectionFactory(C builder) {
      if (connectionFactory != null) {
         throw new IllegalStateException("A ConnectionFactory has already been configured for this store");
      }
      this.connectionFactory = (ConnectionFactoryConfigurationBuilder<ConnectionFactoryConfiguration>) builder;
      return builder;
   }
35215
static public ContentHandleFactory newFactory() {
    return new ContentHandleFactory() {
      @Override
      public Class<?>[] getHandledClasses() {
        return new Class<?>[]{ JsonParser.class };
      }
      @Override
      public boolean isHandled(Class<?> type) {
        return JsonParser.class.isAssignableFrom(type);
      }
      @Override
      public <C> ContentHandle<C> newHandle(Class<C> type) {
        @SuppressWarnings("unchecked")
        ContentHandle<C> handle = isHandled(type) ?
                                  (ContentHandle<C>) new JacksonParserHandle() : null;
        return handle;
      }
    };
  }
144470
public static Builder newParserConfigBuilder() {
        return new Builder() {
            boolean used = false;
            CollectionBuilder.Factory listFactory = DEFAULT_LIST_FACTORY;
            CollectionBuilder.Factory vectorFactory = DEFAULT_VECTOR_FACTORY;
            CollectionBuilder.Factory setFactory = DEFAULT_SET_FACTORY;
            CollectionBuilder.Factory mapFactory = DEFAULT_MAP_FACTORY;
            Map<Tag, TagHandler> tagHandlers = defaultTagHandlers();

            public Builder setListFactory(CollectionBuilder.Factory listFactory) {
                checkState();
                this.listFactory = listFactory;
                return this;
            }

            public Builder setVectorFactory(CollectionBuilder.Factory vectorFactory) {
                checkState();
                this.vectorFactory = vectorFactory;
                return this;
            }

            public Builder setSetFactory(CollectionBuilder.Factory setFactory) {
                checkState();
                this.setFactory = setFactory;
                return this;
            }

            public Builder setMapFactory(CollectionBuilder.Factory mapFactory) {
                checkState();
                this.mapFactory = mapFactory;
                return this;
            }

            public Builder putTagHandler(Tag tag, TagHandler handler) {
                checkState();
                this.tagHandlers.put(tag, handler);
                return this;
            }

            public Config build() {
                checkState();
                used = true;
                return new Config() {
                    public Factory getListFactory() {
                        return listFactory;
                    }

                    public Factory getVectorFactory() {
                        return vectorFactory;
                    }

                    public Factory getSetFactory() {
                        return setFactory;
                    }

                    public Factory getMapFactory() {
                        return mapFactory;
                    }

                    public TagHandler getTagHandler(Tag tag) {
                        return tagHandlers.get(tag);
                    }
                };
            }

            private void checkState() {
                if (used) {
                    throw new IllegalStateException(
                            "Builder is single-use. Not usable after build()");
                }
            }
        };
    }
384595
public static TransformerFactory newTransformerFactory( String factoryClassName, ClassLoader classLoader )
        throws NoSuchMethodException, IllegalAccessException, InvocationTargetException
    {
        // use reflection to avoid JAXP 1.4 (and hence JDK6) requirement

        Class<?>[] methodTypes = new Class[] { String.class, ClassLoader.class };

        Method method = TransformerFactory.class.getDeclaredMethod( "newInstance", methodTypes );

        Object[] methodArgs = new Object[] { factoryClassName, classLoader };

        return (TransformerFactory) method.invoke( null, methodArgs );
    }
705004
@SuppressWarnings("unchecked")
  static Map<Path, Class<? extends Mapper>> getMapperTypeMap(JobConf conf) {
    if (conf.get("mapred.input.dir.mappers") == null) {
      return Collections.emptyMap();
    }
    Map<Path, Class<? extends Mapper>> m = new HashMap<Path, Class<? extends Mapper>>();
    String[] pathMappings = conf.get("mapred.input.dir.mappers").split(",");
    for (String pathMapping : pathMappings) {
      String[] split = pathMapping.split(";");
      Class<? extends Mapper> mapClass;
      try {
       mapClass = (Class<? extends Mapper>) conf.getClassByName(split[1]);
      } catch (ClassNotFoundException e) {
       throw new RuntimeException(e);
      }
      m.put(new Path(split[0]), mapClass);
    }
    return m;
  }
1119899
protected <T> ManagedObjectFactory<T> getInterceptorManagedObjectFactory(BeanMetaData bmd, Class<T> klass) throws EJBConfigurationException {
        ManagedObjectFactory<T> factory = null;
        ManagedObjectService managedObjectService = getManagedObjectService();
        if (managedObjectService != null) {
            try {
                factory = managedObjectService.createInterceptorManagedObjectFactory(bmd._moduleMetaData, klass);
                //TODO the isManaged method could be moved to the ManagedObjectService and then wouldn't need to create the factory
                if (!factory.isManaged()) {
                    factory = null;
                }
            } catch (ManagedObjectException e) {
                throw new EJBConfigurationException(e);
            }
        }

        return factory;
    }
795442
@Nullable
  public static Transformer newTransformer (@Nonnull final TransformerFactory aTransformerFactory)
  {
    ValueEnforcer.notNull (aTransformerFactory, "TransformerFactory");

    try
    {
      return aTransformerFactory.newTransformer ();
    }
    catch (final TransformerConfigurationException ex)
    {
      LOGGER.error ("Failed to create transformer", ex);
      return null;
    }
  }
100018
public function setFactory($factory)
    {
        if (is_string($factory) && strpos($factory, '::') !== false) {
            $factory = explode('::', $factory, 2);
        }

        $this->factory = $factory;

        return $this;
    }
577459
protected <T> ManagedObjectFactory<T> getEJBManagedObjectFactory(BeanMetaData bmd, Class<T> klass) throws EJBConfigurationException {
        ManagedObjectFactory<T> factory = null;
        ManagedObjectService managedObjectService = getManagedObjectService();
        if (managedObjectService != null) {
            try {
                factory = managedObjectService.createEJBManagedObjectFactory(bmd._moduleMetaData, klass, bmd.j2eeName.getComponent());
                //TODO the isManaged method could be moved to the ManagedObjectService and then wouldn't need to create the factory
                if (!factory.isManaged()) {
                    factory = null;
                }
            } catch (ManagedObjectException e) {
                throw new EJBConfigurationException(e);
            }
        }

        return factory;
    }