public String[] extractAnnotationResNameParameter(Element element, String annotationName, String fieldName) { /* * Annotation resName() parameter can be a String or a String[] */ Object annotationResName = extractAnnotationParameter(element, annotationName, fieldName); if (annotationResName == null) { // This case happened during refactoring, if the id has been changed // in the layout and compiler throws an error on the annotation // because the constant doesn't exists anymore return new String[0]; } String[] resNames; if (annotationResName.getClass().isArray()) { resNames = (String[]) annotationResName; } else { resNames = new String[1]; resNames[0] = (String) annotationResName; } return resNames; }
public int[] extractAnnotationResIdValueParameter(Element element, String annotationName, String fieldName) { /* * Annotation value() parameter can be an int or an int[] */ Object annotationValue = extractAnnotationParameter(element, annotationName, fieldName); if (annotationValue == null) { // This case happened during refactoring, if the id has been changed // in the layout and compiler throws an error on the annotation // because the constant doesn't exists anymore return new int[0]; } int[] values; if (annotationValue.getClass().isArray()) { values = (int[]) annotationValue; } else { values = new int[1]; values[0] = (Integer) annotationValue; } return values; }
public void hasASqliteOpenHelperParametrizedType(Element element, ElementValidation valid) { TypeMirror helperType = annotationHelper.extractAnnotationParameter(element, OrmLiteDao.class.getName(), "helper"); TypeMirror openHelperType = annotationHelper.typeElementFromQualifiedName(CanonicalNameConstants.SQLITE_OPEN_HELPER).asType(); if (!annotationHelper.isSubtype(helperType, openHelperType)) { valid.addError("%s helper() parameter must extend " + CanonicalNameConstants.SQLITE_OPEN_HELPER); } } }
public int[] extractAnnotationResIdValueParameter(Element element, String annotationName, String fieldName) { /* * Annotation value() parameter can be an int or an int[] */ Object annotationValue = extractAnnotationParameter(element, annotationName, fieldName); if (annotationValue == null) { // This case happened during refactoring, if the id has been changed // in the layout and compiler throws an error on the annotation // because the constant doesn't exists anymore return new int[0]; } int[] values; if (annotationValue.getClass().isArray()) { values = (int[]) annotationValue; } else { values = new int[1]; values[0] = (Integer) annotationValue; } return values; }
public String[] extractAnnotationResNameParameter(Element element, String annotationName, String fieldName) { /* * Annotation resName() parameter can be a String or a String[] */ Object annotationResName = extractAnnotationParameter(element, annotationName, fieldName); if (annotationResName == null) { // This case happened during refactoring, if the id has been changed // in the layout and compiler throws an error on the annotation // because the constant doesn't exists anymore return new String[0]; } String[] resNames; if (annotationResName.getClass().isArray()) { resNames = (String[]) annotationResName; } else { resNames = new String[1]; resNames[0] = (String) annotationResName; } return resNames; }