public class InterfaceChecker
extends java.lang.Object
Constructor and Description |
---|
InterfaceChecker(java.lang.Class<?> ModelClass,
java.lang.Class<?> ClassToCheck,
InterfaceCheckerI18n lang)
Initialization of methods, constructors, fields of each class, and the
language of the results
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
compareClass()
Let new private elements but not public ones
|
java.lang.String |
compareClass(boolean publicAllowed)
Chooses permission on private elements but extra public ones are not
allowed
|
java.lang.String |
compareClass(boolean publicAllowed,
boolean noPublicRestricted)
Compares both classes
|
boolean |
compareFields(java.lang.reflect.Field fModel,
java.lang.reflect.Field fTesting)
Compares two fields
|
es.ulpgc.junit4vpl.runner.InterfaceChecker.similarity |
compareMethods(java.lang.reflect.Method mModel,
java.lang.reflect.Method mTesting)
Compares two methods
|
java.lang.String |
formatFieldName(java.lang.reflect.Field field)
Returns a String with the name of a field
|
java.lang.String |
formatMethodName(java.lang.reflect.Constructor<?> constructor,
java.lang.String testingName)
Returns the name of a constructor using the testing class name
|
java.lang.String |
formatMethodName(java.lang.reflect.Method method,
java.lang.String testingName)
Returns a String giving an appropriate format to a method name
|
java.lang.String |
hideDefaultPackage(java.lang.String className)
Hides "java.lang." from a full class name
|
static int |
LevDistance(java.lang.String a,
java.lang.String b)
Calculates the Levenshtein's distance between two strings
|
java.lang.String |
mustExtends(java.lang.String superClassName,
boolean inheritRestriction)
Checks if it extends the class given and return the differences
|
java.lang.String |
mustImplements(java.lang.String... iModels)
Checks if the given interfaces are implemented and return the differences
|
java.lang.reflect.Constructor<?> |
similarConstructorName(java.lang.String name,
java.lang.reflect.Constructor<?> constructors)
Compares a name with a list of constructors
|
java.lang.reflect.Field |
similarFieldName(java.lang.String name,
java.util.List<java.lang.reflect.Field> fields)
Compares a name with a list of fields
|
java.lang.reflect.Method |
similarMethodName(java.lang.String name,
java.lang.reflect.Method method)
Compares a name with a list of methods
|
public InterfaceChecker(java.lang.Class<?> ModelClass, java.lang.Class<?> ClassToCheck, InterfaceCheckerI18n lang)
ModelClass
- - Class used as a modelClassToCheck
- - Class to be comparedlang
- - Language of the result messagespublic java.lang.String compareClass(boolean publicAllowed, boolean noPublicRestricted)
publicAllowed
- - If this parameter is set true, you allow the ClassToCheck to
have extra public elementsnoPublicRestricted
- - If this parameter is set true, you don't allow the
ClassToCheck to have extra no public elementspublic java.lang.String compareClass()
public java.lang.String compareClass(boolean publicAllowed)
publicAllowed
- If this parameter is set true, you allow the ClassToCheck to
have extra public elementspublic java.lang.String mustImplements(java.lang.String... iModels)
iModels
- Name of the interfaces to implementpublic java.lang.String mustExtends(java.lang.String superClassName, boolean inheritRestriction)
superClassName
- Name of the superclass you want to compare withinheritRestriction
- Decides whether the superclass have to be the same as in the
model (true) or can be a subclass of it (false)public boolean compareFields(java.lang.reflect.Field fModel, java.lang.reflect.Field fTesting)
fModel
- Model fieldfTesting
- Testing fieldpublic es.ulpgc.junit4vpl.runner.InterfaceChecker.similarity compareMethods(java.lang.reflect.Method mModel, java.lang.reflect.Method mTesting)
mModel
- Model methodmTesting
- Testing methodpublic static int LevDistance(java.lang.String a, java.lang.String b)
a
- One of the String to compareb
- The other String to comparepublic java.lang.reflect.Field similarFieldName(java.lang.String name, java.util.List<java.lang.reflect.Field> fields)
name
- Name of to filed to search forfields
- The list of fields where to lookpublic java.lang.reflect.Constructor<?> similarConstructorName(java.lang.String name, java.lang.reflect.Constructor<?> constructors)
name
- Name of to constructor to search forconstructors
- The list of constructors where to lookpublic java.lang.reflect.Method similarMethodName(java.lang.String name, java.lang.reflect.Method method)
name
- Name of to method to search formethod
- The list of methods where to lookpublic java.lang.String hideDefaultPackage(java.lang.String className)
className
- The full class namepublic java.lang.String formatFieldName(java.lang.reflect.Field field)
field
- The field to get the namepublic java.lang.String formatMethodName(java.lang.reflect.Constructor<?> constructor, java.lang.String testingName)
constructor
- The constructortestingName
- Used for showing the testing name, not the model onepublic java.lang.String formatMethodName(java.lang.reflect.Method method, java.lang.String testingName)
method
- The method to get the nametestingName
- Used for showing the testing name, not the model one