Register an option to make capturing snapshots optional.
    This class is intended to be extended by Jvm resolvers (coursier and ivy), and the option name should reflect that.
161268
def register_options(cls, register):
    
    super(JvmResolverBase, cls).register_options(register)
    # TODO This flag should be defaulted to True when we are doing hermetic execution,
    # and should probably go away as we move forward into that direction.
    register('--capture-snapshots', type=bool, default=False,
      help='Enable capturing snapshots to add directory digests to dependency jars.'
           'Note that this is necessary when hermetic execution is enabled.')
596475
protected void registerOptionHandlers() {
        try {
            for (Class c : Index.list(OptionHandlerExtension.class, Jenkins.getActiveInstance().pluginManager.uberClassLoader,Class.class)) {
                Type t = Types.getBaseClass(c, OptionHandler.class);
                CmdLineParser.registerHandler(Types.erasure(Types.getTypeArgument(t,0)), c);
            }
        } catch (IOException e) {
            throw new Error(e);
        }
    }
1249161
@Override
	public TypeSerializerSnapshot<T> snapshotConfiguration() {
		if (configSnapshot == null) {
			checkAvroInitialized();
			configSnapshot = new AvroSerializerSnapshot<>(runtimeSchema, type);
		}
		return configSnapshot;
	}
825034
function optionalResolve(options) {
    setupOptions(options);
    return new Promise(function (res, rej) {
        if (options.resolve)
            loopReferences(options, res, rej)
        else
            res(options);
    });
}
519727
protected void registerUnregisterJMX(boolean doRegister) {
		if (this.mbs == null ){ // this way makes it easier for mocking.
			this.mbs = ManagementFactory.getPlatformMBeanServer();
		}
		try {
			String suffix = "";

			if (this.config.getPoolName()!=null){
				suffix="-"+this.config.getPoolName();
			}

			ObjectName name = new ObjectName(MBEAN_BONECP +suffix);
			ObjectName configname = new ObjectName(MBEAN_CONFIG + suffix);


			if (doRegister){
				if (!this.mbs.isRegistered(name)){
					this.mbs.registerMBean(this.statistics, name);
				}
				if (!this.mbs.isRegistered(configname)){
					this.mbs.registerMBean(this.config, configname);
				}
			} else {
				if (this.mbs.isRegistered(name)){
					this.mbs.unregisterMBean(name);
				}
				if (this.mbs.isRegistered(configname)){
					this.mbs.unregisterMBean(configname);
				}
			}
		} catch (Exception e) {
			logger.error("Unable to start/stop JMX", e);
		}
	}
1189763
public void registerOption(String option, String value) {
        options.put(option.toUpperCase(), value);
    }
282245
public static void registerProvider( String providerName, Class<? extends StorageProvider> providerClass )
    {
        if ( PROVIDERS.containsKey( providerName ) ) {
            throw new IllegalArgumentException( "A provider already exists with the name " + providerName );
        }
        PROVIDERS.put( providerName, providerClass );
        LOGGER.debug( "Registering new provider: {}", providerClass.getSimpleName() );
    }
1166030
@Override
    @SuppressWarnings("unchecked")
    public void register(String extensionClassName, String blockName) throws MojoExecutionException {

        Class<? extends Processor> clazz;
        try {
            clazz = (Class<Processor>) Class.forName(extensionClassName);
        } catch (ClassCastException cce) {
            // Use RuntimeException to avoid catching, we only want the message in the Mojo
            throw new RuntimeException("'" + extensionClassName + "' is not a valid AsciidoctorJ processor class");
        } catch (ClassNotFoundException e) {
            throw new RuntimeException("'" + extensionClassName + "' not found in classpath");
        }

        // TODO: Replace with direct method calls again as soon as this project compiles against AsciidoctorJ 1.6.0
        if (DocinfoProcessor.class.isAssignableFrom(clazz)) {
            register(javaExtensionRegistry, "docinfoProcessor", clazz);
        } else if (Preprocessor.class.isAssignableFrom(clazz)) {
            register(javaExtensionRegistry, "preprocessor", clazz);
        } else if (Postprocessor.class.isAssignableFrom(clazz)) {
            register(javaExtensionRegistry, "postprocessor", clazz);
        } else if (Treeprocessor.class.isAssignableFrom(clazz)) {
            register(javaExtensionRegistry, "treeprocessor", clazz);
        } else if (BlockProcessor.class.isAssignableFrom(clazz)) {
            if (blockName == null) {
                register(javaExtensionRegistry, "block", clazz);
            } else {
                register(javaExtensionRegistry, "block", blockName, clazz);
            }
        } else if (IncludeProcessor.class.isAssignableFrom(clazz)) {
            register(javaExtensionRegistry, "includeProcessor", clazz);
        } else if (BlockMacroProcessor.class.isAssignableFrom(clazz)) {
            if (blockName == null) {
                register(javaExtensionRegistry, "blockMacro", clazz);
            } else {
                register(javaExtensionRegistry, "blockMacro", blockName, clazz);
            }
        } else if (InlineMacroProcessor.class.isAssignableFrom(clazz)) {
            if (blockName == null) {
                register(javaExtensionRegistry, "inlineMacro", clazz);
            } else {
                register(javaExtensionRegistry, "inlineMacro", blockName, clazz);
            }
        }
    }
24275
private void registerRunnerBeanDefinition() {
        DefaultListableBeanFactory beanFactory = (DefaultListableBeanFactory)
                ((ConfigurableApplicationContext) applicationContext).getBeanFactory();
        jobRunnerBeanName = "LTS_".concat(jobRunnerClass.getSimpleName());
        if (!beanFactory.containsBean(jobRunnerBeanName)) {
            BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(jobRunnerClass);
            if (jobRunnerClass == JobDispatcher.class) {
                builder.setScope(BeanDefinition.SCOPE_SINGLETON);
                builder.setLazyInit(false);
                builder.getBeanDefinition().getPropertyValues().addPropertyValue("shardField", shardField);
            } else {
                builder.setScope(BeanDefinition.SCOPE_PROTOTYPE);
            }
            beanFactory.registerBeanDefinition(jobRunnerBeanName, builder.getBeanDefinition());
        }
    }
76767
def register_sub(self, o):
        """"""

        if o.subopt in self.subopt_map:
            raise OptionConflictError(
              "conflicting suboption handlers for `%s'" % o.subopt,
              o)
        self.subopt_map[o.subopt] = o
797312
public void setOptional(boolean optional) {
    if (field.getType().isPrimitive() || field.isAnnotationPresent(Version.class)
        || field.isAnnotationPresent(CreatedTimestamp.class)
        || field.isAnnotationPresent(UpdatedTimestamp.class)) {
      this.optional = false;
    } else {
      this.optional = optional;
    }
  }
847972
public function takeSnapshot()
    {
        $this->enabledTypeBefore = null;

        if ($this->typeDescriptors->contains($this->typeName)) {
            foreach ($this->typeDescriptors->listByTypeName($this->typeName) as $typeDescriptor) {
                if ($typeDescriptor->isEnabled()) {
                    $this->enabledTypeBefore = $typeDescriptor;
                }
            }
        }

        $this->snapshotTaken = true;
    }
1232081
protected void registerServant()
    {
        if (ivRemoteObjectWrapper != null)
        {
            // synchronized on the remote Wrapper to set the isRemoteRegistered flag
            synchronized (ivRemoteObjectWrapper)
            {
                if (!isRemoteRegistered)
                {

                    try
                    {
                        if (!isZOS) // LIDB2775-23.9
                        {

                            // Servant registration must be performed with the application classloader
                            // in force.  This is especially needed for JITDeploy since
                            // the JIT pluggin will be on the application classloader.
                            // Without the JIT pluggin the classloader will not trigger
                            // JITDeploy to create the stub.  //d521388
                            Object originalLoader = ThreadContextAccessor.UNCHANGED;
                            try
                            {
                                if (ivBMD != null) // EJBFactories have no BMD d529446
                                {
                                    originalLoader = EJBThreadData.svThreadContextAccessor.pushContextClassLoaderForUnprivileged(ivBMD.classLoader); //PK83186

                                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                                    {
                                        if (originalLoader != ThreadContextAccessor.UNCHANGED)
                                        {
                                            Tr.debug(tc, "registerServant : old ClassLoader = " + originalLoader);
                                            Tr.debug(tc, "registerServant : new ClassLoader = " + ivBMD.classLoader);
                                        }
                                        else
                                        {
                                            Tr.debug(tc, "registerServant : current ClassLoader = " + ivBMD.classLoader);
                                        }
                                    }
                                }
                                ivRemoteObjectWrapper.container.getEJBRuntime().registerServant(ivRemoteObjectWrapper.beanId.getByteArray(), ivRemoteObjectWrapper);
                            } finally
                            {
                                EJBThreadData.svThreadContextAccessor.popContextClassLoaderForUnprivileged(originalLoader);
                            } // finally

                        } // if( !isZOS )

                        isRemoteRegistered = true;
                    } catch (Exception ex)
                    {
                        FFDCFilter.processException(ex, CLASS_NAME +
                                                        ".registerServant",
                                                    "184", this);
                        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                        {
                            Tr.event(tc, "Failed to register wrapper instance",
                                     new Object[] { ivRemoteObjectWrapper, ex });
                        }
                    }

                } // if ( !isRemoteRegistered )

            } // synchronized( ivRemoteObject )

        } // if ( ivRemoteObject != null )

    }
943694
static void register(Class<? extends URLStreamHandler> handlerClass) {
    checkArgument("Handler".equals(handlerClass.getSimpleName()));

    String pkg = handlerClass.getPackage().getName();
    int lastDot = pkg.lastIndexOf('.');
    checkArgument(lastDot > 0, "package for Handler (%s) must have a parent package", pkg);

    String parentPackage = pkg.substring(0, lastDot);

    String packages = System.getProperty(JAVA_PROTOCOL_HANDLER_PACKAGES);
    if (packages == null) {
      packages = parentPackage;
    } else {
      packages += "|" + parentPackage;
    }
    System.setProperty(JAVA_PROTOCOL_HANDLER_PACKAGES, packages);
  }
596480
public void register(Class<? extends ValueReader> reader) {

		Assert.notNull(reader, "Missing reader class!");
		boolean registered = false;

		Consumes found = reader.getAnnotation(Consumes.class);
		if (found != null) {
			MediaType[] consumes = MediaTypeHelper.getMediaTypes(found.value());
			if (consumes != null && consumes.length > 0) {
				for (MediaType type : consumes) {
					register(type, reader);
				}
			}
			registered = true;
		}

		Assert.isTrue(registered,
		              "Failed to register reader: '" + reader.getName() + "', missing @Consumes annotation!");
	}
166213
public void registerGenerator(String clazz) {

		ResourceGenerator generator = (ResourceGenerator) ClassLoaderResourceUtils.buildObjectInstance(clazz);

		if (null == generator.getResolver()) {
			throw new IllegalStateException("The getResolver() method must return something at " + clazz);
		}

		ResourceGeneratorResolver resolver = generator.getResolver();

		// Checks if another generator is already define with the same resolver
		for (ResourceGeneratorResolver resourceGeneratorResolver : resolverRegistry) {
			if (resourceGeneratorResolver.isSameAs(resolver)) {
				String generatorName = generator.getClass().getName();
				if (!clazz.equals(generatorName)) {
					String errorMsg = "Cannot register the generator of class " + generator.getClass().getName()
							+ " since the same resolver is being used by " + generatorName
							+ ". Please specify a different resolver in the getResolver() method.";
					throw new IllegalStateException(errorMsg);
				}
			}
		}

		// Warns the user about if the generator override a built-in generator
		Set<ResourceGeneratorResolver> commonResolvers = commonGenerators.keySet();
		for (ResourceGeneratorResolver commonGeneratorResolver : commonResolvers) {
			if (commonGeneratorResolver.isSameAs(resolver)) {
				String generatorName = generator.getClass().getName();
				LOGGER.warn("The custom generator '" + generatorName + "' override a built-in generator");
			}
		}

		initGenerator(generator);
	}
250682
public void activate() {
        if (appender instanceof OptionHandler) {
            ((OptionHandler) appender).activateOptions();
            if (LoggingLogger.ROOT_LOGGER.isDebugEnabled()) {
                LoggingLogger.ROOT_LOGGER.debugf("Invoking OptionHandler.activateOptions() on appender %s (%s)", appender.getName(), appender.getClass().getCanonicalName());
            }
        }
    }