Class ConstrainedDetector

java.lang.Object
rife.validation.instrument.ConstrainedDetector

public class ConstrainedDetector extends Object
Detects whether a class implements the Constrained interface or not, by analyzing its bytecode.
Since:
1.0
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates new instance by providing a loader that is able to retrieve the bytes of any parent classes that are extended by the class that is being analyzed.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    isConstrained(String internedClassname, byte[] bytes)
    Verifies if the Constrained interface is implemented by the class that is defined by the bytes that are provided.

    Methods inherited from class java.lang.Object

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

    • ConstrainedDetector

      public ConstrainedDetector(ClassBytesLoader bytesLoader)
      Creates new instance by providing a loader that is able to retrieve the bytes of any parent classes that are extended by the class that is being analyzed.
      Parameters:
      bytesLoader - the loader that will be used to retrieve the bytes of the additional classes
      Since:
      1.0
  • Method Details

    • isConstrained

      public boolean isConstrained(String internedClassname, byte[] bytes) throws ClassBytesNotFoundException
      Verifies if the Constrained interface is implemented by the class that is defined by the bytes that are provided.
      Parameters:
      internedClassname - the class name as the previously interned string
      bytes - the array of bytes that defines the class that needs to be analyzed
      Returns:
      true if the analyzed class implements the constrained interface; or

      false otherwise

      Throws:
      ClassBytesNotFoundException - when the bytes of a parent class can be found
      Since:
      1.0