Package caseine.reflect
Class CloneChecker<C>
java.lang.Object
caseine.reflect.CloneChecker<C>
- Type Parameters:
C- The class to check
Assists in checking the correct writing of the clone method of a class C by
knowing if
- C implements or not Cloneable
- clone is not declared or well declared
- clone returns C
- clone does not throw CloneNotSupportedException
- clone does not use new
-
Constructor Summary
ConstructorsConstructorDescriptionCloneChecker(Class<C> classToCheck) CloneChecker(Class<C> classToCheck, com.github.javaparser.ast.stmt.BlockStmt bodyToCheck) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptioncom.github.javaparser.ast.stmt.BlockStmtgetClone()booleanbooleanbooleanbooleanboolean
-
Constructor Details
-
CloneChecker
@Deprecated public CloneChecker(Class<C> classToCheck, com.github.javaparser.ast.stmt.BlockStmt bodyToCheck) Deprecated. -
CloneChecker
- Parameters:
classToCheck- The object class of class C whose clone method we want to check
-
-
Method Details
-
getCheckedClass
- Returns:
- Object class of C
-
getBodyToCheck
public com.github.javaparser.ast.stmt.BlockStmt getBodyToCheck()- Returns:
- The parsed body of the clone method of C is it exists or null
-
isCloneDeclared
public boolean isCloneDeclared()- Returns:
- The clone method is declared in the class C
-
isInterfaceCloneableImplemented
public boolean isInterfaceCloneableImplemented()- Returns:
- C implements Cloneable
-
isReturnsC
public boolean isReturnsC()- Returns:
- clone exists and returns an objet of class C
-
isNotThrowCloneNotSupportedException
public boolean isNotThrowCloneNotSupportedException()- Returns:
- clone exists and does not throw CloneNotSupportedException
-
isNotUseNew
public boolean isNotUseNew()- Returns:
- clone exists and does not throw CloneNotSupportedException
-
getClone
- Returns:
- the reflected object class of the clone method or null if does not exist
-