Class AttachPoint

java.lang.Object
org.moeaframework.analysis.collector.AttachPoint

public abstract class AttachPoint extends Object
Identifies objects in an object graph (all public and private fields contained within an object and those it references). For instance,
   AttachPoint.isClass(TypeA.class).and(AttachPoint.isNestedIn(TypeB.class)
 
will match any objects of type TypeA that are referenced (or accessible through) an object of type TypeB.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Protected constructor to prevent instantiation, but allow subclassing.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns an attach point which performs the logical AND between two attach points, matching an object only if both attach points match the object.
    isClass(Class<?> type)
    Returns an attach point that matches an object if its type is equal to the specified type.
    isDeclaredIn(Class<?> parentType)
    Returns an attach point that matches an object if it is a declared field of the specified type.
    isNestedIn(Class<?> ancestorType)
    Returns an attach point that matches an object if it is nested inside a class of the specified type.
    isSubclass(Class<?> type)
    Returns an attach point that matches an object if it is an instance of the specified type.
    abstract boolean
    matches(Stack<Object> parents, Object object)
    Returns true if the specified object in the object graph matches some criteria; and false otherwise.
    Returns an attach point which performs the logical NOT on the given attach point, matching an object only if the attach point does not match the object.
    Returns an attach point which performs the logical OR between two attach points, matching an object if either or both of the attach points match the object.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AttachPoint

      protected AttachPoint()
      Protected constructor to prevent instantiation, but allow subclassing.
  • Method Details

    • and

      public AttachPoint and(AttachPoint that)
      Returns an attach point which performs the logical AND between two attach points, matching an object only if both attach points match the object.
      Parameters:
      that - the second attach point
      Returns:
      an attach point which performs the logical AND between two attach points
    • or

      public AttachPoint or(AttachPoint that)
      Returns an attach point which performs the logical OR between two attach points, matching an object if either or both of the attach points match the object.
      Parameters:
      that - the second attach point
      Returns:
      an attach point which performs the logical OR between two attach points
    • not

      public static AttachPoint not(AttachPoint that)
      Returns an attach point which performs the logical NOT on the given attach point, matching an object only if the attach point does not match the object.
      Parameters:
      that - the original attach point
      Returns:
      an attach point which performs the logical NOT on the given attach point
    • isClass

      public static AttachPoint isClass(Class<?> type)
      Returns an attach point that matches an object if its type is equal to the specified type. Note that subclasses of the type will not match.
      Parameters:
      type - the required type of the object
      Returns:
      an attach point that matches an object if its type is equal to the specified type
    • isSubclass

      public static AttachPoint isSubclass(Class<?> type)
      Returns an attach point that matches an object if it is an instance of the specified type. The specified type and all subclasses will match.
      Parameters:
      type - the required type/supertype of the object
      Returns:
      an attach point that matches an object if it is an instance of the specified type
    • isDeclaredIn

      public static AttachPoint isDeclaredIn(Class<?> parentType)
      Returns an attach point that matches an object if it is a declared field of the specified type.
      Parameters:
      parentType - the parent type
      Returns:
      an attach point that matches an object if it is a declared field of the specified type
    • isNestedIn

      public static AttachPoint isNestedIn(Class<?> ancestorType)
      Returns an attach point that matches an object if it is nested inside a class of the specified type. This includes both declared fields of the specified type and all fields accessible by recursively following all references.
      Parameters:
      ancestorType - the ancestor type
      Returns:
      an attach point that matches an object if it is nested inside a class of the specified type
    • matches

      public abstract boolean matches(Stack<Object> parents, Object object)
      Returns true if the specified object in the object graph matches some criteria; and false otherwise.
      Parameters:
      parents - the path from the root (starting) object to the current object
      object - the current object
      Returns:
      true if the specified object in the object graph matches some criteria; and false otherwise