Creates new Vert.x instance with default factory. Subclasses may overwrite this
method in order to provide special Vert.x instance.
@return
430396
protected Vertx createVertx(VertxEndpointConfiguration endpointConfiguration) {
        final Vertx[] vertx = new Vertx[1];
        final Future loading = new FutureFactoryImpl().future();

        Handler<AsyncResult<Vertx>> asyncLoadingHandler = new Handler<AsyncResult<Vertx>>() {
            @Override
            public void handle(AsyncResult<Vertx> event) {
                vertx[0] = event.result();
                loading.complete();
                log.info("Vert.x instance started");
            }
        };

        if (endpointConfiguration.getPort() > 0) {
            if (log.isDebugEnabled()) {
                log.debug(String.format("Creating new Vert.x instance '%s:%s' ...", endpointConfiguration.getHost(), endpointConfiguration.getPort()));
            }
            VertxOptions vertxOptions = new VertxOptions();
            vertxOptions.setClusterPort(endpointConfiguration.getPort());
            vertxOptions.setClusterHost(endpointConfiguration.getHost());
            vertxFactory.clusteredVertx(vertxOptions, asyncLoadingHandler);
        } else {
            if (log.isDebugEnabled()) {
                log.debug(String.format("Creating new Vert.x instance '%s:%s' ...", endpointConfiguration.getHost(), 0L));
            }
            VertxOptions vertxOptions = new VertxOptions();
            vertxOptions.setClusterPort(0);
            vertxOptions.setClusterHost(endpointConfiguration.getHost());
            vertxFactory.clusteredVertx(vertxOptions, asyncLoadingHandler);
        }

        // Wait for full loading
        while (!loading.isComplete()) {
            try {
                log.debug("Waiting for Vert.x instance to startup");
                Thread.sleep(250L);
            } catch (InterruptedException e) {
                log.warn("Interrupted while waiting for Vert.x instance startup", e);
            }
        }

        return vertx[0];
    }
1071873
public static VatIdMapSharedConstants create() {
    if (vatIdMapConstants == null) { // NOPMD it's thread save!
      synchronized (VatIdMapConstantsImpl.class) {
        if (vatIdMapConstants == null) {
          vatIdMapConstants =
              new VatIdMapConstantsImpl(readMapFromProperties("VatIdMapConstants", "vatIds"));
        }
      }
    }
    return vatIdMapConstants;
  }
705096
public T build() {
        C clientObject = client;
        if (clientObject == null) {
            clientObject = createClient();
        }

        return factory.create(clientObject);
    }
446748
static public ContentHandleFactory newFactory() {
    return new ContentHandleFactory() {
      @Override
      public Class<?>[] getHandledClasses() {
        return new Class<?>[]{ JsonNode.class };
      }
      @Override
      public boolean isHandled(Class<?> type) {
        return JsonNode.class.isAssignableFrom(type);
      }
      @Override
      public <C> ContentHandle<C> newHandle(Class<C> type) {
        @SuppressWarnings("unchecked")
        ContentHandle<C> handle = isHandled(type) ?
                                  (ContentHandle<C>) new JacksonHandle() : null;
        return handle;
      }
    };
  }
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;
      }
    };
  }
992578
public static PostalCodesMapSharedConstants create() {
    if (postalCodesMapConstants == null) { // NOPMD it's thread save!
      synchronized (PostalCodesMapConstants.class) {
        if (postalCodesMapConstants == null) {
          postalCodesMapConstants = GWT.create(PostalCodesMapConstants.class);
        }
      }
    }
    return postalCodesMapConstants;
  }
1210671
public static TensorFactory getFactory() {
    return new TensorFactory() {
      @Override
      public TensorBuilder getBuilder(int[] dimNums, int[] dimSizes) {
        return new DenseTensorBuilder(dimNums, dimSizes);
      }
    };
  }
1137786
public static XOManagerFactory createXOManagerFactory(XOUnit xoUnit) {
        ServiceLoader<XOBootstrapService> serviceLoader = ServiceLoader.load(XOBootstrapService.class);
        for (XOBootstrapService xoBootstrapService : serviceLoader) {
            XOManagerFactory xoManagerFactory = xoBootstrapService.createXOManagerFactory(xoUnit);
            if (xoManagerFactory != null) {
                return xoManagerFactory;
            }
        }
        throw new XOException("Cannot bootstrap XO implementation.");
    }
1299052
public MultipartConfigElement createMultipartConfig() {
		MultipartConfigFactory factory = new MultipartConfigFactory();
		PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
		map.from(this.fileSizeThreshold).to(factory::setFileSizeThreshold);
		map.from(this.location).whenHasText().to(factory::setLocation);
		map.from(this.maxRequestSize).to(factory::setMaxRequestSize);
		map.from(this.maxFileSize).to(factory::setMaxFileSize);
		return factory.createMultipartConfig();
	}
33841
public static TypeInterestFactoryTrie newDefaultInstance()
    {
        TrieStructureTypeRelation<RewritePatternToRegex, String> relation = new TrieStructureTypeRelation<RewritePatternToRegex, String>()
        {

            @Override
            public String getStringToSearchFromSearchType(String search)
            {
                return search;
            }

            @Override
            public String getStringPrefixToSaveSaveType(RewritePatternToRegex save)
            {
                /**
                 * Take the prefix of the windup regex and save it in the node up to the first "{..}"
                 */
                return save.getRewritePattern().split("\\{")[0];
            }

            @Override
            public boolean checkIfMatchFound(RewritePatternToRegex saved, String searched)
            {
                return saved.getCompiledRegex().matcher(searched).matches();
            }
        };
        return new TypeInterestFactoryTrie(relation);
    }
1352950
public static IJavaBatchCompiler newDefaultJavaBatchCompiler() {
		try {
			synchronized (SarlBatchCompiler.class) {
				if (defaultJavaBatchCompiler == null) {
					final ImplementedBy annotation = IJavaBatchCompiler.class.getAnnotation(ImplementedBy.class);
					assert annotation != null;
					final Class<?> type = annotation.value();
					assert type != null;
					defaultJavaBatchCompiler = type.asSubclass(IJavaBatchCompiler.class);
				}
				return defaultJavaBatchCompiler.newInstance();
			}
		} catch (Exception exception) {
			throw new RuntimeException(exception);
		}
	}
207419
static Traits create() {
    Traits traits = new Traits(new NullableConcurrentHashMap<String, Object>());
    traits.putAnonymousId(UUID.randomUUID().toString());
    return traits;
  }
1168796
public static FormatFactory factory()
    {

        return new FormatFactory()
        {
            @Override
            public Format getFormat(String name, String args, Locale locale)
            {
                Map<String, Format> mt = FormatTables.get(name);
                Preconditions.checkArgument(mt != null, "There's no format instance for [%s]", name);

                Format m = mt.get((args == null || args.length() < 1) ? FormatNames.DEFAULT : args);
                Preconditions.checkArgument(m != null, "There's no signature in [%s] for the given args [%s]", name,
                        args);

                return ((ConfigurableFormat) m).withLocale(locale);
            }
        };

    }
827495
static RequestCreator<JmxSearchRequest> newCreator() {
        return new RequestCreator<JmxSearchRequest>() {
            /** {@inheritDoc} */
            public JmxSearchRequest create(Stack<String> pStack, ProcessingParameters pParams) throws MalformedObjectNameException {
                return new JmxSearchRequest(pStack.pop(),pParams);
            }

            /** {@inheritDoc} */
            public JmxSearchRequest create(Map<String, ?> requestMap, ProcessingParameters pParams)
                    throws MalformedObjectNameException {
                return new JmxSearchRequest(requestMap,pParams);
            }
        };
    }
86093
public static TensorFactory getFactory() {
    return new TensorFactory() {
      @Override
      public TensorBuilder getBuilder(int[] dimNums, int[] dimSizes) {
        return new SparseTensorBuilder(dimNums, dimSizes);
      }
    };
  }
1139339
static public ContentHandleFactory newFactory() {
    return new ContentHandleFactory() {
      @Override
      public Class<?>[] getHandledClasses() {
        return new Class<?>[]{ XMLEventReader.class };
      }
      @Override
      public boolean isHandled(Class<?> type) {
        return XMLEventReader.class.isAssignableFrom(type);
      }
      @Override
      public <C> ContentHandle<C> newHandle(Class<C> type) {
        @SuppressWarnings("unchecked")
        ContentHandle<C> handle = isHandled(type) ?
                                  (ContentHandle<C>) new XMLEventReaderHandle() : 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()");
                }
            }
        };
    }