Registers an object in the meta model if it is not already registered.

@param object
The object to register.
@return The id of the object. It doesn't matter if the object was just registered or already known.
18184
public UUID registerIfUnknown(final Object object) {
        final Optional<UUID> id = getId(object);
        if (!id.isPresent()) {
            return registerObject(object);
        }
        return id.get();
    }
1203078
@Override
    public ObjectInstance registerMBean(Object object, ObjectName name)
            throws MBeanRegistrationException, NotCompliantMBeanException
    {
        while (true) {
            try {
                // try to register the mbean
                return mbeanServer.registerMBean(object, name);
            }
            catch (InstanceAlreadyExistsException ignored) {
            }

            try {
                // a mbean is already installed, try to return the already registered instance
                ObjectInstance objectInstance = mbeanServer.getObjectInstance(name);
                log.debug("%s already bound to %s", name, objectInstance);
                return objectInstance;
            }
            catch (InstanceNotFoundException ignored) {
                // the mbean was removed before we could get the reference
                // start the whole process over again
            }
        }
    }
795787
public final void addObject(Object object) {
        if (object instanceof Iterable) {
            // Iterable
            for (Object o : (Iterable<?>) object) {
                objects.add(o);
            }
        } else if (object.getClass().isArray()) {
            // Array
            for (Object o : (Object[]) object) {
                objects.add(o);
            }
        } else {
            // Single object
            objects.add(object);
        }
    }
1186853
static final Object getObjectId(Object obj) {
        if (obj == null) {
            throw new NullPointerException();
        }
        if (!(obj instanceof ZooPC)) {
        	//non-peristent class
        	return null;
        }
        long id = Session.getObjectId(obj);
        //non-persistent object --> null
        return id >= 0 ? id : null;
    }
14226
private String buildObjectKey(final Object object) {

        String objectKey = null;
        final Class<?> objectClass = object.getClass();

        final KeyGenerator typeGenerator = objectClass.getAnnotation(KeyGenerator.class);
        if (typeGenerator == null) {
            objectKey = generateAggregatedKey(object);
        } else {
            objectKey = generateTypeKey(object, typeGenerator);
        }

        // If no Type keyGenerator neither Method Generator were used, use the default toString method
        if (objectKey == null) {
            objectKey = object.toString();
        }

        return objectKey;
    }
611186
public function isRegisteredValueObject($object)
    {
        if (!is_string($object)) {
            $object = get_class($object);
        }

        return array_key_exists($object, $this->valueClasses);
    }
705159
public static void register( String name,
                                 Object obj ) {
        register(name, obj, null, null, null, null);
    }
509951
public <T extends DObject> T registerObject (T object)
    {
        if (_dobjThread != null && !isDispatchThread()) {
            log.warning("Registering DObject on non-dobject thread",
                        "class", object.getClass().getName(), new Exception());
        }

        int oid = getNextOid();

        // initialize this object
        object.setOid(oid);
        object.setManager(this);

        // set the default access controller if a controller hasn't already been specified
        if (object.getAccessController() == null) {
            object.setAccessController(_defaultController);
        }

        // insert it into the table
        _objects.put(oid, object);

//         log.info("Registered object", "obj", object);

        return object;
    }
680081
def register(self, obj, force=False):
        
        if isinstance(obj, orb.Database):
            scope = self.__databases
            key = obj.code()
        elif isinstance(obj, orb.Schema):
            scope = self.__schemas
            key = obj.name()
        else:
            raise orb.errors.OrbError('Unknown object to register: {0}'.format(obj))

        try:
            existing = self.__schemas[obj.name()]
        except KeyError:
            pass
        else:
            if existing != obj and not force:
                raise orb.errors.DuplicateEntryFound('{0} is already a registered {1}.'.format(key, typ))

        scope[key] = obj
        return True
235411
public void registerObject(final JsiiObjectRef objRef, final Object obj) {
        if (obj instanceof JsiiObject) {
            ((JsiiObject) obj).setObjRef(objRef);
        }
        this.objects.put(objRef.getObjId(), obj);
    }
315706
private void registerRenderer(Object object)
	{
		//get the classes to use to render
		Pair<Class<? extends MalisisRenderer<?>>, Class<? extends MalisisRenderer<?>>> rendererClasses = getRendererClasses(object);
		if (rendererClasses == null)
			return;

		//get the block renderer
		MalisisRenderer<?> renderer = null;
		try
		{
			renderer = getRenderer(rendererClasses.getLeft());
		}
		catch (InstantiationException | IllegalAccessException e)
		{
			MalisisCore.log.error(	"[MalisisRegistry] Failed to load {} renderer for {}",
									rendererClasses.getLeft().getSimpleName(),
									object.getClass().getSimpleName(),
									e);
			return;
		}

		//register the block renderer
		if (object instanceof Block && renderer != null)
		{
			blockRenderers.put((Block) object, renderer);
			object = Item.getItemFromBlock((Block) object);
		}

		//get the item renderer
		try
		{
			renderer = getRenderer(rendererClasses.getRight());
		}
		catch (InstantiationException | IllegalAccessException e)
		{
			MalisisCore.log.error(	"[MalisisRegistry] Failed to load {} renderer for {}",
									rendererClasses.getLeft().getSimpleName(),
									object.getClass().getSimpleName());
			return;
		}

		//register the item renderer
		if (object != Items.AIR && renderer != null)
		{
			itemRenderers.put((Item) object, renderer);
		}
	}
1261698
public void registerListenersOnEverything(final Object object) {
        try {
            // the removeListener() call ensures that the listener is not added more than once
            new PropertyVisitor(object) {
                @Override
                protected boolean visitSingleValueProperty(final Property<?> fieldValue) {
                    fieldValue.removeListener(propertyListener);
                    fieldValue.addListener(propertyListener);
                    return true;
                }

                @Override
                protected boolean visitCollectionProperty(final ListProperty<?> fieldValue) {
                    fieldValue.removeListener(listListener);
                    fieldValue.addListener(listListener);
                    return true;
                }

                @Override
                protected boolean visitCollectionProperty(final MapProperty<?, ?> fieldValue) {
                    fieldValue.removeListener(mapListener);
                    fieldValue.addListener(mapListener);
                    return true;
                }

                @Override
                protected boolean visitCollectionProperty(final SetProperty<?> fieldValue) {
                    fieldValue.removeListener(setListener);
                    fieldValue.addListener(setListener);
                    return false;
                }
            };
        } catch (final IllegalAccessException e) {
            topology.onError(new SynchronizeFXException(e));
        } catch (final SecurityException e) {
            topology.onError(new SynchronizeFXException(
                    "Maybe you're JVM doesn't allow reflection for this application?", e));
        }
    }
153104
public static void registerObject(String id, Object obj) {
    DefaultMonitorRegistry.getInstance().register(newObjectMonitor(id, obj));
  }
266503
public static function set($object, $key = null) {
        if (!is_object($object)) {
            throw new InvalidObjectException('The object to register must be instantiated');
        }

        if (!$key) {
            $key = get_class($object);
        }

        static::$_registered[$key] = $object;

        return $object;
    }
378126
@SuppressWarnings("unchecked")
    private T getAttached(T object) {
        if (entityManager.contains(object)) {
            return object;
        } else {
            return findOne((I) entityManager.getEntityManagerFactory()
                    .getPersistenceUnitUtil().getIdentifier(object));
        }
    }
86851
public static function getIdentifier(ObjectManager $om, $object)
    {
        $propertyAccess = PropertyAccess::createPropertyAccessor();
        $meta = $om->getClassMetadata(ClassUtils::getClass($object));
        $ids = $meta->getIdentifier();
        $value = null;

        foreach ($ids as $id) {
            $idVal = $propertyAccess->getValue($object, $id);

            if (null !== $idVal) {
                $value = $idVal;

                break;
            }
        }

        return $value;
    }
611063
function registerObject(mediaObject, id) {
    var object = objects[id];
    if (object) return object;

    mediaObject.emit('_id', null, id);

    objects[id] = mediaObject;

    /**
     * Remove the object from cache
     */
    mediaObject.once('release', function () {
      delete objects[id];
    });

    return mediaObject;
  }