Return the name of the class which this factory generates, i.e.
 JIRA::Resource::FooFactory creates JIRA::Resource::Foo instances.
493200
def target_class
      # Need to do a little bit of work here as Module.const_get doesn't work
      # with nested class names, i.e. JIRA::Resource::Foo.
      #
      # So create a method chain from the class components.  This code will
      # unroll to:
      #   Module.const_get('JIRA').const_get('Resource').const_get('Foo')
      #
      target_class_name = self.class.name.sub(/Factory$/, '')
      class_components = target_class_name.split('::')

      class_components.inject(Module) do |mod, const_name|
        mod.const_get(const_name)
      end
    end
1221319
def instance(cls):
        

        if not hasattr(cls, "_instance") or cls._instance is None:
            cls._instance = cls()
        return cls._instance
552073
def factory(cls, attrs):
        """"""
        name = attrs['identifier'].capitalize()
        return type(name, (cls,), attrs)
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");
  }
24446
def instance():
        
        if not hasattr(IOLoop, "_instance"):
            with IOLoop._instance_lock:
                if not hasattr(IOLoop, "_instance"):
                    # New instance after double check
                    IOLoop._instance = IOLoop()
        return IOLoop._instance
364547
def instantiate_by_name_with_default(self, object_name, default_value=None):
        
        if object_name not in self.instances:
            if object_name not in self.environment:
                return default_value
            else:
                instance = self.instantiate_from_data(self.environment[object_name])

                self.instances[object_name] = instance
                return instance
        else:
            return self.instances[object_name]
1143756
def factory(name, klass = nil, &block)
      @registry[name.to_sym] = Resolver::Factory.new(block || klass)
    end
1119331
def build_model_name(cls, name='modelName', output_name='output'):
        
        obj = cls(name)
        obj.exporter = 'generate_model_name'
        obj.output_name = output_name
        return obj
670172
def _get_name(self):
        
        if self._name is None:
            self._name = self._generate_name()
        return self._name
9147
def getFactory(self):
        
        privateKey = Key.fromString(data=self.hostKey)
        public = privateKey.public()
        factory = SSHFactory()
        factory.publicKeys = {'ssh-rsa': public}
        factory.privateKeys = {'ssh-rsa': privateKey}
        factory.portal = Portal(
            IRealm(self.store), [ICredentialsChecker(self.store)])
        return factory
661608
static function factory($name = 'default') {
        $class = get_called_class();
        if (!isset(self::$instances[$class][$name])) {
            self::$instances[$class][$name] = new $class($name);
        }

        return self::$instances[$class][$name];
    }
918868
@NotNull
    public final ArtifactFactory<?> getFactory() {
        if (factory == null) {
            if (factoryClassName == null) {
                throw new IllegalStateException("Factory class name was not set: " + artifact);
            }
            if (context == null) {
                throw new IllegalStateException("Context class loader was not set: " + artifact);
            }
            final Object obj = Utils4J.createInstance(factoryClassName, context.getClassLoader());
            if (!ArtifactFactory.class.isAssignableFrom(obj.getClass())) {
                throw new IllegalStateException(
                        "Expected an object of type '" + ArtifactFactory.class.getName() + "', but was: " + obj.getClass());
            }
            factory = (ArtifactFactory<?>) obj;
            factory.init(this);
        }
        return factory;
    }
1212673
def getInstance(cls, *args):
        '''
        
        '''
        if not cls.__singleton:
            cls.__singleton = Config(*args)
        return cls.__singleton
260001
def get_name_for_model(cls, model):
        
        key = cls.get_model_key(model)
        model_str = cls._get_model_str(model)
        service = cls._registry[key]
        if model_str in service['resources']:
            return '{}.{}'.format(service['name'], service['resources'][model_str]['name'])
        else:
            return service['name']
987438
def get_factory_context(cls):
    # type: (type) -> FactoryContext
    
    context = getattr(cls, constants.IPOPO_FACTORY_CONTEXT, None)

    if context is None:
        # Class not yet manipulated
        context = FactoryContext()
    elif is_from_parent(cls, constants.IPOPO_FACTORY_CONTEXT):
        # Create a copy the context
        context = context.copy(True)
        # * Manipulation has not been applied yet
        context.completed = False
    else:
        # Nothing special to do
        return context

    # Context has been created or copied, inject the new bean
    setattr(cls, constants.IPOPO_FACTORY_CONTEXT, context)
    return context
729584
def get_service_resources(cls, model):
        
        key = cls.get_model_key(model)
        return cls.get_service_name_resources(key)
278674
def factory(cls, registry):
        
        # This implementation relies on MetricsHandler.registry
        #  (defined above and defaulted to REGISTRY).

        # As we have unicode_literals, we need to create a str()
        #  object for type().
        cls_name = str(cls.__name__)
        MyMetricsHandler = type(cls_name, (cls, object),
                                {"registry": registry})
        return MyMetricsHandler