Skip to content

Instantly share code, notes, and snippets.

@frankiesardo
Created August 12, 2013 12:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frankiesardo/6210582 to your computer and use it in GitHub Desktop.
Save frankiesardo/6210582 to your computer and use it in GitHub Desktop.
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