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
|
||||
*/
|
||||
public abstract class AbstractAttributeKey {
|
||||
// todo : replace this with "{element}"
|
||||
private static final String COLLECTION_ELEMENT = "collection&&element";
|
||||
|
||||
private final AbstractAttributeKey parent;
|
||||
|
@ -56,37 +57,86 @@ public abstract class AbstractAttributeKey {
|
|||
this.fullPath = prefix + property;
|
||||
}
|
||||
|
||||
/**
|
||||
* How many "parts" are there to this path/role?
|
||||
*
|
||||
* @return The number of parts.
|
||||
*/
|
||||
public int getDepth() {
|
||||
return depth;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
/**
|
||||
* Access to the parent part
|
||||
*
|
||||
* @return the parent part
|
||||
*/
|
||||
public AbstractAttributeKey getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Access to the end path part.
|
||||
*
|
||||
* @return the end path part
|
||||
*/
|
||||
public String getProperty() {
|
||||
return property;
|
||||
}
|
||||
|
||||
/**
|
||||
* Access to the full path as a String
|
||||
*
|
||||
* @return The full path as a String
|
||||
*/
|
||||
public String getFullPath() {
|
||||
return fullPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does this part represent a root.
|
||||
*
|
||||
* @return {@code true} if this part is a root.
|
||||
*/
|
||||
public boolean isRoot() {
|
||||
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() {
|
||||
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
|
||||
public String toString() {
|
||||
return getFullPath();
|
||||
|
|
Loading…
Reference in New Issue