com.anasoft.os.daofusion.criteria
Class AssociationPath

java.lang.Object
  extended by com.anasoft.os.daofusion.criteria.AssociationPath
All Implemented Interfaces:
java.lang.Iterable<AssociationPath>

public class AssociationPath
extends java.lang.Object
implements java.lang.Iterable<AssociationPath>

Association path which points to the given property of the target persistent entity.

Association path starts at the target persistent entity as the root object, navigating through associated objects as necessary. This way, nested property criteria which operate on associated objects can be easily defined by the user. Note that the association path does not include the target property itself.

This class is immutable by design so you can safely reuse its instances across the code.

Author:
michal.jemala, vojtech.szocs
See Also:
AssociationPathElement, AssociationPathRegister

Field Summary
static AssociationPath ROOT
          Shorthand constant for an empty association path which essentially points to target criteria root.
static java.lang.String SEPARATOR
           
static java.lang.String SEPARATOR_REGEX
           
 
Constructor Summary
AssociationPath(AssociationPath prefix, AssociationPathElement... elements)
          Creates a new association path with rootPath elements placed at the beginning, followed by elements in consequence.
AssociationPath(AssociationPathElement... elements)
          Creates a new association path.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.lang.String getAlias()
          Returns the alias for this association path.
 AssociationPathElement getLastElement()
          Returns the last element of this association path or null in case the association path is empty.
 AssociationPath getSuperPath()
          Returns the "super path" for this association path.
 int hashCode()
           
 java.util.Iterator<AssociationPath> iterator()
          Returns an iterator over AssociationPath instances for this association path.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SEPARATOR

public static final java.lang.String SEPARATOR
See Also:
Constant Field Values

SEPARATOR_REGEX

public static final java.lang.String SEPARATOR_REGEX
See Also:
Constant Field Values

ROOT

public static final AssociationPath ROOT
Shorthand constant for an empty association path which essentially points to target criteria root.

Constructor Detail

AssociationPath

public AssociationPath(AssociationPathElement... elements)
Creates a new association path.

Parameters:
elements - Association path elements.

AssociationPath

public AssociationPath(AssociationPath prefix,
                       AssociationPathElement... elements)
Creates a new association path with rootPath elements placed at the beginning, followed by elements in consequence.

Parameters:
prefix - Association path prefix (elements to be placed at the beginning of this association path).
elements - Association path elements.
Method Detail

getLastElement

public AssociationPathElement getLastElement()
Returns the last element of this association path or null in case the association path is empty.

Returns:
Last element of this association path (can be null).

getSuperPath

public AssociationPath getSuperPath()
Returns the "super path" for this association path.

Super path includes all path elements except the last one.

Returns:
Super path for this association path.

getAlias

public java.lang.String getAlias()
Returns the alias for this association path.

This method is used by AssociationPathRegister when creating Criteria instances so that these instances can be reused by referencing their aliases.

Returns:
Alias for this association path.

iterator

public java.util.Iterator<AssociationPath> iterator()
Returns an iterator over AssociationPath instances for this association path.

The resulting iterator follows a custom logic based on the order of contained association path elements. For example, an iterator over the association path "a.b.c" will produce following paths:

  1. a
  2. a.b
  3. a.b.c
Note that the Iterator.remove() operation is not supported.

Specified by:
iterator in interface java.lang.Iterable<AssociationPath>
See Also:
Iterable.iterator()

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2008-2009 ANASOFT and contributors. All Rights Reserved.