org.hibernate.boot.model.source.spi.AttributePath Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate-core Show documentation
Show all versions of hibernate-core Show documentation
Hibernate's core ORM functionality
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or .
*/
package org.hibernate.boot.model.source.spi;
/**
* An attribute path is, generally speaking, the path of attribute names back
* to a "root" (which is either an entity or a persistent collection). The
* name of this root typically is not included in the path.
*
* @author Steve Ebersole
*/
public class AttributePath extends AbstractAttributeKey {
public static final char DELIMITER = '.';
public AttributePath() {
super();
}
@Override
protected char getDelimiter() {
return DELIMITER;
}
@Override
public AttributePath append(String property) {
return new AttributePath( this, property );
}
@Override
public AttributePath getParent() {
return (AttributePath) super.getParent();
}
public AttributePath(AttributePath parent, String property) {
super( parent, property );
}
public static AttributePath parse(String path) {
if ( path == null ) {
return null;
}
AttributePath attributePath = new AttributePath();
for ( String part : path.split( "\\." ) ) {
attributePath = attributePath.append( part );
}
return attributePath;
}
}