Created
August 12, 2013 12:56
-
-
Save frankiesardo/6210582 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class IcicleAssigner { | |
private final Types typeUtils; | |
private final Elements elementUtils; | |
public IcicleAssigner(Types typeUtils, Elements elementUtils) { | |
this.typeUtils = typeUtils; | |
this.elementUtils = elementUtils; | |
} | |
public boolean isAssignable(String classNameFrom, String classNameTo) { | |
TypeElement typeFrom = elementUtils.getTypeElement(classNameFrom); | |
TypeElement typeTo = elementUtils.getTypeElement(classNameTo); | |
if (typeFrom == null || typeTo == null) { | |
return false; | |
} | |
return typeUtils.isAssignable(typeFrom.asType(), typeTo.asType()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment