Package rife.validation.instrument
Class ConstrainedDetector
java.lang.Object
rife.validation.instrument.ConstrainedDetector
Detects whether a class implements the
Constrained interface or not,
by analyzing its bytecode.- Since:
- 1.0
-
Constructor Summary
ConstructorsConstructorDescriptionConstrainedDetector(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. -
Method Summary
Modifier and TypeMethodDescriptionbooleanisConstrained(String internedClassname, byte[] bytes) Verifies if the Constrained interface is implemented by the class that is defined by the bytes that are provided.
-
Constructor Details
-
ConstrainedDetector
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 stringbytes- the array of bytes that defines the class that needs to be analyzed- Returns:
trueif the analyzed class implements the constrained interface; orfalseotherwise- Throws:
ClassBytesNotFoundException- when the bytes of a parent class can be found- Since:
- 1.0
-