# ObjectStreamClass

public class **ObjectStreamClass** extends [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)  
implements [Serializable](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Serializable.html) Serialization's descriptor for classes. It contains the name and
serialVersionUID of the class. The ObjectStreamClass for a specific class
loaded in this Java VM can be found/created using the lookup method.

The algorithm to compute the SerialVersionUID is described in
[Object
Serialization Specification, Section 4.6, Stream Unique Identifiers](https://developers.google.com/j2objc/javadoc/jre/platform/serialization/spec/class.html#4100).

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectStreamField.html`
- [Object Serialization Specification, Section 4, Class Descriptors](https://developers.google.com/j2objc/javadoc/jre/platform/serialization/spec/class.html)

### Field Summary

|---|---|---|
| public static final [ObjectStreamField\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectStreamField.html) | [NO_FIELDS](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectStreamClass.html#NO_FIELDS) | serialPersistentFields value indicating no serializable fields |

### Public Method Summary

|---|---|
| [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [forClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectStreamClass.html#forClass())() Return the class in the local VM that this version is mapped to. |
| [ObjectStreamField](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectStreamField.html) | [getField](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectStreamClass.html#getField(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) name) Get the field of this class by name. |
| [ObjectStreamField\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectStreamField.html) | [getFields](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectStreamClass.html#getFields())() Return an array of the fields of this serializable class. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getName](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectStreamClass.html#getName())() Returns the name of the class described by this descriptor. |
| long | [getSerialVersionUID](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectStreamClass.html#getSerialVersionUID())() Return the serialVersionUID for this class. |
| static [ObjectStreamClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectStreamClass.html) | [lookup](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectStreamClass.html#lookup(java.lang.Class<?>))([Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> cl) Find the descriptor for a class that can be serialized. |
| static [ObjectStreamClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectStreamClass.html) | [lookupAny](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectStreamClass.html#lookupAny(java.lang.Class<?>))([Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> cl) Returns the descriptor for any class, regardless of whether it implements `https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Serializable.html`. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectStreamClass.html#toString())() Return a string describing this ObjectStreamClass. |

### Inherited Method Summary

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

## Fields

#### public static final [ObjectStreamField\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectStreamField.html)
**NO_FIELDS**

serialPersistentFields value indicating no serializable fields

## Public Methods

#### public [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\>
**forClass**
()

Return the class in the local VM that this version is mapped to. Null
is returned if there is no corresponding local class.

##### Returns

- the `Class` instance that this descriptor represents

#### public [ObjectStreamField](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectStreamField.html)
**getField**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) name)

Get the field of this class by name.

##### Parameters

| name | the name of the data field to look for |
|---|---|

##### Returns

- The ObjectStreamField object of the named field or null if there is no such named field.

#### public [ObjectStreamField\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectStreamField.html)
**getFields**
()

Return an array of the fields of this serializable class.

##### Returns

- an array containing an element for each persistent field of this class. Returns an array of length zero if there are no fields.

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**getName**
()

Returns the name of the class described by this descriptor.
This method returns the name of the class in the format that
is used by the `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html#getName()` method.

##### Returns

- a string representing the name of the class

#### public long
**getSerialVersionUID**
()

Return the serialVersionUID for this class. The serialVersionUID
defines a set of classes all with the same name that have evolved from a
common root class and agree to be serialized and deserialized using a
common format. NonSerializable classes have a serialVersionUID of 0L.

##### Returns

- the SUID of the class described by this descriptor

#### public static [ObjectStreamClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectStreamClass.html)
**lookup**
([Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> cl)

Find the descriptor for a class that can be serialized. Creates an
ObjectStreamClass instance if one does not exist yet for class. Null is
returned if the specified class does not implement java.io.Serializable
or java.io.Externalizable.

##### Parameters

| cl | class for which to get the descriptor |
|---|---|

##### Returns

- the class descriptor for the specified class

#### public static [ObjectStreamClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectStreamClass.html)
**lookupAny**
([Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> cl)

Returns the descriptor for any class, regardless of whether it
implements `https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Serializable.html`.

##### Parameters

| cl | class for which to get the descriptor |
|---|---|

##### Returns

- the class descriptor for the specified class

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**toString**
()

Return a string describing this ObjectStreamClass.

##### Returns

- a printable representation of this object.