Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public String getMethodNameToRestore() {

private boolean isTypeParcelable(TypeElement elementType) {

TypeElement parcelableType = annotationHelper.typeElementFromQualifiedName("android.os.Parcelable");
TypeElement parcelableType = annotationHelper.typeElementFromQualifiedName(CanonicalNameConstants.PARCELABLE);

return elementType != null && annotationHelper.isSubtype(elementType, parcelableType);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ public void returnTypeIsVoidOrBoolean(ExecutableElement executableElement, IsVal

TypeKind returnKind = returnType.getKind();

if (returnKind != TypeKind.BOOLEAN && returnKind != TypeKind.VOID && !returnType.toString().equals("java.lang.Boolean")) {
if (returnKind != TypeKind.BOOLEAN && returnKind != TypeKind.VOID && !returnType.toString().equals(CanonicalNameConstants.BOOLEAN)) {
valid.invalidate();
annotationHelper.printAnnotationError(executableElement, "%s can only be used on a method with a boolean or a void return type");
}
Expand Down Expand Up @@ -714,7 +714,7 @@ public void hasOneOrTwoParametersAndFirstIsBoolean(ExecutableElement executableE

TypeKind parameterKind = firstParameter.asType().getKind();

if (parameterKind != TypeKind.BOOLEAN && !firstParameter.toString().equals("java.lang.Boolean")) {
if (parameterKind != TypeKind.BOOLEAN && !firstParameter.toString().equals(CanonicalNameConstants.BOOLEAN)) {
valid.invalidate();
annotationHelper.printAnnotationError(executableElement, "the first parameter should be a boolean");
}
Expand Down Expand Up @@ -1071,7 +1071,7 @@ public void canBeSavedAsInstanceState(Element element, IsValid isValid) {
}

if (elementType != null) {
TypeElement parcelableType = annotationHelper.typeElementFromQualifiedName("android.os.Parcelable");
TypeElement parcelableType = annotationHelper.typeElementFromQualifiedName(CanonicalNameConstants.PARCELABLE);
TypeElement serializableType = annotationHelper.typeElementFromQualifiedName("java.io.Serializable");
if (!annotationHelper.isSubtype(elementType, parcelableType) && !annotationHelper.isSubtype(elementType, serializableType)) {
annotationHelper.printAnnotationError(element, "Unrecognized type. Please let your attribute be primitive or implement Serializable or Parcelable");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@

import org.androidannotations.annotations.AfterTextChange;
import org.androidannotations.helper.APTCodeModelHelper;
import org.androidannotations.helper.CanonicalNameConstants;
import org.androidannotations.helper.TextWatcherHelper;
import org.androidannotations.rclass.IRClass;
import org.androidannotations.rclass.IRClass.Res;

import com.sun.codemodel.JBlock;
import com.sun.codemodel.JCodeModel;
import com.sun.codemodel.JExpression;
Expand Down Expand Up @@ -72,10 +74,10 @@ public void process(Element element, JCodeModel codeModel, EBeanHolder holder) {
VariableElement parameter = parameters.get(i);
TypeMirror parameterType = parameter.asType();

if ("android.text.Editable".equals(parameterType.toString())) {
if (CanonicalNameConstants.EDITABLE.equals(parameterType.toString())) {
editableParameterPosition = i;
} else {
TypeMirror textViewType = helper.typeElementFromQualifiedName("android.widget.TextView").asType();
TypeMirror textViewType = helper.typeElementFromQualifiedName(CanonicalNameConstants.TEXT_VIEW).asType();
if (helper.isSubtype(parameterType, textViewType)) {
viewParameterPosition = i;
viewParameterType = parameterType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@

import org.androidannotations.annotations.BeforeTextChange;
import org.androidannotations.helper.APTCodeModelHelper;
import org.androidannotations.helper.CanonicalNameConstants;
import org.androidannotations.helper.TextWatcherHelper;
import org.androidannotations.rclass.IRClass;
import org.androidannotations.rclass.IRClass.Res;

import com.sun.codemodel.JBlock;
import com.sun.codemodel.JCodeModel;
import com.sun.codemodel.JExpression;
Expand Down Expand Up @@ -77,9 +79,9 @@ public void process(Element element, JCodeModel codeModel, EBeanHolder holder) {
String parameterName = parameter.toString();
TypeMirror parameterType = parameter.asType();

if ("java.lang.CharSequence".equals(parameterType.toString())) {
if (CanonicalNameConstants.CHAR_SEQUENCE.equals(parameterType.toString())) {
charSequenceParameterPosition = i;
} else if (parameterType.getKind() == TypeKind.INT || "java.lang.Integer".equals(parameterType.toString())) {
} else if (parameterType.getKind() == TypeKind.INT || CanonicalNameConstants.INTEGER.equals(parameterType.toString())) {
if ("start".equals(parameterName)) {
startParameterPosition = i;
} else if ("count".equals(parameterName)) {
Expand All @@ -88,7 +90,7 @@ public void process(Element element, JCodeModel codeModel, EBeanHolder holder) {
afterParameterPosition = i;
}
} else {
TypeMirror textViewType = helper.typeElementFromQualifiedName("android.widget.TextView").asType();
TypeMirror textViewType = helper.typeElementFromQualifiedName(CanonicalNameConstants.TEXT_VIEW).asType();
if (helper.isSubtype(parameterType, textViewType)) {
viewParameterPosition = i;
viewParameterType = parameterType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@

import org.androidannotations.annotations.FragmentByTag;
import org.androidannotations.helper.AnnotationHelper;
import org.androidannotations.helper.CanonicalNameConstants;
import org.androidannotations.processing.EBeansHolder.Classes;

import com.sun.codemodel.JBlock;
import com.sun.codemodel.JCodeModel;
import com.sun.codemodel.JMethod;
Expand Down Expand Up @@ -65,7 +67,7 @@ public void process(Element element, JCodeModel codeModel, EBeanHolder holder) {
tagValue = fieldName;
}

TypeMirror nativeFragmentType = annotationHelper.typeElementFromQualifiedName("android.app.Fragment").asType();
TypeMirror nativeFragmentType = annotationHelper.typeElementFromQualifiedName(CanonicalNameConstants.FRAGMENT).asType();

JMethod findFragmentByTag;
if (annotationHelper.isSubtype(elementType, nativeFragmentType)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import org.androidannotations.api.sharedpreferences.SharedPreferencesHelper;
import org.androidannotations.api.sharedpreferences.StringPrefEditorField;
import org.androidannotations.api.sharedpreferences.StringPrefField;
import org.androidannotations.helper.CanonicalNameConstants;
import org.androidannotations.helper.ModelConstants;

import com.sun.codemodel.ClassType;
Expand Down Expand Up @@ -85,7 +86,7 @@ public EditorFieldHolder(Class<?> fieldClass, String fieldMethodName) {
put("float", new EditorFieldHolder(FloatPrefEditorField.class, "floatField"));
put("int", new EditorFieldHolder(IntPrefEditorField.class, "intField"));
put("long", new EditorFieldHolder(LongPrefEditorField.class, "longField"));
put("java.lang.String", new EditorFieldHolder(StringPrefEditorField.class, "stringField"));
put(CanonicalNameConstants.STRING, new EditorFieldHolder(StringPrefEditorField.class, "stringField"));
}
};

Expand Down Expand Up @@ -139,7 +140,7 @@ public void process(Element element, JCodeModel codeModel, EBeansHolder eBeansHo
}

// Helper constructor
JClass contextClass = eBeansHolder.refClass("android.content.Context");
JClass contextClass = eBeansHolder.refClass(CanonicalNameConstants.CONTEXT);

SharedPref sharedPrefAnnotation = typeElement.getAnnotation(SharedPref.class);
Scope scope = sharedPrefAnnotation.value();
Expand Down Expand Up @@ -230,7 +231,7 @@ public void process(Element element, JCodeModel codeModel, EBeansHolder eBeansHo
defaultValue = JExpr.lit(0l);
}
addFieldHelperMethod(helperClass, fieldName, defaultValue, LongPrefField.class, "longField");
} else if ("java.lang.String".equals(returnType)) {
} else if (CanonicalNameConstants.STRING.equals(returnType)) {
JExpression defaultValue;
DefaultString defaultAnnotation = method.getAnnotation(DefaultString.class);
if (defaultAnnotation != null) {
Expand All @@ -253,7 +254,7 @@ private JMethod getLocalClassName(EBeansHolder eBeansHolder, JDefinedClass helpe

JClass stringClass = eBeansHolder.refClass(String.class);
JMethod getLocalClassName = helperClass.method(PRIVATE | STATIC, stringClass, "getLocalClassName");
JClass contextClass = eBeansHolder.refClass("android.content.Context");
JClass contextClass = eBeansHolder.refClass(CanonicalNameConstants.CONTEXT);

JVar contextParam = getLocalClassName.param(contextClass, "context");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import javax.lang.model.element.VariableElement;

import org.androidannotations.annotations.AfterTextChange;
import org.androidannotations.helper.CanonicalNameConstants;
import org.androidannotations.helper.IdAnnotationHelper;
import org.androidannotations.helper.IdValidatorHelper;
import org.androidannotations.helper.IdValidatorHelper.FallbackStrategy;
Expand Down Expand Up @@ -74,15 +75,15 @@ private void haveAfterTextChangedMethodParameters(ExecutableElement executableEl
boolean textViewParameterFound = false;
for (VariableElement parameter : parameters) {
String parameterType = parameter.asType().toString();
if (parameterType.equals("android.text.Editable")) {
if (parameterType.equals(CanonicalNameConstants.EDITABLE)) {
if (editableParameterFound) {
annotationHelper.printAnnotationError(executableElement, "Unrecognized parameter declaration. you can declare only one parameter of type android.text.Editable");
valid.invalidate();
}
editableParameterFound = true;
continue;
}
if (parameterType.equals("android.widget.TextView")) {
if (parameterType.equals(CanonicalNameConstants.TEXT_VIEW)) {
if (textViewParameterFound) {
annotationHelper.printAnnotationError(executableElement, "Unrecognized parameter declaration. you can declare only one parameter of type android.widget.TextView");
valid.invalidate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import javax.lang.model.type.TypeKind;

import org.androidannotations.annotations.BeforeTextChange;
import org.androidannotations.helper.CanonicalNameConstants;
import org.androidannotations.helper.IdAnnotationHelper;
import org.androidannotations.helper.IdValidatorHelper;
import org.androidannotations.helper.IdValidatorHelper.FallbackStrategy;
Expand Down Expand Up @@ -75,23 +76,23 @@ private void haveBeforeTextChangedMethodParameters(ExecutableElement executableE
boolean textViewParameterFound = false;
for (VariableElement parameter : parameters) {
String parameterType = parameter.asType().toString();
if (parameterType.equals("java.lang.CharSequence")) {
if (parameterType.equals(CanonicalNameConstants.CHAR_SEQUENCE)) {
if (charSequenceParameterFound) {
annotationHelper.printAnnotationError(executableElement, "Unrecognized parameter declaration. you can declare only one parameter of type java.lang.CharSequence");
valid.invalidate();
}
charSequenceParameterFound = true;
continue;
}
if (parameterType.equals("android.widget.TextView")) {
if (parameterType.equals(CanonicalNameConstants.TEXT_VIEW)) {
if (textViewParameterFound) {
annotationHelper.printAnnotationError(executableElement, "Unrecognized parameter declaration. you can declare only one parameter of type android.widget.TextView");
valid.invalidate();
}
textViewParameterFound = true;
continue;
}
if (parameter.asType().getKind() == TypeKind.INT || "java.lang.Integer".equals(parameterType)) {
if (parameter.asType().getKind() == TypeKind.INT || CanonicalNameConstants.INTEGER.equals(parameterType)) {
String parameterName = parameter.toString();
if ("start".equals(parameterName) || "count".equals(parameterName) || "after".equals(parameterName)) {
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import javax.lang.model.type.TypeKind;

import org.androidannotations.annotations.TextChange;
import org.androidannotations.helper.CanonicalNameConstants;
import org.androidannotations.helper.IdAnnotationHelper;
import org.androidannotations.helper.IdValidatorHelper;
import org.androidannotations.helper.IdValidatorHelper.FallbackStrategy;
Expand Down Expand Up @@ -75,23 +76,23 @@ private void haveTextChangedMethodParameters(ExecutableElement executableElement
boolean textViewParameterFound = false;
for (VariableElement parameter : parameters) {
String parameterType = parameter.asType().toString();
if (parameterType.equals("java.lang.CharSequence")) {
if (parameterType.equals(CanonicalNameConstants.CHAR_SEQUENCE)) {
if (charSequenceParameterFound) {
annotationHelper.printAnnotationError(executableElement, "Unrecognized parameter declaration. you can declare only one parameter of type java.lang.CharSequence");
valid.invalidate();
}
charSequenceParameterFound = true;
continue;
}
if (parameterType.equals("android.widget.TextView")) {
if (parameterType.equals(CanonicalNameConstants.TEXT_VIEW)) {
if (textViewParameterFound) {
annotationHelper.printAnnotationError(executableElement, "Unrecognized parameter declaration. you can declare only one parameter of type android.widget.TextView");
valid.invalidate();
}
textViewParameterFound = true;
continue;
}
if (parameter.asType().getKind() == TypeKind.INT || "java.lang.Integer".equals(parameterType)) {
if (parameter.asType().getKind() == TypeKind.INT || CanonicalNameConstants.INTEGER.equals(parameterType)) {
String parameterName = parameter.toString();
if ("start".equals(parameterName) || "before".equals(parameterName) || "count".equals(parameterName)) {
continue;
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.