public class ResourceValueImpl extends java.lang.Object implements ResourceValue
ResourceValue interface.| Modifier and Type | Field and Description |
|---|---|
protected ResourceNamespace.Resolver |
mNamespaceResolver |
| Constructor and Description |
|---|
ResourceValueImpl(ResourceNamespace namespace,
ResourceType type,
java.lang.String name,
java.lang.String value) |
ResourceValueImpl(ResourceNamespace namespace,
ResourceType type,
java.lang.String name,
java.lang.String value,
java.lang.String libraryName) |
ResourceValueImpl(ResourceReference reference,
java.lang.String value) |
ResourceValueImpl(ResourceReference reference,
java.lang.String value,
java.lang.String libraryName) |
| Modifier and Type | Method and Description |
|---|---|
ResourceReference |
asReference() |
boolean |
equals(java.lang.Object o) |
java.lang.String |
getLibraryName()
Returns the name of the library where this resource was found or null if it is not from a
library.
|
java.lang.String |
getName() |
ResourceNamespace |
getNamespace() |
ResourceNamespace.Resolver |
getNamespaceResolver() |
java.lang.String |
getRawXmlValue()
Similar to
getValue(), but returns the raw XML value. |
ResourceReference |
getReference()
If this
ResourceValue references another one, returns a ResourceReference to
it, otherwise null. |
ResourceType |
getResourceType() |
ResourceUrl |
getResourceUrl() |
java.lang.String |
getValue()
Returns the value of the resource, as defined in the XML.
|
int |
hashCode() |
boolean |
isFramework() |
boolean |
isUserDefined()
Returns true if the resource is user defined.
|
void |
replaceWith(ResourceValue value)
Sets the value from another resource.
|
void |
setNamespaceLookup(ResourceNamespace.Resolver resolver)
Deprecated.
|
void |
setNamespaceResolver(ResourceNamespace.Resolver resolver)
Specifies logic used to resolve namespace aliases for values that come from XML files.
|
void |
setValue(java.lang.String value)
Sets the value of the resource.
|
java.lang.String |
toString() |
@NonNull protected transient ResourceNamespace.Resolver mNamespaceResolver
public ResourceValueImpl(@NonNull
ResourceReference reference,
@Nullable
java.lang.String value,
@Nullable
java.lang.String libraryName)
public ResourceValueImpl(@NonNull
ResourceReference reference,
@Nullable
java.lang.String value)
public ResourceValueImpl(@NonNull
ResourceNamespace namespace,
@NonNull
ResourceType type,
@NonNull
java.lang.String name,
@Nullable
java.lang.String value)
public ResourceValueImpl(@NonNull
ResourceNamespace namespace,
@NonNull
ResourceType type,
@NonNull
java.lang.String name,
@Nullable
java.lang.String value,
@Nullable
java.lang.String libraryName)
@NonNull public final ResourceType getResourceType()
getResourceType in interface ResourceValue@NonNull public final ResourceNamespace getNamespace()
getNamespace in interface ResourceValue@NonNull public java.lang.String getName()
getName in interface ResourceValue@Nullable public final java.lang.String getLibraryName()
getLibraryName in interface ResourceValuepublic boolean isUserDefined()
isUserDefined in interface ResourceValuepublic boolean isFramework()
isFramework in interface ResourceValue@Nullable public java.lang.String getValue()
null, for
example for instances of StyleResourceValue.getValue in interface ResourceValue@NonNull public ResourceReference asReference()
asReference in interface ResourceValue@NonNull public ResourceUrl getResourceUrl()
getResourceUrl in interface ResourceValue@Nullable public ResourceReference getReference()
ResourceValue references another one, returns a ResourceReference to
it, otherwise null.
This method should be called before inspecting the textual value (getValue()), as
it handles namespaces correctly.
getReference in interface ResourceValue@Nullable public java.lang.String getRawXmlValue()
getValue(), but returns the raw XML value. This is usually the
same as getValue, but with a few exceptions. For example, for markup strings, you can have
<string name="markup">This is <b>bold</b></string>. Here, getValue() will
return "This is bold" -- e.g. just the plain text flattened. However, this method
will return "This is <b>bold</b>", which preserves the XML markup elements.getRawXmlValue in interface ResourceValuepublic void setValue(@Nullable
java.lang.String value)
setValue in interface ResourceValuevalue - the new valuepublic void replaceWith(@NonNull
ResourceValue value)
replaceWith in interface ResourceValuevalue - the resource value@NonNull public ResourceNamespace.Resolver getNamespaceResolver()
getNamespaceResolver in interface ResourceValuepublic void setNamespaceResolver(@NonNull
ResourceNamespace.Resolver resolver)
This method is meant to be called by the XML parser that created this ResourceValue.
setNamespaceResolver in interface ResourceValue@Deprecated
public void setNamespaceLookup(@NonNull
ResourceNamespace.Resolver resolver)
setNamespaceLookup in interface ResourceValuepublic boolean equals(@Nullable
java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object@NonNull public java.lang.String toString()
toString in class java.lang.Object