public class ResourceEvaluator
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static com.android.support.AndroidxName |
ANIM_RES_ANNOTATION |
static com.android.support.AndroidxName |
ANIMATOR_RES_ANNOTATION |
static com.android.support.AndroidxName |
ANY_RES_ANNOTATION |
static com.android.support.AndroidxName |
ARRAY_RES_ANNOTATION |
static com.android.support.AndroidxName |
ATTR_RES_ANNOTATION |
static com.android.support.AndroidxName |
BOOL_RES_ANNOTATION |
static com.android.support.AndroidxName |
COLOR_INT_ANNOTATION |
static com.android.resources.ResourceType |
COLOR_INT_MARKER_TYPE
Marker ResourceType used to signify that an expression is of type
@ColorInt, which
isn't actually a ResourceType but one we want to specifically compare with. |
static com.android.support.AndroidxName |
COLOR_RES_ANNOTATION |
static com.android.support.AndroidxName |
DIMEN_RES_ANNOTATION |
static com.android.support.AndroidxName |
DIMENSION_ANNOTATION |
static com.android.resources.ResourceType |
DIMENSION_MARKER_TYPE
Marker ResourceType used to signify that an expression is of type
@Px, which isn't
actually a ResourceType but one we want to specifically compare with. |
static com.android.support.AndroidxName |
DRAWABLE_RES_ANNOTATION |
static com.android.support.AndroidxName |
FONT_RES_ANNOTATION |
static com.android.support.AndroidxName |
FRACTION_RES_ANNOTATION |
static com.android.support.AndroidxName |
ID_RES_ANNOTATION |
static com.android.support.AndroidxName |
INTEGER_RES_ANNOTATION |
static com.android.support.AndroidxName |
INTERPOLATOR_RES_ANNOTATION |
static com.android.support.AndroidxName |
LAYOUT_RES_ANNOTATION |
static com.android.support.AndroidxName |
MENU_RES_ANNOTATION |
static com.android.support.AndroidxName |
NAVIGATION_RES_ANNOTATION |
static com.android.support.AndroidxName |
PLURALS_RES_ANNOTATION |
static com.android.support.AndroidxName |
PX_ANNOTATION |
static com.android.support.AndroidxName |
RAW_RES_ANNOTATION |
static java.lang.String |
RES_SUFFIX |
static com.android.support.AndroidxName |
STRING_RES_ANNOTATION |
static com.android.support.AndroidxName |
STYLE_RES_ANNOTATION |
static com.android.support.AndroidxName |
STYLEABLE_RES_ANNOTATION |
static com.android.support.AndroidxName |
TRANSITION_RES_ANNOTATION |
static com.android.support.AndroidxName |
XML_RES_ANNOTATION |
| Constructor and Description |
|---|
ResourceEvaluator(com.android.tools.lint.client.api.JavaEvaluator evaluator)
Creates a new resource evaluator
|
| Modifier and Type | Method and Description |
|---|---|
ResourceEvaluator |
allowDereference(boolean allow)
Whether we allow dereferencing resources when computing constants; e.g.
|
static com.android.resources.ResourceUrl |
getResource(com.android.tools.lint.client.api.JavaEvaluator evaluator,
com.intellij.psi.PsiElement element)
Evaluates the given node and returns the resource reference (type and name) it points to, if
any
|
static com.android.resources.ResourceUrl |
getResource(com.android.tools.lint.client.api.JavaEvaluator evaluator,
org.jetbrains.uast.UElement element)
Evaluates the given node and returns the resource reference (type and name) it points to, if
any
|
com.android.resources.ResourceUrl |
getResource(com.intellij.psi.PsiElement element)
Evaluates the given node and returns the resource reference (type and name) it points to, if
any
|
com.android.resources.ResourceUrl |
getResource(org.jetbrains.uast.UElement element)
Evaluates the given node and returns the resource reference (type and name) it points to, if
any
|
static com.android.resources.ResourceUrl |
getResourceConstant(com.intellij.psi.PsiElement node)
Returns a resource URL based on the field reference in the code
|
static com.android.resources.ResourceUrl |
getResourceConstant(org.jetbrains.uast.UElement node)
Returns a resource URL based on the field reference in the code
|
static java.util.EnumSet<com.android.resources.ResourceType> |
getResourceTypes(com.android.tools.lint.client.api.JavaEvaluator evaluator,
com.intellij.psi.PsiElement element)
Evaluates the given node and returns the resource types implied by the given element, if any.
|
static java.util.EnumSet<com.android.resources.ResourceType> |
getResourceTypes(com.android.tools.lint.client.api.JavaEvaluator evaluator,
org.jetbrains.uast.UElement element)
Evaluates the given node and returns the resource types implied by the given element, if any.
|
java.util.EnumSet<com.android.resources.ResourceType> |
getResourceTypes(com.intellij.psi.PsiElement element)
Evaluates the given node and returns the resource types applicable to the node, if any.
|
java.util.EnumSet<com.android.resources.ResourceType> |
getResourceTypes(org.jetbrains.uast.UElement element)
Evaluates the given node and returns the resource types applicable to the node, if any.
|
static com.android.resources.ResourceType |
getTypeFromAnnotationSignature(java.lang.String signature) |
static java.util.EnumSet<com.android.resources.ResourceType> |
getTypesFromAnnotations(java.util.List<org.jetbrains.uast.UAnnotation> annotations) |
static java.util.EnumSet<com.android.resources.ResourceType> |
getTypesFromAnnotations(com.intellij.psi.PsiAnnotation[] annotations) |
public static final com.android.resources.ResourceType COLOR_INT_MARKER_TYPE
@ColorInt, which
isn't actually a ResourceType but one we want to specifically compare with. We're using
ResourceType.PUBLIC because that one won't appear in the R class (and ResourceType is
an enum we can't just create new constants for.)public static final com.android.resources.ResourceType DIMENSION_MARKER_TYPE
@Px, which isn't
actually a ResourceType but one we want to specifically compare with. We're using ResourceType.DECLARE_STYLEABLE because that one doesn't have a corresponding *Res
constant (and ResourceType is an enum we can't just create new constants for.)public static final com.android.support.AndroidxName COLOR_INT_ANNOTATION
public static final com.android.support.AndroidxName PX_ANNOTATION
public static final com.android.support.AndroidxName DIMENSION_ANNOTATION
public static final java.lang.String RES_SUFFIX
public static final com.android.support.AndroidxName ANIMATOR_RES_ANNOTATION
public static final com.android.support.AndroidxName ANIM_RES_ANNOTATION
public static final com.android.support.AndroidxName ANY_RES_ANNOTATION
public static final com.android.support.AndroidxName ARRAY_RES_ANNOTATION
public static final com.android.support.AndroidxName BOOL_RES_ANNOTATION
public static final com.android.support.AndroidxName COLOR_RES_ANNOTATION
public static final com.android.support.AndroidxName ATTR_RES_ANNOTATION
public static final com.android.support.AndroidxName DIMEN_RES_ANNOTATION
public static final com.android.support.AndroidxName DRAWABLE_RES_ANNOTATION
public static final com.android.support.AndroidxName FONT_RES_ANNOTATION
public static final com.android.support.AndroidxName FRACTION_RES_ANNOTATION
public static final com.android.support.AndroidxName ID_RES_ANNOTATION
public static final com.android.support.AndroidxName INTEGER_RES_ANNOTATION
public static final com.android.support.AndroidxName INTERPOLATOR_RES_ANNOTATION
public static final com.android.support.AndroidxName LAYOUT_RES_ANNOTATION
public static final com.android.support.AndroidxName MENU_RES_ANNOTATION
public static final com.android.support.AndroidxName PLURALS_RES_ANNOTATION
public static final com.android.support.AndroidxName RAW_RES_ANNOTATION
public static final com.android.support.AndroidxName STRING_RES_ANNOTATION
public static final com.android.support.AndroidxName STYLEABLE_RES_ANNOTATION
public static final com.android.support.AndroidxName STYLE_RES_ANNOTATION
public static final com.android.support.AndroidxName TRANSITION_RES_ANNOTATION
public static final com.android.support.AndroidxName XML_RES_ANNOTATION
public static final com.android.support.AndroidxName NAVIGATION_RES_ANNOTATION
public ResourceEvaluator(@Nullable
com.android.tools.lint.client.api.JavaEvaluator evaluator)
evaluator - the evaluator to use to resolve annotations references, if anypublic ResourceEvaluator allowDereference(boolean allow)
x when the code is x = getString(R.string.name), if allowDereference is true we'll return R.string.name, otherwise we'll return null.@Nullable
public static com.android.resources.ResourceUrl getResource(@Nullable
com.android.tools.lint.client.api.JavaEvaluator evaluator,
@NonNull
com.intellij.psi.PsiElement element)
evaluator - the evaluator to use to look up annotationselement - the node to compute the constant value for@Nullable
public static com.android.resources.ResourceUrl getResource(@NonNull
com.android.tools.lint.client.api.JavaEvaluator evaluator,
@NonNull
org.jetbrains.uast.UElement element)
evaluator - the evaluator to use to look up annotationselement - the node to compute the constant value for@Nullable
public static java.util.EnumSet<com.android.resources.ResourceType> getResourceTypes(@Nullable
com.android.tools.lint.client.api.JavaEvaluator evaluator,
@NonNull
com.intellij.psi.PsiElement element)
evaluator - the evaluator to use to look up annotationselement - the node to compute the constant value for@Nullable
public static java.util.EnumSet<com.android.resources.ResourceType> getResourceTypes(@Nullable
com.android.tools.lint.client.api.JavaEvaluator evaluator,
@NonNull
org.jetbrains.uast.UElement element)
evaluator - the evaluator to use to look up annotationselement - the node to compute the constant value for@Nullable
public com.android.resources.ResourceUrl getResource(@Nullable
org.jetbrains.uast.UElement element)
element - the node to compute the constant value for@Nullable
public com.android.resources.ResourceUrl getResource(@Nullable
com.intellij.psi.PsiElement element)
element - the node to compute the constant value for@Nullable
public java.util.EnumSet<com.android.resources.ResourceType> getResourceTypes(@Nullable
org.jetbrains.uast.UElement element)
element - the element to compute the types for@Nullable
public java.util.EnumSet<com.android.resources.ResourceType> getResourceTypes(@Nullable
com.intellij.psi.PsiElement element)
element - the element to compute the types for@Nullable
public static java.util.EnumSet<com.android.resources.ResourceType> getTypesFromAnnotations(@NonNull
com.intellij.psi.PsiAnnotation[] annotations)
@Nullable
public static java.util.EnumSet<com.android.resources.ResourceType> getTypesFromAnnotations(@NonNull
java.util.List<org.jetbrains.uast.UAnnotation> annotations)
@Nullable
public static com.android.resources.ResourceType getTypeFromAnnotationSignature(@NonNull
java.lang.String signature)
@Nullable
public static com.android.resources.ResourceUrl getResourceConstant(@NonNull
com.intellij.psi.PsiElement node)
@Nullable
public static com.android.resources.ResourceUrl getResourceConstant(@NonNull
org.jetbrains.uast.UElement node)