Registers a FastWritable class for a given id (name). The names should be
unique, it is not possible to re-use a name for a different class. If we
re-register the same class, the object of the registered class must be the
same (the same reference).
420385
public static void register(FastWritableId id, FastWritable fw) {
    synchronized (FastWritableRegister.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 (fw == null) {
        throw new RuntimeException("Instance cannot be null");
      }
      FastWritable registeredWritable = register.get(name);
      if (registeredWritable != null && registeredWritable != fw) {
        throw new RuntimeException(
            "Trying to register different class with name: " + name);
      } else if (registeredWritable == fw) {
        return; //quietly
      } 
      LOG.info("FastWritable - Registering name: " + name);
      register.put(name, fw);
    }
  }
679719
public static void recordInstance(Object obj) {
		// obj will be a ClassPropertyFetcher instance
		System.err.println("new instance queued " + System.identityHashCode(obj));
		// TODO urgent - race condition here, can create Co-modification problem if adding whilst another thread is processing
		classPropertyFetcherInstances.add(new WeakReference<Object>(obj, rq));
	}
1371275
private UUID registerObject(final Object object) {
        UUID id = UUID.randomUUID();
        registerObject(object, id);
        return id;
    }
1190467
@Override
	public void registerUserObject(final Object iObject, final ORecordInternal<?> iRecord) {
		if (!(iRecord instanceof ODocument))
			return;

		final ODocument doc = (ODocument) iRecord;

		if (retainObjects) {

			final ORID rid = iRecord.getIdentity();
			if (rid.isValid())
				rid2Records.put(rid, doc);
		}
	}
192567
public static <T> void registerWriter(Class<?> cls, JsonWriterI<T> writer) {
		defaultWriter.registerWriter(writer, cls);
	}
465778
def setPageObject(className)
      if @pageObjectClassNameSpecified
        raise ParseException("Page object class name specified more than once")
      end
      @pageObjectClassNameSpecified = className
      pageObjectClass = classFromString(className)
      initializePageObject(pageObjectClass.new)
    end
394210
def register_serializer(name, serializer):
    '''
'''
    if not isclass(serializer):
        serializer = serializer.__class__
    _serializers[name] = serializer
623371
def register_instance(self, class_type, instance, register_as=None):
        
        registration = _InstanceRegistration(instance)
        self._register(class_type, registration, register_as)
444009
protected boolean needsUniqueID()
    {
        //
        // BUGBUG:
        // Pageflows need to have a more unique ID generated for fields, because multiple pageflows
        // may be shared within a single ControlContainerContext, and just using the field name could
        // result in collisions.  A better (and less hard-wired) approach is needed than searching for
        // specific annotations.   Perhaps a model that enables particular client types to subclass
        // AptControlClient and override getID() would be much better.
        //
        for (AnnotationMirror annotMirror : _clientDecl.getAnnotationMirrors())
        {
            String annotType = annotMirror.getAnnotationType().toString();
            if (annotType.equals("org.apache.beehive.netui.pageflow.annotations.Jpf.Controller") ||
                annotType.equals("org.apache.beehive.netui.pageflow.annotations.Jpf.Backing"))
                return true;
        }
        return false;
    }
294605
def register(self, cls, instance):
        
        if not issubclass(cls, DropletInterface):
            raise TypeError('Given class is not a NAZInterface subclass: %s'
                            % cls)

        if not isinstance(instance, cls):
            raise TypeError('Given instance does not implement the class: %s'
                            % instance)

        if instance.name in self.INSTANCES_BY_NAME:
            if self.INSTANCES_BY_NAME[instance.name] != instance:
                raise ValueError('Given name is registered '
                                 'by other instance: %s' % instance.name)

        self.INSTANCES_BY_INTERFACE[cls].add(instance)
        self.INSTANCES_BY_NAME[instance.name] = instance
1134347
public static void register(Alphabet alphabet) {
        if (alphabetsByName.put(alphabet.getAlphabetName(), alphabet) != null)
            throw new IllegalStateException("Alphabet with this name is already registered.");

        if (alphabetsById.put(alphabet.getId(), alphabet) != null)
            throw new IllegalStateException("Alphabet with this id is already registered.");
    }
745551
def register(id, &block)
      ref = __get id
      return ref.__getobj__ if ref && ref.weakref_alive?
      item = block.call
      return nil unless item
      __register id, item
    end
315329
def register(value, name):
        
        if value in TokenKind._value_map:
            raise ValueError('TokenKind already registered: %d' % value)

        kind = TokenKind(value, name)
        TokenKind._value_map[value] = kind
        setattr(TokenKind, name, kind)
1062505
def register_instance(self, instance: Any, allow_dotted_names: bool=False):
        
        if self.instance:
            raise RuntimeError("can only register one instance")
        self.instance = instance
        self.allow_dotted_names = allow_dotted_names
        return True
237018
protected function _register($id, $className)
    {
        $id = (string) $id;
        if (class_exists($className)) {
            self::$_loaded[$id] = $className;
            $this[$id] = function () use ($className) {
                return new $className();
            };
        } else {
            throw new Exception("Helper \"{{$className}}\" not found!");
        }
    }
1177584
public static String id(String name, ClassDefinition appender, Map<String, String> appenderArgs, ClassDefinition layout, Map<String, String> layoutArgs, int level,
	    boolean readOnly) {
	StringBuilder sb = new StringBuilder(name).append(';').append(appender).append(';');
	toString(sb, appenderArgs);
	sb.append(';').append(layout).append(';');
	toString(sb, layoutArgs);
	sb.append(';').append(level).append(';').append(readOnly);

	return HashUtil.create64BitHashAsString(sb.toString(), Character.MAX_RADIX);
    }
158530
public static void writeObject(DataOutput out, Object instance,
                                 Class declaredClass, 
                                 Configuration conf) throws IOException {

    if (instance == null) {                       // null
      instance = new NullInstance(declaredClass, conf);
      declaredClass = Writable.class;
    }
    
    // handle FastWritable first (including ShortVoid)
    if (instance instanceof FastWritable) {
      FastWritable fwInstance = (FastWritable) instance;
      byte[] serializedName = fwInstance.getSerializedName();
      out.write(serializedName, 0, serializedName.length);
      fwInstance.write(out);
      return;
    }
    
    // write declared name
    writeStringCached(out, declaredClass.getName());

    if (declaredClass.isArray()) {                // array
      int length = Array.getLength(instance);
      out.writeInt(length);
      for (int i = 0; i < length; i++) {
        writeObject(out, Array.get(instance, i),
                    declaredClass.getComponentType(), conf);
      }
      
    } else if (declaredClass == String.class) {   // String
      UTF8.writeStringOpt(out, (String)instance);
      
    } else if (declaredClass.isPrimitive()) {     // primitive type

      if (declaredClass == Boolean.TYPE) {        // boolean
        out.writeBoolean(((Boolean)instance).booleanValue());
      } else if (declaredClass == Character.TYPE) { // char
        out.writeChar(((Character)instance).charValue());
      } else if (declaredClass == Byte.TYPE) {    // byte
        out.writeByte(((Byte)instance).byteValue());
      } else if (declaredClass == Short.TYPE) {   // short
        out.writeShort(((Short)instance).shortValue());
      } else if (declaredClass == Integer.TYPE) { // int
        out.writeInt(((Integer)instance).intValue());
      } else if (declaredClass == Long.TYPE) {    // long
        out.writeLong(((Long)instance).longValue());
      } else if (declaredClass == Float.TYPE) {   // float
        out.writeFloat(((Float)instance).floatValue());
      } else if (declaredClass == Double.TYPE) {  // double
        out.writeDouble(((Double)instance).doubleValue());
      } else if (declaredClass == Void.TYPE) {    // void
      } else {
        throw new IllegalArgumentException("Not a primitive: "+declaredClass);
      }
    } else if (declaredClass.isEnum()) {         // enum
      writeStringCached(out, ((Enum)instance).name());
    } else if (Writable.class.isAssignableFrom(declaredClass)) { // Writable
      writeStringCached(out, instance.getClass().getName());
      ((Writable)instance).write(out);

    } else {
      throw new IOException("Can't write: "+instance+" as "+declaredClass);
    }
  }