/** * Returns {@code true} if the given key has already been registered. This is used to prevent * reentrant metadata registration (and cycles). */ public boolean isRegistered(ElementKey<?, ?> key) { RootKey rootKey = Schema.getRootKey(key); ElementMetadataRegistryBuilder elementRegistry = elements.get(rootKey); if (elementRegistry != null) { return elementRegistry.isRegistered(null, key, null); } return false; }
/** * Returns the existing element registry for the given key, or creates it if it does not already * exist. */ private synchronized AttributeMetadataRegistryBuilder getOrCreateAttribute(AttributeKey<?> key) { RootKey rootKey = Schema.getRootKey(key); AttributeMetadataRegistryBuilder attRegistry = attributes.get(rootKey); if (attRegistry == null) { attRegistry = new AttributeMetadataRegistryBuilder(this); attributes.put(rootKey, attRegistry); } dirty(); return attRegistry; }
/** * Returns the existing element registry for the given key, or creates it if it does not already * exist. */ private synchronized ElementMetadataRegistryBuilder getOrCreateElement(ElementKey<?, ?> key) { RootKey rootKey = Schema.getRootKey(key); ElementMetadataRegistryBuilder elementRegistry = elements.get(rootKey); if (elementRegistry == null) { elementRegistry = new ElementMetadataRegistryBuilder(this); elements.put(rootKey, elementRegistry); } dirty(); return elementRegistry; }