All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hibernate.boot.model.source.spi.AttributePath Maven / Gradle / Ivy

There is a newer version: 7.0.0.Alpha1
Show newest version
/*
 * 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;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy