Spring Data Commons

org.springframework.data.mapping
Class PropertyPath

java.lang.Object
  extended by org.springframework.data.mapping.PropertyPath
All Implemented Interfaces:
Iterable<PropertyPath>

public class PropertyPath
extends Object
implements Iterable<PropertyPath>

Abstraction of a PropertyPath of a domain class.

Author:
Oliver Gierke

Method Summary
 boolean equals(Object obj)
           
static PropertyPath from(String source, Class<?> type)
          Extracts the PropertyPath chain from the given source String and type.
static PropertyPath from(String source, TypeInformation<?> type)
          Extracts the PropertyPath chain from the given source String and TypeInformation.
 PropertyPath getLeafProperty()
          Returns the leaf property of the PropertyPath.
 TypeInformation<?> getOwningType()
          Returns the owning type of the PropertyPath.
 String getSegment()
          Returns the name of the PropertyPath.
 Class<?> getType()
          Returns the type of the property will return the plain resolved type for simple properties, the component type for any Iterable or the value type of a Map if the property is one.
 int hashCode()
           
 boolean hasNext()
          Returns whether there is a nested PropertyPath.
 boolean isCollection()
          Returns whether the PropertyPath is actually a collection.
 Iterator<PropertyPath> iterator()
           
 PropertyPath next()
          Returns the next nested PropertyPath.
 String toDotPath()
          Returns the PropertyPath in dot notation.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getOwningType

public TypeInformation<?> getOwningType()
Returns the owning type of the PropertyPath.

Returns:
the owningType will never be null.

getSegment

public String getSegment()
Returns the name of the PropertyPath.

Returns:
the name will never be null.

getLeafProperty

public PropertyPath getLeafProperty()
Returns the leaf property of the PropertyPath.

Returns:
will never be null.

getType

public Class<?> getType()
Returns the type of the property will return the plain resolved type for simple properties, the component type for any Iterable or the value type of a Map if the property is one.

Returns:

next

public PropertyPath next()
Returns the next nested PropertyPath.

Returns:
the next nested PropertyPath or null if no nested PropertyPath available.
See Also:
hasNext()

hasNext

public boolean hasNext()
Returns whether there is a nested PropertyPath. If this returns true you can expect next() to return a non- null value.

Returns:

toDotPath

public String toDotPath()
Returns the PropertyPath in dot notation.

Returns:

isCollection

public boolean isCollection()
Returns whether the PropertyPath is actually a collection.

Returns:

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

iterator

public Iterator<PropertyPath> iterator()
Specified by:
iterator in interface Iterable<PropertyPath>

from

public static PropertyPath from(String source,
                                Class<?> type)
Extracts the PropertyPath chain from the given source String and type.

Parameters:
source -
type -
Returns:

from

public static PropertyPath from(String source,
                                TypeInformation<?> type)
Extracts the PropertyPath chain from the given source String and TypeInformation.

Parameters:
source - must not be null.
type -
Returns:

Spring Data Commons

Copyright © 2012. All Rights Reserved.