HHH-13496 Remove unused field typeScope from many CollectionType classes

This commit is contained in:
Sanne Grinovero 2019-07-05 12:42:36 +01:00
parent 6a4ede4ec2
commit e7165f2d43
15 changed files with 143 additions and 30 deletions

View File

@ -32,8 +32,16 @@ public class ArrayType extends CollectionType {
private final Class elementClass;
private final Class arrayClass;
/**
* @deprecated Use the other contructor
*/
@Deprecated
public ArrayType(TypeFactory.TypeScope typeScope, String role, String propertyRef, Class elementClass) {
super( typeScope, role, propertyRef );
this( role, propertyRef, elementClass );
}
public ArrayType(String role, String propertyRef, Class elementClass) {
super( role, propertyRef );
this.elementClass = elementClass;
arrayClass = Array.newInstance(elementClass, 0).getClass();
}

View File

@ -18,9 +18,16 @@ import org.hibernate.persister.collection.CollectionPersister;
public class BagType extends CollectionType {
@SuppressWarnings("WeakerAccess")
/**
* @deprecated Use the other contructor
*/
@Deprecated
public BagType(TypeFactory.TypeScope typeScope, String role, String propertyRef) {
super( typeScope, role, propertyRef );
this( role, propertyRef );
}
public BagType(String role, String propertyRef) {
super( role, propertyRef );
}
@Override

View File

@ -61,12 +61,18 @@ public abstract class CollectionType extends AbstractType implements Association
private static final Object NOT_NULL_COLLECTION = new MarkerObject( "NOT NULL COLLECTION" );
public static final Object UNFETCHED_COLLECTION = new MarkerObject( "UNFETCHED COLLECTION" );
private final TypeFactory.TypeScope typeScope;
private final String role;
private final String foreignKeyPropertyName;
/**
* @deprecated Use the other contructor
*/
@Deprecated
public CollectionType(TypeFactory.TypeScope typeScope, String role, String foreignKeyPropertyName) {
this.typeScope = typeScope;
this( role, foreignKeyPropertyName );
}
public CollectionType(String role, String foreignKeyPropertyName) {
this.role = role;
this.foreignKeyPropertyName = foreignKeyPropertyName;
}

View File

@ -40,7 +40,6 @@ import org.hibernate.tuple.component.ComponentTuplizer;
*/
public class ComponentType extends AbstractType implements CompositeType, ProcedureParameterExtractionAware {
private final TypeFactory.TypeScope typeScope;
private final String[] propertyNames;
private final Type[] propertyTypes;
private final ValueGeneration[] propertyValueGenerationStrategies;
@ -55,8 +54,16 @@ public class ComponentType extends AbstractType implements CompositeType, Proced
protected final EntityMode entityMode;
protected final ComponentTuplizer componentTuplizer;
/**
* @deprecated Use the other contructor
*/
@Deprecated
public ComponentType(TypeFactory.TypeScope typeScope, ComponentMetamodel metamodel) {
this.typeScope = typeScope;
this( metamodel );
}
public ComponentType(ComponentMetamodel metamodel) {
// for now, just "re-flatten" the metamodel since this is temporary stuff anyway (HHH-1907)
this.isKey = metamodel.isKey();
this.propertySpan = metamodel.getPropertySpan();

View File

@ -32,12 +32,23 @@ public class CustomCollectionType extends CollectionType {
private final UserCollectionType userType;
private final boolean customLogging;
/**
* @deprecated Use the other contructor
*/
@Deprecated
public CustomCollectionType(
TypeFactory.TypeScope typeScope,
Class userTypeClass,
String role,
String foreignKeyPropertyName) {
super( typeScope, role, foreignKeyPropertyName );
this( userTypeClass, role, foreignKeyPropertyName );
}
public CustomCollectionType(
Class userTypeClass,
String role,
String foreignKeyPropertyName) {
super( role, foreignKeyPropertyName );
userType = createUserCollectionType( userTypeClass );
customLogging = LoggableUserType.class.isAssignableFrom( userTypeClass );
}

View File

@ -16,8 +16,17 @@ import org.hibernate.tuple.component.ComponentMetamodel;
* @author Gavin King
*/
public class EmbeddedComponentType extends ComponentType {
/**
* @deprecated Use the other contructor
*/
@Deprecated
public EmbeddedComponentType(TypeFactory.TypeScope typeScope, ComponentMetamodel metamodel) {
super( typeScope, metamodel );
super( metamodel );
}
public EmbeddedComponentType(ComponentMetamodel metamodel) {
super( metamodel );
}
public boolean isEmbedded() {

View File

@ -17,8 +17,16 @@ import org.hibernate.persister.collection.CollectionPersister;
public class IdentifierBagType extends CollectionType {
/**
* @deprecated Use the other contructor
*/
@Deprecated
public IdentifierBagType(TypeFactory.TypeScope typeScope, String role, String propertyRef) {
super( typeScope, role, propertyRef );
this( role, propertyRef );
}
public IdentifierBagType(String role, String propertyRef) {
super( role, propertyRef );
}
@Override

View File

@ -17,8 +17,16 @@ import org.hibernate.persister.collection.CollectionPersister;
public class ListType extends CollectionType {
/**
* @deprecated Use the other contructor
*/
@Deprecated
public ListType(TypeFactory.TypeScope typeScope, String role, String propertyRef) {
super( typeScope, role, propertyRef );
this( role, propertyRef );
}
public ListType(String role, String propertyRef) {
super( role, propertyRef );
}
@Override

View File

@ -20,8 +20,16 @@ import org.hibernate.persister.collection.CollectionPersister;
public class MapType extends CollectionType {
/**
* @deprecated Use the other contructor
*/
@Deprecated
public MapType(TypeFactory.TypeScope typeScope, String role, String propertyRef) {
super( typeScope, role, propertyRef );
this( role, propertyRef );
}
public MapType(String role, String propertyRef) {
super( role, propertyRef );
}
@Override

View File

@ -12,8 +12,16 @@ import java.util.LinkedHashMap;
*/
public class OrderedMapType extends MapType {
/**
* @deprecated Use the other contructor
*/
@Deprecated
public OrderedMapType(TypeFactory.TypeScope typeScope, String role, String propertyRef) {
super( typeScope, role, propertyRef );
this( role, propertyRef );
}
public OrderedMapType(String role, String propertyRef) {
super( role, propertyRef );
}
@Override

View File

@ -12,8 +12,16 @@ import java.util.LinkedHashSet;
*/
public class OrderedSetType extends SetType {
/**
* @deprecated Use the other contructor
*/
@Deprecated
public OrderedSetType(TypeFactory.TypeScope typeScope, String role, String propertyRef) {
super( typeScope, role, propertyRef );
this( role, propertyRef );
}
public OrderedSetType(String role, String propertyRef) {
super( role, propertyRef );
}
@Override

View File

@ -16,8 +16,16 @@ import org.hibernate.persister.collection.CollectionPersister;
public class SetType extends CollectionType {
/**
* @deprecated Use the other contructor
*/
@Deprecated
public SetType(TypeFactory.TypeScope typeScope, String role, String propertyRef) {
super( typeScope, role, propertyRef );
this( role, propertyRef );
}
public SetType(String role, String propertyRef) {
super( role, propertyRef );
}
@Override

View File

@ -20,8 +20,16 @@ public class SortedMapType extends MapType {
private final Comparator comparator;
/**
* @deprecated Use the other contructor
*/
@Deprecated
public SortedMapType(TypeFactory.TypeScope typeScope, String role, String propertyRef, Comparator comparator) {
super( typeScope, role, propertyRef );
this( role, propertyRef, comparator );
}
public SortedMapType(String role, String propertyRef, Comparator comparator) {
super( role, propertyRef );
this.comparator = comparator;
}

View File

@ -16,10 +16,19 @@ import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.persister.collection.CollectionPersister;
public class SortedSetType extends SetType {
private final Comparator comparator;
/**
* @deprecated Use the other contructor
*/
@Deprecated
public SortedSetType(TypeFactory.TypeScope typeScope, String role, String propertyRef, Comparator comparator) {
super( typeScope, role, propertyRef );
this( role, propertyRef, comparator );
}
public SortedSetType(String role, String propertyRef, Comparator comparator) {
super( role, propertyRef );
this.comparator = comparator;
}

View File

@ -149,7 +149,7 @@ public final class TypeFactory implements Serializable {
catch (ClassNotFoundException cnfe) {
throw new MappingException( "user collection type class not found: " + typeName, cnfe );
}
CustomCollectionType result = new CustomCollectionType( typeScope, typeClass, role, propertyRef );
CustomCollectionType result = new CustomCollectionType( typeClass, role, propertyRef );
if ( typeParameters != null ) {
injectParameters( result.getUserType(), typeParameters );
}
@ -349,53 +349,53 @@ public final class TypeFactory implements Serializable {
// collection type builders ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
public CollectionType array(String role, String propertyRef, Class elementClass) {
return new ArrayType( typeScope, role, propertyRef, elementClass );
return new ArrayType( role, propertyRef, elementClass );
}
public CollectionType list(String role, String propertyRef) {
return new ListType( typeScope, role, propertyRef );
return new ListType( role, propertyRef );
}
public CollectionType bag(String role, String propertyRef) {
return new BagType( typeScope, role, propertyRef );
return new BagType( role, propertyRef );
}
public CollectionType idbag(String role, String propertyRef) {
return new IdentifierBagType( typeScope, role, propertyRef );
return new IdentifierBagType( role, propertyRef );
}
public CollectionType map(String role, String propertyRef) {
return new MapType( typeScope, role, propertyRef );
return new MapType( role, propertyRef );
}
public CollectionType orderedMap(String role, String propertyRef) {
return new OrderedMapType( typeScope, role, propertyRef );
return new OrderedMapType( role, propertyRef );
}
public CollectionType sortedMap(String role, String propertyRef, Comparator comparator) {
return new SortedMapType( typeScope, role, propertyRef, comparator );
return new SortedMapType( role, propertyRef, comparator );
}
public CollectionType set(String role, String propertyRef) {
return new SetType( typeScope, role, propertyRef );
return new SetType( role, propertyRef );
}
public CollectionType orderedSet(String role, String propertyRef) {
return new OrderedSetType( typeScope, role, propertyRef );
return new OrderedSetType( role, propertyRef );
}
public CollectionType sortedSet(String role, String propertyRef, Comparator comparator) {
return new SortedSetType( typeScope, role, propertyRef, comparator );
return new SortedSetType( role, propertyRef, comparator );
}
// component type builders ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
public ComponentType component(ComponentMetamodel metamodel) {
return new ComponentType( typeScope, metamodel );
return new ComponentType( metamodel );
}
public EmbeddedComponentType embeddedComponent(ComponentMetamodel metamodel) {
return new EmbeddedComponentType( typeScope, metamodel );
return new EmbeddedComponentType( metamodel );
}