use of javax.lang.model.element.ExecutableElement in project androidannotations by androidannotations.
the class AbstractOttoHandler method validate.
@Override
public void validate(Element element, ElementValidation valid) {
if (!annotationHelper.enclosingElementHasEnhancedComponentAnnotation(element)) {
// do nothing when otto annotations are used in non-enhanced classes
return;
}
ExecutableElement executableElement = (ExecutableElement) element;
validateReturnType(executableElement, valid);
validatorHelper.isPublic(element, valid);
validatorHelper.doesntThrowException(executableElement, valid);
validatorHelper.isNotFinal(element, valid);
getParamValidator().validate(executableElement, valid);
}
use of javax.lang.model.element.ExecutableElement in project androidannotations by androidannotations.
the class ValidatorParameterHelperTest method inOrderFail3.
@Test
public void inOrderFail3() throws Exception {
ExecutableElement executableElement = createMethod(boolean.class, boolean.class, long.class, Bundle.class);
ElementValidation valid = new ElementValidation("", executableElement);
//
validator.inOrder().type(boolean.class.getName()).multiple().type(long.class.getName()).optional().type(int.class.getName()).optional().validate(executableElement, valid);
assertFalse(valid.isValid());
}
use of javax.lang.model.element.ExecutableElement in project androidannotations by androidannotations.
the class ValidatorParameterHelperTest method extendsViewType.
@Test
public void extendsViewType() throws Exception {
ExecutableElement executableElement = createMethod(TextView.class);
ElementValidation valid = new ElementValidation("", executableElement);
validator.extendsType(CanonicalNameConstants.VIEW).validate(executableElement, valid);
assertTrue(valid.isValid());
}
use of javax.lang.model.element.ExecutableElement in project androidannotations by androidannotations.
the class ValidatorParameterHelperTest method inOrderSuccess.
@Test
public void inOrderSuccess() throws Exception {
ExecutableElement executableElement = createMethod(boolean.class, int.class);
ElementValidation valid = new ElementValidation("", executableElement);
//
validator.inOrder().type(//
boolean.class.getName()).type(long.class.getName()).optional().type(//
int.class.getName()).validate(executableElement, valid);
assertTrue(valid.isValid());
}
use of javax.lang.model.element.ExecutableElement in project androidannotations by androidannotations.
the class ValidatorParameterHelperTest method inOrderFail4.
@Test
public void inOrderFail4() throws Exception {
ExecutableElement executableElement = createMethod(int.class, long.class, boolean.class);
ElementValidation valid = new ElementValidation("", executableElement);
//
validator.inOrder().type(boolean.class.getName()).optional().type(long.class.getName()).optional().type(int.class.getName()).optional().validate(executableElement, valid);
assertFalse(valid.isValid());
}
Aggregations