IReplaceable Interface

Definition

Replaceable is an interface representing a string of characters that supports the replacement of a range of itself with a new string of characters.

[Android.Runtime.Register("android/icu/text/Replaceable", "", "Android.Icu.Text.IReplaceableInvoker", ApiSince=24)]
public interface IReplaceable : Android.Runtime.IJavaObject, IDisposable, Java.Interop.IJavaPeerable
[<Android.Runtime.Register("android/icu/text/Replaceable", "", "Android.Icu.Text.IReplaceableInvoker", ApiSince=24)>]
type IReplaceable = interface
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
Attributes
Implements

Remarks

Replaceable is an interface representing a string of characters that supports the replacement of a range of itself with a new string of characters. It is used by APIs that change a piece of text while retaining metadata. Metadata is data other than the Unicode characters returned by char32At(). One example of metadata is style attributes; another is an edit history, marking each character with an author and revision number.

An implicit aspect of the Replaceable API is that during a replace operation, new characters take on the metadata of the old characters. For example, if the string "the <b>bold</b> font" has range (4, 8) replaced with "strong", then it becomes "the <b>strong</b> font".

Replaceable specifies ranges using a start offset and a limit offset. The range of characters thus specified includes the characters at offset start..limit-1. That is, the start offset is inclusive, and the limit offset is exclusive.

Replaceable also includes API to access characters in the string: length(), charAt(), char32At(), and extractBetween().

For a subclass to support metadata, typical behavior of replace() is the following: <ul> <li>Set the metadata of the new text to the metadata of the first character replaced</li> <li>If no characters are replaced, use the metadata of the previous character</li> <li>If there is no previous character (i.e. start == 0), use the following character</li> <li>If there is no following character (i.e. the replaceable was empty), use default metadata<br> <li>If the code point U+FFFF is seen, it should be interpreted as a special marker having no metadata<li> </li> </ul> If this is not the behavior, the subclass should document any differences.

Java documentation for android.icu.text.Replaceable.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Properties

Handle

Gets the JNI value of the underlying Android object.

(Inherited from IJavaObject)
HasMetaData
JniIdentityHashCode

Returns the value of java.lang.System.identityHashCode() for the wrapped instance.

(Inherited from IJavaPeerable)
JniManagedPeerState

State of the managed peer.

(Inherited from IJavaPeerable)
JniPeerMembers

Member access and invocation support.

(Inherited from IJavaPeerable)
PeerReference

Returns a JniObjectReference of the wrapped Java object instance.

(Inherited from IJavaPeerable)

Methods

Char32At(Int32)

Returns the 32-bit code point at the given 16-bit offset into the text.

CharAt(Int32)

Returns the 16-bit code unit at the given offset into the text.

Copy(Int32, Int32, Int32)

Copies a substring of this object, retaining metadata.

Disposed()

Called when the instance has been disposed.

(Inherited from IJavaPeerable)
DisposeUnlessReferenced()

If there are no outstanding references to this instance, then calls Dispose(); otherwise, does nothing.

(Inherited from IJavaPeerable)
Finalized()

Called when the instance has been finalized.

(Inherited from IJavaPeerable)
GetChars(Int32, Int32, Char[], Int32)

Copies characters from this object into the destination character array.

Length()

Returns the number of 16-bit code units in the text.

Replace(Int32, Int32, Char[], Int32, Int32)

Replaces a substring of this object with the given text.

Replace(Int32, Int32, String)

Replaces a substring of this object with the given text.

SetJniIdentityHashCode(Int32)

Set the value returned by JniIdentityHashCode.

(Inherited from IJavaPeerable)
SetJniManagedPeerState(JniManagedPeerStates) (Inherited from IJavaPeerable)
SetPeerReference(JniObjectReference)

Set the value returned by PeerReference.

(Inherited from IJavaPeerable)
UnregisterFromRuntime()

Unregister this instance so that the runtime will not return it from future Java.Interop.JniRuntime+JniValueManager.PeekValue invocations.

(Inherited from IJavaPeerable)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Gets the JNI name of the type of the instance self.

JavaAs<TResult>(IJavaPeerable)

Try to coerce self to type TResult, checking that the coercion is valid on the Java side.

TryJavaCast<TResult>(IJavaPeerable, TResult)

Try to coerce self to type TResult, checking that the coercion is valid on the Java side.

Applies to