diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/FetchProfileSourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/FetchProfileSourceImpl.java new file mode 100644 index 0000000000..9f76ba2d5b --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/FetchProfileSourceImpl.java @@ -0,0 +1,101 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * Copyright (c) 2012, Red Hat Inc. or third-party contributors as + * indicated by the @author tags or express copyright attribution + * statements applied by the authors. All third-party contributions are + * distributed under license by Red Hat Inc. + * + * This copyrighted material is made available to anyone wishing to use, modify, + * copy, or redistribute it subject to the terms and conditions of the GNU + * Lesser General Public License, as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this distribution; if not, write to: + * Free Software Foundation, Inc. + * 51 Franklin Street, Fifth Floor + * Boston, MA 02110-1301 USA + */ +package org.hibernate.metamodel.internal.source.annotations; + +import java.util.ArrayList; +import java.util.List; + +import org.jboss.jandex.AnnotationInstance; + +import org.hibernate.MappingException; +import org.hibernate.annotations.FetchMode; +import org.hibernate.metamodel.spi.binding.FetchProfile; +import org.hibernate.metamodel.spi.source.FetchProfileSource; + +/** + * @author Steve Ebersole + */ +public class FetchProfileSourceImpl implements FetchProfileSource { + private final String name; + private final List associationOverrideSources; + + public FetchProfileSourceImpl(AnnotationInstance fetchProfileAnnotation) { + this.name = JandexHelper.getValue( fetchProfileAnnotation, "name", String.class ); + this.associationOverrideSources = buildAssociationOverrideSources( fetchProfileAnnotation ); + } + + @Override + public String getName() { + return name; + } + + @Override + public Iterable getAssociationOverrides() { + return associationOverrideSources; + } + + private static List buildAssociationOverrideSources(AnnotationInstance fetchProfileAnnotation) { + final List associationOverrideSources = new ArrayList(); + AnnotationInstance[] overrideAnnotations = JandexHelper.getValue( + fetchProfileAnnotation, + "fetchOverrides", + AnnotationInstance[].class + ); + for ( AnnotationInstance overrideAnnotation : overrideAnnotations ) { + associationOverrideSources.add( new AssociationOverrideSourceImpl( overrideAnnotation ) ); + } + return associationOverrideSources; + } + + private static class AssociationOverrideSourceImpl implements AssociationOverrideSource { + private final String entityName; + private final String attributeName; + private final String fetchMode; + + private AssociationOverrideSourceImpl(AnnotationInstance overrideAnnotation) { + this.entityName = JandexHelper.getValue( overrideAnnotation, "entity", String.class ); + this.attributeName = JandexHelper.getValue( overrideAnnotation, "association", String.class ); + FetchMode fetchMode = JandexHelper.getEnumValue( overrideAnnotation, "mode", FetchMode.class ); + if ( !fetchMode.equals( org.hibernate.annotations.FetchMode.JOIN ) ) { + throw new MappingException( "Only FetchMode.JOIN is currently supported" ); + } + this.fetchMode = "join"; + } + + @Override + public String getEntityName() { + return entityName; + } + + @Override + public String getAttributeName() { + return attributeName; + } + + @Override + public String getFetchModeName() { + return fetchMode; + } + } +} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/FilterDefSourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/FilterDefSourceImpl.java new file mode 100644 index 0000000000..f90999b0a4 --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/FilterDefSourceImpl.java @@ -0,0 +1,90 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * Copyright (c) 2012, Red Hat Inc. or third-party contributors as + * indicated by the @author tags or express copyright attribution + * statements applied by the authors. All third-party contributions are + * distributed under license by Red Hat Inc. + * + * This copyrighted material is made available to anyone wishing to use, modify, + * copy, or redistribute it subject to the terms and conditions of the GNU + * Lesser General Public License, as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this distribution; if not, write to: + * Free Software Foundation, Inc. + * 51 Franklin Street, Fifth Floor + * Boston, MA 02110-1301 USA + */ +package org.hibernate.metamodel.internal.source.annotations; + +import java.util.ArrayList; +import java.util.List; + +import org.jboss.jandex.AnnotationInstance; + +import org.hibernate.metamodel.spi.source.FilterDefSource; +import org.hibernate.metamodel.spi.source.FilterParameterSource; + +/** + * @author Steve Ebersole + */ +public class FilterDefSourceImpl implements FilterDefSource { + private final String name; + private final String condition; + private List parameterSources; + + public FilterDefSourceImpl(AnnotationInstance filerDefAnnotation) { + this.name = JandexHelper.getValue( filerDefAnnotation, "name", String.class ); + this.condition = JandexHelper.getValue( filerDefAnnotation, "defaultCondition", String.class ); + this.parameterSources = buildParameterSources( filerDefAnnotation ); + } + + private List buildParameterSources(AnnotationInstance filerDefAnnotation) { + final List parameterSources = new ArrayList(); + for ( AnnotationInstance paramAnnotation : JandexHelper.getValue( filerDefAnnotation, "parameters", AnnotationInstance[].class ) ) { + parameterSources.add( new FilterParameterSourceImpl( paramAnnotation ) ); + } + return parameterSources; + } + + @Override + public String getName() { + return name; + } + + @Override + public String getCondition() { + return condition; + } + + @Override + public Iterable getParameterSources() { + return parameterSources; + } + + private static class FilterParameterSourceImpl implements FilterParameterSource { + private final String name; + private final String type; + + public FilterParameterSourceImpl(AnnotationInstance paramAnnotation) { + this.name = JandexHelper.getValue( paramAnnotation, "name", String.class ); + this.type = JandexHelper.getValue( paramAnnotation, "type", String.class ); + } + + @Override + public String getParameterName() { + return name; + } + + @Override + public String getParameterValueTyeName() { + return type; + } + } +} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/ConfigurationValueSource.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/FilterSourceImpl.java similarity index 62% rename from hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/ConfigurationValueSource.java rename to hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/FilterSourceImpl.java index fc2c053a9c..e0ec460644 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/ConfigurationValueSource.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/FilterSourceImpl.java @@ -21,25 +21,31 @@ * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA */ -package org.hibernate.metamodel.spi.source; +package org.hibernate.metamodel.internal.source.annotations; + +import org.jboss.jandex.AnnotationInstance; + +import org.hibernate.metamodel.spi.source.FilterSource; /** - * Defines a source of configuration value. - * * @author Steve Ebersole */ -public interface ConfigurationValueSource { - /** - * Get the configuration name. - * - * @return The configuration name - */ - public String getName(); +public class FilterSourceImpl implements FilterSource { + private final String name; + private final String condition; - /** - * Get the configuration value - * - * @return The configuration value. - */ - public String getValue(); + public FilterSourceImpl(AnnotationInstance filerDefAnnotation) { + this.name = JandexHelper.getValue( filerDefAnnotation, "name", String.class ); + this.condition = JandexHelper.getValue( filerDefAnnotation, "condition", String.class ); + } + + @Override + public String getName() { + return name; + } + + @Override + public String getCondition() { + return condition; + } } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/TypeDescriptorSourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/TypeDescriptorSourceImpl.java new file mode 100644 index 0000000000..bb165d1cb3 --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/TypeDescriptorSourceImpl.java @@ -0,0 +1,107 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * Copyright (c) 2012, Red Hat Inc. or third-party contributors as + * indicated by the @author tags or express copyright attribution + * statements applied by the authors. All third-party contributions are + * distributed under license by Red Hat Inc. + * + * This copyrighted material is made available to anyone wishing to use, modify, + * copy, or redistribute it subject to the terms and conditions of the GNU + * Lesser General Public License, as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this distribution; if not, write to: + * Free Software Foundation, Inc. + * 51 Franklin Street, Fifth Floor + * Boston, MA 02110-1301 USA + */ +package org.hibernate.metamodel.internal.source.annotations; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import org.jboss.jandex.AnnotationInstance; + +import org.hibernate.AnnotationException; +import org.hibernate.internal.util.StringHelper; +import org.hibernate.metamodel.spi.source.TypeDescriptorSource; + +/** + * @author Steve Ebersole + */ +public class TypeDescriptorSourceImpl implements TypeDescriptorSource { + private final String name; + private final String implementationClassName; + private final String registrationKey; + + private Map parameterValueMap; + + public TypeDescriptorSourceImpl(AnnotationInstance typeDefAnnotation) { + this.name = JandexHelper.getValue( typeDefAnnotation, "name", String.class ); + this.implementationClassName = JandexHelper.getValue( typeDefAnnotation, "typeClass", String.class ); + + String defaultForType = JandexHelper.getValue( typeDefAnnotation, "defaultForType", String.class ); + if ( defaultForType != null ) { + if ( void.class.getName().equals( defaultForType ) ) { + defaultForType = null; + } + } + registrationKey = defaultForType; + + if ( StringHelper.isEmpty( name ) && registrationKey == null ) { + throw new AnnotationException( + String.format( + "Either name or defaultForType (or both) must be set on TypeDef [%s]", + implementationClassName + ) + ); + } + + this.parameterValueMap = extractParameterValues( typeDefAnnotation ); + } + + private Map extractParameterValues(AnnotationInstance typeDefAnnotation) { + Map parameterMaps = new HashMap(); + AnnotationInstance[] parameterAnnotations = JandexHelper.getValue( + typeDefAnnotation, + "parameters", + AnnotationInstance[].class + ); + for ( AnnotationInstance parameterAnnotation : parameterAnnotations ) { + parameterMaps.put( + JandexHelper.getValue( parameterAnnotation, "name", String.class ), + JandexHelper.getValue( parameterAnnotation, "value", String.class ) + ); + } + return parameterMaps; + } + + @Override + public String getName() { + return name; + } + + @Override + public String getTypeImplementationClassName() { + return implementationClassName; + } + + @Override + public Iterable getRegistrationKeys() { + return registrationKey == null + ? Collections.emptyList() + : Collections.singletonList( registrationKey ); + } + + @Override + public Map getParameters() { + return parameterValueMap; + } +} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/FetchProfileSourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/FetchProfileSourceImpl.java new file mode 100644 index 0000000000..89c0ce4874 --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/FetchProfileSourceImpl.java @@ -0,0 +1,88 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * Copyright (c) 2012, Red Hat Inc. or third-party contributors as + * indicated by the @author tags or express copyright attribution + * statements applied by the authors. All third-party contributions are + * distributed under license by Red Hat Inc. + * + * This copyrighted material is made available to anyone wishing to use, modify, + * copy, or redistribute it subject to the terms and conditions of the GNU + * Lesser General Public License, as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this distribution; if not, write to: + * Free Software Foundation, Inc. + * 51 Franklin Street, Fifth Floor + * Boston, MA 02110-1301 USA + */ +package org.hibernate.metamodel.internal.source.hbm; + +import java.util.ArrayList; +import java.util.List; + +import org.hibernate.internal.jaxb.mapping.hbm.JaxbFetchProfileElement; +import org.hibernate.metamodel.spi.source.FetchProfileSource; + +/** + * @author Steve Ebersole + */ +public class FetchProfileSourceImpl implements FetchProfileSource { + private final String name; + private final List associationOverrideSources; + + public FetchProfileSourceImpl(JaxbFetchProfileElement fetchProfileElement) { + this.name = fetchProfileElement.getName(); + this.associationOverrideSources = buildAssociationOverrideSources( fetchProfileElement ); + } + + @Override + public String getName() { + return name; + } + + @Override + public Iterable getAssociationOverrides() { + return associationOverrideSources; + } + + private static List buildAssociationOverrideSources(JaxbFetchProfileElement fetchProfileElement) { + final List associationOverrideSources = new ArrayList(); + for ( JaxbFetchProfileElement.JaxbFetch fetch : fetchProfileElement.getFetch() ) { + associationOverrideSources.add( new AssociationOverrideSourceImpl( fetch ) ); + } + return associationOverrideSources; + } + + private static class AssociationOverrideSourceImpl implements AssociationOverrideSource { + private final String entityName; + private final String attributeName; + private final String fetchMode; + + private AssociationOverrideSourceImpl(JaxbFetchProfileElement.JaxbFetch fetchElement) { + this.entityName = fetchElement.getEntity(); + this.attributeName = fetchElement.getAssociation(); + this.fetchMode = fetchElement.getStyle(); + } + + @Override + public String getEntityName() { + return entityName; + } + + @Override + public String getAttributeName() { + return attributeName; + } + + @Override + public String getFetchModeName() { + return fetchMode; + } + } +} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/FilterDefSourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/FilterDefSourceImpl.java new file mode 100644 index 0000000000..c5f70aa4cd --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/FilterDefSourceImpl.java @@ -0,0 +1,97 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * Copyright (c) 2012, Red Hat Inc. or third-party contributors as + * indicated by the @author tags or express copyright attribution + * statements applied by the authors. All third-party contributions are + * distributed under license by Red Hat Inc. + * + * This copyrighted material is made available to anyone wishing to use, modify, + * copy, or redistribute it subject to the terms and conditions of the GNU + * Lesser General Public License, as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this distribution; if not, write to: + * Free Software Foundation, Inc. + * 51 Franklin Street, Fifth Floor + * Boston, MA 02110-1301 USA + */ +package org.hibernate.metamodel.internal.source.hbm; + +import java.util.ArrayList; +import java.util.List; + +import org.hibernate.internal.jaxb.mapping.hbm.JaxbHibernateMapping; +import org.hibernate.metamodel.spi.source.FilterDefSource; +import org.hibernate.metamodel.spi.source.FilterParameterSource; + +/** + * @author Steve Ebersole + */ +public class FilterDefSourceImpl implements FilterDefSource { + private final String name; + private final String condition; + private List parameterSources; + + public FilterDefSourceImpl(JaxbHibernateMapping.JaxbFilterDef filterDefElement) { + this.name = filterDefElement.getName(); + + String conditionAttribute = filterDefElement.getCondition(); + String conditionContent = null; + + final List parameterSources = new ArrayList(); + for ( Object content : filterDefElement.getContent() ) { + if ( String.class.isInstance( content ) ){ + conditionContent = (String) content; + } + else { + parameterSources.add( + new FilterParameterSourceImpl( (JaxbHibernateMapping.JaxbFilterDef.JaxbFilterParam) content ) + ); + } + } + + this.condition = Helper.coalesce( conditionContent, conditionAttribute ); + this.parameterSources = parameterSources; + } + + @Override + public String getName() { + return name; + } + + @Override + public String getCondition() { + return condition; + } + + @Override + public Iterable getParameterSources() { + return parameterSources; + } + + private static class FilterParameterSourceImpl implements FilterParameterSource { + private final String name; + private final String type; + + public FilterParameterSourceImpl(JaxbHibernateMapping.JaxbFilterDef.JaxbFilterParam filterParamElement) { + this.name = filterParamElement.getName(); + this.type = filterParamElement.getType(); + } + + @Override + public String getParameterName() { + return name; + } + + @Override + public String getParameterValueTyeName() { + return type; + } + } +} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/FilterSourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/FilterSourceImpl.java new file mode 100644 index 0000000000..47527db2f3 --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/FilterSourceImpl.java @@ -0,0 +1,53 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * Copyright (c) 2012, Red Hat Inc. or third-party contributors as + * indicated by the @author tags or express copyright attribution + * statements applied by the authors. All third-party contributions are + * distributed under license by Red Hat Inc. + * + * This copyrighted material is made available to anyone wishing to use, modify, + * copy, or redistribute it subject to the terms and conditions of the GNU + * Lesser General Public License, as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this distribution; if not, write to: + * Free Software Foundation, Inc. + * 51 Franklin Street, Fifth Floor + * Boston, MA 02110-1301 USA + */ +package org.hibernate.metamodel.internal.source.hbm; + +import org.hibernate.internal.jaxb.mapping.hbm.JaxbFilterElement; +import org.hibernate.metamodel.spi.source.FilterSource; + +/** + * @author Steve Ebersole + */ +public class FilterSourceImpl implements FilterSource { + private final String name; + private final String condition; + + public FilterSourceImpl(JaxbFilterElement filterElement) { + this.name = filterElement.getName(); + + String conditionAttribute = filterElement.getCondition(); + String conditionContent = filterElement.getValue(); + this.condition = Helper.coalesce( conditionContent, conditionAttribute ); + } + + @Override + public String getName() { + return name; + } + + @Override + public String getCondition() { + return condition; + } +} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/Helper.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/Helper.java index c2797c4769..2c3c749ff5 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/Helper.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/Helper.java @@ -259,6 +259,33 @@ public class Helper { return Identifier.toIdentifier( name ); } + /** + * Operates like SQL coalesce expression, except empty strings are treated as null. Return the first non-empty value + * + * @param values The list of values. + * @param + * + * @return The first non-empty value, or null if all values were empty + */ + public static T coalesce(T... values) { + if ( values == null ) { + return null; + } + for ( T value : values ) { + if ( value != null ) { + if ( String.class.isInstance( value ) ) { + if ( StringHelper.isNotEmpty( (String) value ) ) { + return value; + } + } + else { + return value; + } + } + } + return null; + } + /** * For things that define one or more "value sources" there is a lot of variance in terms of how they * look in the XML. As an example, consider {@code } which might have:
    diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/TypeDescriptorSourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/TypeDescriptorSourceImpl.java new file mode 100644 index 0000000000..18cc3aa32a --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/TypeDescriptorSourceImpl.java @@ -0,0 +1,65 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * Copyright (c) 2012, Red Hat Inc. or third-party contributors as + * indicated by the @author tags or express copyright attribution + * statements applied by the authors. All third-party contributions are + * distributed under license by Red Hat Inc. + * + * This copyrighted material is made available to anyone wishing to use, modify, + * copy, or redistribute it subject to the terms and conditions of the GNU + * Lesser General Public License, as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this distribution; if not, write to: + * Free Software Foundation, Inc. + * 51 Franklin Street, Fifth Floor + * Boston, MA 02110-1301 USA + */ +package org.hibernate.metamodel.internal.source.hbm; + +import java.util.Collections; +import java.util.Map; + +import org.hibernate.internal.jaxb.mapping.hbm.JaxbHibernateMapping; +import org.hibernate.metamodel.spi.source.TypeDescriptorSource; + +/** + * @author Steve Ebersole + */ +public class TypeDescriptorSourceImpl implements TypeDescriptorSource { + private final String name; + private final String implementationClassName; + private final Map params; + + public TypeDescriptorSourceImpl(JaxbHibernateMapping.JaxbTypedef typeDefElement) { + this.name = typeDefElement.getName(); + this.implementationClassName = typeDefElement.getClazz(); + this.params = Helper.extractParameters( typeDefElement.getParam() ); + } + + @Override + public String getName() { + return name; + } + + @Override + public String getTypeImplementationClassName() { + return implementationClassName; + } + + @Override + public Iterable getRegistrationKeys() { + return Collections.emptyList(); + } + + @Override + public Map getParameters() { + return params; + } +} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/FetchProfileSource.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/FetchProfileSource.java index dc79904ce2..5ab891f361 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/FetchProfileSource.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/FetchProfileSource.java @@ -50,11 +50,11 @@ public interface FetchProfileSource { public String getAttributeName(); /** - * Retrieve the fetch mode to be applied to the association as part of this profile. + * Retrieve the name of the fetch mode to be applied to the association as part of this profile. * - * @return the fetch mode. + * @return the fetch mode name. */ - public FetchMode getFetchMode(); + public String getFetchModeName(); } /** diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/FilterSource.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/FilterSource.java index 6f7b959d38..a40cb8b317 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/FilterSource.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/FilterSource.java @@ -46,15 +46,4 @@ public interface FilterSource { * @see {@link org.hibernate.metamodel.spi.source.FilterDefSource#getCondition()} */ public String getCondition(); - - /** - * Retrieves the defined sources of parameter information pertaining to this filer. - *

    - * Will be merged with parameter sources associated with matching "filter def" - * - * @return The parameter sources defined on the filter. - * - * @see {@link org.hibernate.metamodel.spi.source.FilterDefSource#getParameterSources()} - */ - public Iterable getParameterSources(); } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/TypeDescriptorSource.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/TypeDescriptorSource.java index 5b8aba1c5d..f86e942a44 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/TypeDescriptorSource.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/TypeDescriptorSource.java @@ -23,6 +23,8 @@ */ package org.hibernate.metamodel.spi.source; +import java.util.Map; + /** * Describes the source of a custom type description. For example, {@code } or * {@link org.hibernate.annotations.TypeDef @TypeDef} @@ -30,8 +32,39 @@ package org.hibernate.metamodel.spi.source; * @author Steve Ebersole */ public interface TypeDescriptorSource { + /** + * Retrieve the name of the type def. + * + * @return The name. + */ public String getName(); + + /** + * Retrieve the name of the class implementing {@link org.hibernate.type.Type}, + * {@link org.hibernate.usertype.UserType}, etc. + * + * @return The implementation class name. + */ public String getTypeImplementationClassName(); + + /** + * For what are termed "basic types" there is a registry that contain the type keyed by various + * keys. This is the mechanism that allows a "string type" to reference to by "string", "java.lang.String", + * etc in the mapping. This method returns the keys under which this type should be registered in + * that registry. + *

    + * Note that if the type def contains registration keys, it should be considered illegal for its + * corresponding {@link ExplicitHibernateTypeSource} to define parameters. + * + * @return The registration keys for the type built from this type def. + */ public Iterable getRegistrationKeys(); - public Iterable getConfigurationValueSources(); + + /** + * Types accept configuration. The values here represent the user supplied values that will be given + * to the type instance after instantiation + * + * @return The configuration parameters from the underlying source. + */ + public Map getParameters(); }