If not already created, a new <code>factory</code> element will be created and returned.
Otherwise, the first existing <code>factory</code> element will be returned.
@return the instance defined for the element <code>factory</code>
199838
public FacesConfigFactoryType<WebFacesConfigDescriptor> getOrCreateFactory()
   {
      List<Node> nodeList = model.get("factory");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new FacesConfigFactoryTypeImpl<WebFacesConfigDescriptor>(this, "factory", model, nodeList.get(0));
      }
      return createFactory();
   }
646772
protected <W extends Widget> W widget(Element e, WidgetFactory<W> factory,
      WidgetInitializer<W> initializer) {

    if (!isWidgetCreationAuthorizedFrom(e)) {
      return null;
    }

    W widget = factory.create(e);
    if (initializer != null) {
      initializer.initialize(widget, e);
    }
    return widget;
  }
42100
public static LazyProxyFactory createDefaultProxyFactory() {
        if (testDependencyFullFilled()) {
            final String factoryClassName = "dev.morphia.mapping.lazy.CGLibLazyProxyFactory";
            try {
                return (LazyProxyFactory) Class.forName(factoryClassName).newInstance();
            } catch (Exception e) {
                LOG.error("While instantiating " + factoryClassName, e);
            }
        }
        return null;
    }
635255
static public ContentHandleFactory newFactory() {
    return new ContentHandleFactory() {
      @Override
      public Class<?>[] getHandledClasses() {
        return new Class<?>[]{ InputSource.class };
      }
      @Override
      public boolean isHandled(Class<?> type) {
        return InputSource.class.isAssignableFrom(type);
      }
      @Override
      public <C> ContentHandle<C> newHandle(Class<C> type) {
        @SuppressWarnings("unchecked")
        ContentHandle<C> handle = isHandled(type) ?
                                  (ContentHandle<C>) new InputSourceHandle() : null;
        return handle;
      }
    };
  }
86093
public static TensorFactory getFactory() {
    return new TensorFactory() {
      @Override
      public TensorBuilder getBuilder(int[] dimNums, int[] dimSizes) {
        return new SparseTensorBuilder(dimNums, dimSizes);
      }
    };
  }
298001
private static void createFactoryInstance()
  {
    try {
      Class cls = Class.forName(MP_MESSAGE_SELECTOR_FACTORY_CLASS);
      instance = (MPSelectionCriteriaFactory) cls.newInstance();
    }
    catch (Exception e) {
      FFDCFilter.processException(e, "com.ibm.ws.sib.processor.MPSelectionCriteriaFactory.createFactoryInstance", "100");
      throw new SIErrorException(e);
    }
  }
381609
private static void createFactoryInstance()
  {
    if (tc.isEntryEnabled())
      tc.entry(cclass, "createFactoryInstance");

    try
    {
      Class cls = Class.forName(MATCHING_CLASS_NAME);
      instance = (Matching) cls.newInstance();
    }
    catch (Exception e)
    {
      // No FFDC Code Needed.
      // FFDC driven by wrapper class.
      FFDC.processException(cclass,
        "com.ibm.ws.sib.matchspace.Matching.createFactoryInstance",
        e,
        "1:94:1.18");
//TODO: trace.error  
//      tc.error(cclass, "UNABLE_TO_CREATE_MATCHING_INSTANCE_CWSIH0007E", e);

      createException = e;
    }
    
    if (tc.isEntryEnabled())
      tc.exit(cclass, "createFactoryInstance");
  }
168733
public static TypeAdapterFactory create() {

    if (geometryTypeFactory == null) {
      geometryTypeFactory = RuntimeTypeAdapterFactory.of(Geometry.class, "type", true)
        .registerSubtype(GeometryCollection.class, "GeometryCollection")
        .registerSubtype(Point.class, "Point")
        .registerSubtype(MultiPoint.class, "MultiPoint")
        .registerSubtype(LineString.class, "LineString")
        .registerSubtype(MultiLineString.class, "MultiLineString")
        .registerSubtype(Polygon.class, "Polygon")
         .registerSubtype(MultiPolygon.class, "MultiPolygon");
    }
    return geometryTypeFactory;
  }
632963
public static synchronized JmsFactoryFactory getInstance() throws JMSException
  {
  	
  	if (tcInt.isEntryEnabled())
      Tr.entry(tcInt, "getInstance");

    if (instance == null)
    {
      

      try
      {
        Class cls =
          Class.forName(ApiJmsConstants.CONNFACTORY_FACTORY_CLASS);
        instance = (JmsFactoryFactory) cls.newInstance();

      } catch (Exception e)
      {
        // No FFDC code needed
      	if (tcInt.isDebugEnabled())
          Tr.debug(tcInt, "Unable to instantiate JmsFactoryFactory", e);
        if (tcInt.isEntryEnabled())
          Tr.exit(tcInt, "getInstance");
          
        instance = null;
              
        JMSException jmse = new JMSException(nls.getFormattedMessage("UNABLE_TO_CREATE_FACTORY_CWSIA0001",
        																			new Object[] {"JmsFactoryFactoryImpl", "sib.api.jmsImpl.jar"},
        																			"!!!Unable to instantiate JmsFactoryFactoryImpl"));
        jmse.setLinkedException(e);
        jmse.initCause(e);
        throw jmse;

      }

    }//if

		if (tcInt.isEntryEnabled())
      Tr.exit(tcInt, "getInstance");
      
		// If we get this far, then the instance is initialized, since an exception would
		// have been thrown if it was not.
    return instance;
  }
371528
public Next<Flow<T>> getOrCreateNext()
   {
      List<Node> nodeList = childNode.get("next");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new NextImpl<Flow<T>>(this, "next", childNode, nodeList.get(0));
      }
      return createNext();
   }
1026659
public static TrieNodeFactory<Boolean> getInstance() {
        return new TrieNodeFactory<Boolean>() {
            @Override
            public TrieNode<Boolean> create() {
                return new BooleanTrieNode();
            }
        };
    }
308151
static public ContentHandleFactory newFactory() {
    return new ContentHandleFactory() {
      @Override
      public Class<?>[] getHandledClasses() {
        return new Class<?>[]{ JsonElement.class };
      }
      @Override
      public boolean isHandled(Class<?> type) {
        return JsonElement.class.isAssignableFrom(type);
      }
      @Override
      public <C> ContentHandle<C> newHandle(Class<C> type) {
        @SuppressWarnings("unchecked")
        ContentHandle<C> handle = isHandled(type) ?
          (ContentHandle<C>) new GSONHandle() : 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()");
                }
            }
        };
    }
792034
public static Factory newInstance() {
        ScheduledExecutorService scheduler = newSingleThreadScheduledExecutor(new ThreadFactory() {
            public Thread newThread(Runnable r) {
                Thread result = new Thread(r);
                result.setDaemon(true);
                return result;
            }
        });
        Properties props = new Properties();
        return new DefaultFactory(scheduler, props);
    }
156461
public ColumnResult<ConstructorResult<T>> getOrCreateColumn()
   {
      List<Node> nodeList = childNode.get("column");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new ColumnResultImpl<ConstructorResult<T>>(this, "column", childNode, nodeList.get(0));
      }
      return createColumn();
   }
691304
public OrderingType<WebFragmentType<T>> getOrCreateOrdering()
   {
      List<Node> nodeList = childNode.get("ordering");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new OrderingTypeImpl<WebFragmentType<T>>(this, "ordering", childNode, nodeList.get(0));
      }
      return createOrdering();
   }
817242
public ResourceFactory createChild() {
        ResourceFactory child = new ResourceFactory(this);
        this.chidren.add(new WeakReference<>(child));
        return child;
    }