Registers a FastProtocol's method for a given id (name). The names should
be unique, it is not possible to re-use a name for a different method.
188327
public static void register(FastProtocolId id, Method m) {
    synchronized (FastProtocolRegister.class) {
      String name = id.toString();
      if (name.length() != NAME_LEN) {
        // we only allow two-byte serialization codes
        throw new RuntimeException("Code must be " + NAME_LEN + " bytes long");
      }
      if (m == null) {
        throw new RuntimeException("Method cannot be null");
      }
      Method registeredMethod = idToMethod.get(name);
      if (registeredMethod != null && registeredMethod != m) {
        throw new RuntimeException(
            "Trying to register different method with name: " + name);
      } else if (registeredMethod == m) {
        return; // quietly
      }
      LOG.info("FastProtocol - Registering method: " + name + " method: "
          + m.getName());
      idToMethod.put(name, m);
      methodToId.put(m, name);
    }
  }
1053195
private static SyntaxType register(String id, String name)
    {
        SyntaxType syntaxType = new SyntaxType(id, name);
        KNOWN_SYNTAX_TYPES.put(id, syntaxType);
        return syntaxType;
    }
153104
public static void registerObject(String id, Object obj) {
    DefaultMonitorRegistry.getInstance().register(newObjectMonitor(id, obj));
  }
1100521
public void registerServiceHandler(String name, Object handler) {
        Map<String, Object> serviceHandlers = getServiceHandlers();
        serviceHandlers.put(name, handler);
    }
392757
def register_id(self, id, module):
        """"""
        assert isinstance(id, basestring)
        assert isinstance(module, basestring)
        self.id2module[id] = module
823081
static <J> MethodId<J> MethodId(String name) {
		for (Method m : JavacTreeMaker.class.getDeclaredMethods()) {
			if (m.getName().equals(name)) {
				@SuppressWarnings("unchecked") Class<J> r = (Class<J>) m.getReturnType();
				Class<?>[] p = m.getParameterTypes();
				return new MethodId<J>(TreeMaker.class, name, r, p);
			}
		}
		
		throw new InternalError("Not found: " + name);
	}
188011
protected void registerStaticMethod(final String name, final Closure callable, final Class[] paramTypes) {
        performOperationOnMetaClass(new Callable() {
            public void call() {
                String methodName;
                if (name.equals(METHOD_MISSING))
                    methodName = STATIC_METHOD_MISSING;
                else if (name.equals(PROPERTY_MISSING))
                    methodName = STATIC_PROPERTY_MISSING;
                else
                    methodName = name;

                ClosureStaticMetaMethod metaMethod = null;

                if (paramTypes != null) {
                    metaMethod = new ClosureStaticMetaMethod(methodName, theClass, callable, paramTypes);
                } else {
                    metaMethod = new ClosureStaticMetaMethod(methodName, theClass, callable);
                }

                if (methodName.equals(INVOKE_METHOD_METHOD) && callable.getParameterTypes().length == 2) {
                    invokeStaticMethodMethod = metaMethod;
                } else {
                    if (methodName.equals(METHOD_MISSING)) {
                        methodName = STATIC_METHOD_MISSING;
                    }
                    MethodKey key = new DefaultCachedMethodKey(theClass, methodName, metaMethod.getParameterTypes(), false);

                    addMetaMethod(metaMethod);
                    dropStaticMethodCache(methodName);
//                    cacheStaticMethod(key,metaMethod);

                    if (isGetter(methodName, metaMethod.getParameterTypes())) {
                        String propertyName = getPropertyForGetter(methodName);
                        registerBeanPropertyForMethod(metaMethod, propertyName, true, true);

                    } else if (isSetter(methodName, metaMethod.getParameterTypes())) {
                        String propertyName = getPropertyForSetter(methodName);
                        registerBeanPropertyForMethod(metaMethod, propertyName, false, true);
                    }
                    performRegistryCallbacks();
                    expandoMethods.put(key, metaMethod);
                }
            }

        });
    }
1010368
public void register(String name, HealthCheck healthCheck) {
        HealthCheck registered;
        synchronized (lock) {
            if (healthChecks.containsKey(name)) {
                throw new IllegalArgumentException("A health check named " + name + " already exists");
            }
            registered = healthCheck;
            if (healthCheck.getClass().isAnnotationPresent(Async.class)) {
                registered = new AsyncHealthCheckDecorator(healthCheck, asyncExecutorService);
            }
            healthChecks.put(name, registered);
        }
        onHealthCheckAdded(name, registered);
    }
992439
public void putFunctionForId(String id, DifferentialFunction function) {
        if (ops.containsKey(id) && ops.get(id).getOp() == null) {
            throw new ND4JIllegalStateException("Function by id already exists!");
        } else if (function instanceof SDVariable) {
            throw new ND4JIllegalStateException("Function must not be a variable!");
        }

        if(ops.containsKey(id)){

        } else {
            ops.put(id, SameDiffOp.builder().name(id).op(function).build());
        }
    }
981306
def register_blueprint(self, blueprint, **options):
        '''
        
        '''
        first_registration = False
        if blueprint.name in self.blueprints:
            assert self.blueprints[blueprint.name] is blueprint, \
                'A blueprint\'s name collision occurred between %r and ' \
                '%r.  Both share the same name "%s".  Blueprints that ' \
                'are created on the fly need unique names.' % \
                (blueprint, self.blueprints[blueprint.name], blueprint.name)
        else:
            self.blueprints[blueprint.name] = blueprint
            first_registration = True
        blueprint.register(self, options, first_registration)
1270037
def register(self, name, obj):
        """"""
        if name in self.all:
            log.debug('register: %s already existed: %s', name, obj.name)
            # code.interact(local=locals())
            raise DuplicateDefinitionException(
                'register: %s already existed: %s' % (name, obj.name))
        log.debug('register: %s ', name)
        self.all[name] = obj
        return obj
438327
public void addIdentifiableObject(String id, T idObject) {

        m_cache = null;
        if (m_uniqueIds && (m_objectsById.get(id) != null)) {
            removeObject(id);
        }
        if (m_relativeOrdered) {
            float pos = 1;
            if (!m_orderedObjectList.isEmpty()) {
                pos = m_orderedObjectList.get(m_orderedObjectList.size() - 1).getPosition() + 1;
            }
            m_orderedObjectList.add(new CmsIdObjectElement<T>(idObject, pos));
        } else {
            m_objectList.add(idObject);
        }
        if (m_uniqueIds) {
            m_objectsById.put(id, idObject);
        } else {
            List<T> prevObj = m_objectsListsById.get(id);
            if (prevObj == null) {
                List<T> list = new ArrayList<T>();
                list.add(idObject);
                m_objectsListsById.put(id, list);
            } else {
                prevObj.add(idObject);
            }
        }

    }
865136
public void setId(Object id) {
	  if (lock == SET) {
		 throw new IllegalStateException("EntryInfo is locked");
	  }
	  /*if (idFlag == SET) {
		 if (tc.isDebugEnabled()) Tr.debug(tc, "Illegal State: tried to set id to "+id+
											   ", but id was already set to "+this.id  );
		  throw new IllegalStateException("id was already set");
	  } */
	  idFlag = SET;
	  this.id = id;
	  if (tc.isDebugEnabled())
		 Tr.debug(tc, "set id=" + id);
   }
738524
def register(self, *paths, methods=None, name=None, handler=None):
        
        if isinstance(methods, str):
            methods = [methods]

        def wrapper(view):
            if handler is None:

                handler_ = view
                methods_ = methods or [METH_ANY]

                if isfunction(handler_) or ismethod(handler_):
                    handler_ = Handler.from_view(view, *methods_, name=name)

                handler_.bind(self, *paths, methods=methods_, name=name)

            else:

                view_name = view.__name__
                if not hasattr(handler, view_name):
                    setattr(handler, view_name, to_coroutine(view))
                name_ = name or view_name
                handler.bind(self, *paths, methods=methods, name=name_, view=view_name)

            return view

        # Support for @app.register(func)
        if len(paths) == 1 and callable(paths[0]):
            view = paths[0]

            if isclass(view) and issubclass(view, BaseException):
                return wrapper

            paths = []
            return wrapper(view)

        return wrapper
767605
public static void register(int id, Class<? extends Tag> tag) throws TagRegisterException {
        if(idToTag.containsKey(id)) {
            throw new TagRegisterException("Tag ID \"" + id + "\" is already in use.");
        }

        if(tagToId.containsKey(tag)) {
            throw new TagRegisterException("Tag \"" + tag.getSimpleName() + "\" is already registered.");
        }

        idToTag.put(id, tag);
        tagToId.put(tag, id);
    }
889092
def define_fast_methods_for_model(name, options)
      join_table = options[:join_table]
      join_column_name = name.to_s.downcase.singularize
      define_method "fast_#{join_column_name}_ids_insert" do |*args|
        table_name = self.class.table_name.singularize
        insert = M2MFastInsert::Base.new id, join_column_name, table_name, join_table, *args
        insert.fast_insert
      end
    end
933952
def register(cls, name):
        

        def decorate(klazz):
            """ Decorator. """
            if name in cls._events:
                raise GerritError("Duplicate event: %s" % name)
            cls._events[name] = [klazz.__module__, klazz.__name__]
            klazz.name = name
            return klazz
        return decorate