Spring Data Commons

org.springframework.data.mapping.context
Interface PersistentPropertyPath<T extends PersistentProperty<T>>

All Superinterfaces:
Iterable<T>

public interface PersistentPropertyPath<T extends PersistentProperty<T>>
extends Iterable<T>

Abstraction of a path of PersistentPropertys.

Author:
Oliver Gierke

Method Summary
 T getBaseProperty()
          Returns the first property in the PersistentPropertyPath.
 PersistentPropertyPath<T> getExtensionForBaseOf(PersistentPropertyPath<T> base)
          Returns the sub-path of the current one as if it was based on the given base path.
 T getLeafProperty()
          Returns the last property in the PersistentPropertyPath.
 int getLength()
          Returns the length of the PersistentPropertyPath.
 PersistentPropertyPath<T> getParentPath()
          Returns the parent path of the current PersistentPropertyPath, i.e. the path without the leaf property.
 boolean isBasePathOf(PersistentPropertyPath<T> path)
          Returns whether the given PersistentPropertyPath is a base path of the current one.
 String toDotPath()
          Returns the dot based path notation using PersistentProperty.getName().
 String toDotPath(Converter<? super T,String> converter)
          Returns the dot based path notation using the given Converter to translate individual PersistentPropertys to path segments.
 String toPath(String delimiter)
          Returns a String path with the given delimiter based on the PersistentProperty.getName().
 String toPath(String delimiter, Converter<? super T,String> converter)
          Returns a String path with the given delimiter using the given Converter for PersistentProperty to String conversion.
 
Methods inherited from interface java.lang.Iterable
iterator
 

Method Detail

toDotPath

String toDotPath()
Returns the dot based path notation using PersistentProperty.getName().

Returns:

toDotPath

String toDotPath(Converter<? super T,String> converter)
Returns the dot based path notation using the given Converter to translate individual PersistentPropertys to path segments.

Parameters:
converter -
Returns:

toPath

String toPath(String delimiter)
Returns a String path with the given delimiter based on the PersistentProperty.getName().

Parameters:
delimiter - will default to . if null is given.
Returns:

toPath

String toPath(String delimiter,
              Converter<? super T,String> converter)
Returns a String path with the given delimiter using the given Converter for PersistentProperty to String conversion.

Parameters:
delimiter - will default to . if null is given.
converter - will default to use PersistentProperty.getName().
Returns:

getLeafProperty

T getLeafProperty()
Returns the last property in the PersistentPropertyPath. So for foo.bar it will return the PersistentProperty for bar. For a simple foo it returns PersistentProperty for foo.

Returns:

getBaseProperty

T getBaseProperty()
Returns the first property in the PersistentPropertyPath. So for foo.bar it will return the PersistentProperty for foo. For a simple foo it returns PersistentProperty for foo.

Returns:

isBasePathOf

boolean isBasePathOf(PersistentPropertyPath<T> path)
Returns whether the given PersistentPropertyPath is a base path of the current one. This means that the current PersistentPropertyPath is basically an extension of the given one.

Parameters:
path -
Returns:

getExtensionForBaseOf

PersistentPropertyPath<T> getExtensionForBaseOf(PersistentPropertyPath<T> base)
Returns the sub-path of the current one as if it was based on the given base path. So for a current path foo.bar and a given base foo it would return bar. If the given path is not a base of the the current one the current PersistentPropertyPath will be returned as is.

Parameters:
base -
Returns:

getParentPath

PersistentPropertyPath<T> getParentPath()
Returns the parent path of the current PersistentPropertyPath, i.e. the path without the leaf property. This happens up to the base property. So for a direct property reference calling this method will result in returning the property.

Returns:

getLength

int getLength()
Returns the length of the PersistentPropertyPath.

Returns:

Spring Data Commons

Copyright © 2012. All Rights Reserved.