Search in sources :

Example 1 with ToolingHint

use of org.hibernate.boot.model.source.spi.ToolingHint in project hibernate-orm by hibernate.

the class Helper method collectToolingHints.

private static ToolingHintContext collectToolingHints(ToolingHintContext baseline, ToolingHintContainer toolingHintContainer, boolean onlyInheritable) {
    final ToolingHintContext localToolingHints = new ToolingHintContext(baseline);
    if (toolingHintContainer != null && toolingHintContainer.getToolingHints() != null) {
        for (JaxbHbmToolingHintType toolingHintJaxbBinding : toolingHintContainer.getToolingHints()) {
            if (onlyInheritable && !toolingHintJaxbBinding.isInheritable()) {
                continue;
            }
            final String hintName = toolingHintJaxbBinding.getName();
            ToolingHint toolingHint = localToolingHints.getToolingHint(hintName);
            if (toolingHint == null) {
                toolingHint = new ToolingHint(hintName, toolingHintJaxbBinding.isInheritable());
                localToolingHints.add(toolingHint);
            } else {
                if (baseline != null) {
                    final ToolingHint inherited = baseline.getToolingHint(hintName);
                    if (toolingHint == inherited) {
                        // overriding inherited meta attribute. HBX-621 & HBX-793
                        toolingHint = new ToolingHint(hintName, toolingHintJaxbBinding.isInheritable());
                        localToolingHints.add(toolingHint);
                    }
                }
            }
            toolingHint.addValue(toolingHintJaxbBinding.getValue());
        }
    }
    return localToolingHints;
}
Also used : JaxbHbmToolingHintType(org.hibernate.boot.jaxb.hbm.spi.JaxbHbmToolingHintType) ToolingHintContext(org.hibernate.boot.model.source.spi.ToolingHintContext) ToolingHint(org.hibernate.boot.model.source.spi.ToolingHint)

Aggregations

JaxbHbmToolingHintType (org.hibernate.boot.jaxb.hbm.spi.JaxbHbmToolingHintType)1 ToolingHint (org.hibernate.boot.model.source.spi.ToolingHint)1 ToolingHintContext (org.hibernate.boot.model.source.spi.ToolingHintContext)1