All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hibernate.boot.model.source.spi.ToolingHintContext Maven / Gradle / Ivy

There is a newer version: 7.0.0.Alpha1
Show newest version
/*
 * Hibernate, Relational Persistence for Idiomatic Java
 *
 * License: GNU Lesser General Public License (LGPL), version 2.1 or later.
 * See the lgpl.txt file in the root directory or .
 */
package org.hibernate.boot.model.source.spi;

import java.util.Collection;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

import org.hibernate.mapping.MetaAttribute;

/**
 * Represents a collection of "tooling hints" ({@code } mapping info) keyed by a name.
 * 

* NOTE : historically these were called "meta attributes", but as these are values used solely * by external tooling it was decided to begin calling them tooling hints. For temporary * backwards compatibility (temporary until we move away from o.h.mapping model) you will * see mixed usage. * * @author Steve Ebersole */ public class ToolingHintContext { private final ConcurrentMap toolingHintMap = new ConcurrentHashMap(); public ToolingHintContext(ToolingHintContext baseline) { if ( baseline == null ) { return; } for ( ToolingHint toolingHint : baseline.toolingHintMap.values() ) { if ( toolingHint.isInheritable() ) { toolingHintMap.put( toolingHint.getName(), toolingHint ); } } } public Collection getToolingHints() { return toolingHintMap.values(); } public Iterable getKeys() { return toolingHintMap.keySet(); } public ToolingHint getToolingHint(String key) { return toolingHintMap.get( key ); } public void add(ToolingHint toolingHint) { toolingHintMap.put( toolingHint.getName(), toolingHint ); } /** * The {@link org.hibernate.mapping} package accepts these as a Map, so for now * expose the underlying Map. But we unfortunately need to collect a Map... * * @return The underlying Map */ public Map getMetaAttributeMap() { final Map collectedAttributeMap = new ConcurrentHashMap(); for ( ToolingHint toolingHint : toolingHintMap.values() ) { collectedAttributeMap.put( toolingHint.getName(), toolingHint.asMetaAttribute() ); } return collectedAttributeMap; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy