@Immutable
public class ResourceUrl
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
boolean |
create
Whether an id resource is of the form
@+id rather than just @id |
boolean |
framework
If true, the resource is in the android: framework
|
java.lang.String |
name
Name of resource
|
java.lang.String |
namespace
The namespace, or null if it's in the project namespace
|
boolean |
theme
Whether this is a theme resource reference
|
ResourceType |
type
Type of resource
|
| Modifier and Type | Method and Description |
|---|---|
ResourceUrl |
asThemeUrl()
Creates a copy of this
ResourceUrl with the theme field set to true. |
static ResourceUrl |
create(ResourceType type,
java.lang.String name,
boolean framework)
Deprecated.
This factory method is used where we have no way of knowing the namespace. We
need to migrate every call site to the other factory method that takes a namespace.
|
static ResourceUrl |
create(java.lang.String namespace,
ResourceType type,
java.lang.String name)
Creates a new resource URL, representing "@namespace:type/name".
|
boolean |
equals(java.lang.Object o) |
int |
hashCode() |
boolean |
hasValidName()
Checks whether this resource has a valid name.
|
static boolean |
isNullOrEmpty(java.lang.String url)
Returns if the resource url is @null, @empty or @undefined.
|
static ResourceUrl |
parse(java.lang.String url)
Return the resource type of the given url, and the resource name
|
static ResourceUrl |
parse(java.lang.String url,
boolean forceFramework)
Return the resource type of the given url, and the resource name.
|
java.lang.String |
toString() |
ResourceUrl |
withFramework(boolean isFramework)
Creates a copy of this
ResourceUrl with the framework field set to the given
value. |
@NonNull public final ResourceType type
@NonNull public final java.lang.String name
@Nullable public final java.lang.String namespace
public final boolean framework
public final boolean create
@+id rather than just @idpublic final boolean theme
@Deprecated public static ResourceUrl create(@NonNull ResourceType type, @NonNull java.lang.String name, boolean framework)
type - the resource typename - the nameframework - whether it's a framework resourceparse(String)public static ResourceUrl create(@Nullable java.lang.String namespace, @NonNull ResourceType type, @NonNull java.lang.String name)
namespace - the resource namespacetype - the resource typename - the nameparse(String)@Nullable public static ResourceUrl parse(@NonNull java.lang.String url)
url - the resource url to be parsed@Nullable public static ResourceUrl parse(@NonNull java.lang.String url, boolean forceFramework)
url - the resource url to be parsedforceFramework - force the returned value to be a framework resource.public static boolean isNullOrEmpty(@NonNull
java.lang.String url)
public boolean hasValidName()
@NonNull public ResourceUrl withFramework(boolean isFramework)
ResourceUrl with the framework field set to the given
value.@NonNull public ResourceUrl asThemeUrl()
ResourceUrl with the theme field set to true.public java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object