HHH-10863 - Improve consistency of how we call implicitNamingStrategy.determineBasicColumnName with element collections
This commit is contained in:
parent
7f3a3bcbcc
commit
5b5d2b6559
|
@ -12,6 +12,7 @@ import org.hibernate.internal.util.StringHelper;
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractAttributeKey {
|
public abstract class AbstractAttributeKey {
|
||||||
|
// todo : replace this with "{element}"
|
||||||
private static final String COLLECTION_ELEMENT = "collection&&element";
|
private static final String COLLECTION_ELEMENT = "collection&&element";
|
||||||
|
|
||||||
private final AbstractAttributeKey parent;
|
private final AbstractAttributeKey parent;
|
||||||
|
@ -56,37 +57,86 @@ public abstract class AbstractAttributeKey {
|
||||||
this.fullPath = prefix + property;
|
this.fullPath = prefix + property;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* How many "parts" are there to this path/role?
|
||||||
|
*
|
||||||
|
* @return The number of parts.
|
||||||
|
*/
|
||||||
public int getDepth() {
|
public int getDepth() {
|
||||||
return depth;
|
return depth;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract char getDelimiter();
|
protected abstract char getDelimiter();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new AbstractAttributeKey by appending the passed part.
|
||||||
|
*
|
||||||
|
* @param property The part to append
|
||||||
|
*
|
||||||
|
* @return The new AbstractAttributeKey
|
||||||
|
*/
|
||||||
public abstract AbstractAttributeKey append(String property);
|
public abstract AbstractAttributeKey append(String property);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Access to the parent part
|
||||||
|
*
|
||||||
|
* @return the parent part
|
||||||
|
*/
|
||||||
public AbstractAttributeKey getParent() {
|
public AbstractAttributeKey getParent() {
|
||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Access to the end path part.
|
||||||
|
*
|
||||||
|
* @return the end path part
|
||||||
|
*/
|
||||||
public String getProperty() {
|
public String getProperty() {
|
||||||
return property;
|
return property;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Access to the full path as a String
|
||||||
|
*
|
||||||
|
* @return The full path as a String
|
||||||
|
*/
|
||||||
public String getFullPath() {
|
public String getFullPath() {
|
||||||
return fullPath;
|
return fullPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Does this part represent a root.
|
||||||
|
*
|
||||||
|
* @return {@code true} if this part is a root.
|
||||||
|
*/
|
||||||
public boolean isRoot() {
|
public boolean isRoot() {
|
||||||
return parent == null;
|
return parent == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true if the current property is a collection element marker
|
* Does this part represent a collection-element reference?
|
||||||
|
*
|
||||||
|
* @return {@code true} if the current property is a collection element
|
||||||
|
* marker ({@link #COLLECTION_ELEMENT}
|
||||||
*/
|
*/
|
||||||
public boolean isCollectionElement() {
|
public boolean isCollectionElement() {
|
||||||
return COLLECTION_ELEMENT.equals( property );
|
return COLLECTION_ELEMENT.equals( property );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Does any part represent a collection-element reference?
|
||||||
|
*
|
||||||
|
* @return {@code true} if this part or any parent part is a collection element
|
||||||
|
* marker ({@link #COLLECTION_ELEMENT}.
|
||||||
|
*/
|
||||||
|
public boolean isPartOfCollectionElement() {
|
||||||
|
return fullPath.contains( '.' + COLLECTION_ELEMENT );
|
||||||
|
}
|
||||||
|
|
||||||
|
public String stripCollectionElementMarker() {
|
||||||
|
return fullPath.replace( '.' + COLLECTION_ELEMENT, "" );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return getFullPath();
|
return getFullPath();
|
||||||
|
|
Loading…
Reference in New Issue