@Immutable
public class Symbol
extends java.lang.Object
A resource type identifies the group or resource. Resources in Android can have various types: * drawables, strings, etc.
The name of the symbol has to be a valid java identifier and is usually the file name of the resource (without the extension) or the name of the resource if the resource is part of an XML file.
For example, the resource drawable/foo.png has name foo. The string
bar in file values/strings.xml with name bar has resource name
bar.
The java type is the java data type that contains the resource value. This is generally
be int, but other values (such as int[]) are allowed. This class poses no
restrictions on the type other that it may not contain any spaces.
The value is a java expression that conforms to the resource type and contains the value of
the resource. This may be just an integer like 3, if the resource has type int.
But may be a more complex expression. For example, if the resource has type int[],
the value may be something such as {1, 2, 3}.
In practice, symbols do not exist by themselves. They are usually part of a symbol table, but this class is independent of any use.
| Constructor and Description |
|---|
Symbol(java.lang.String resourceType,
java.lang.String name,
java.lang.String javaType,
java.lang.String value)
Creates a new symbol.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getJavaType()
Obtains the java type of the symbol.
|
java.lang.String |
getName()
Obtains the name of the symbol.
|
java.lang.String |
getResourceType()
Obtains the resource type.
|
java.lang.String |
getValue()
Obtains the value of the symbol.
|
int |
hashCode() |
public Symbol(@NonNull
java.lang.String resourceType,
@NonNull
java.lang.String name,
@NonNull
java.lang.String javaType,
@NonNull
java.lang.String value)
resourceType - the resource type of the symbolname - the name of the symboljavaType - the java type of the symbolvalue - the value of the symbol@NonNull public java.lang.String getResourceType()
@NonNull public java.lang.String getValue()
@NonNull public java.lang.String getName()
@NonNull public java.lang.String getJavaType()
public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Object