com.android.ide.common.resources
Class ResourceUrl

java.lang.Object
  extended by com.android.ide.common.resources.ResourceUrl

public class ResourceUrl
extends java.lang.Object

A ResourceUrl represents a parsed resource url such as @string/foo or ?android:attr/bar


Field Summary
 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
 boolean theme
          Whether this is a theme resource reference
 com.android.resources.ResourceType type
          Type of resource
 
Method Summary
static ResourceUrl create(com.android.resources.ResourceType type, java.lang.String name, boolean framework, boolean create)
          Creates a new resource URL.
 boolean equals(java.lang.Object o)
           
 int hashCode()
           
 boolean hasValidName()
          Checks whether this resource has a valid name.
static ResourceUrl parse(java.lang.String url)
          Return the resource type of the given url, and the resource name
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

type

@NonNull
public final com.android.resources.ResourceType type
Type of resource


name

@NonNull
public final java.lang.String name
Name of resource


framework

public final boolean framework
If true, the resource is in the android: framework


create

public final boolean create
Whether an id resource is of the form @+id rather than just @id


theme

public boolean theme
Whether this is a theme resource reference

Method Detail

create

public static ResourceUrl create(@NonNull
                                 com.android.resources.ResourceType type,
                                 @NonNull
                                 java.lang.String name,
                                 boolean framework,
                                 boolean create)
Creates a new resource URL. Normally constructed via parse(String).

Parameters:
type - the resource type
name - the name
framework - whether it's a framework resource
create - if it's an id resource, whether it's of the form @+id

parse

@Nullable
public static ResourceUrl parse(@NonNull
                                         java.lang.String url)
Return the resource type of the given url, and the resource name

Parameters:
url - the resource url to be parsed
Returns:
a pair of the resource type and the resource name

hasValidName

public boolean hasValidName()
Checks whether this resource has a valid name. Used when parsing data that isn't necessarily known to be a valid resource; for example, "?attr/hello world"


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object