Inheritance: java.lang.Object, java.io.Serializable
コード例 #1
0
        /// <summary>
        /// Resolves instances being deserialized to the predefined constants.
        /// </summary>
        /// <returns> the resolved {@code Attribute} object </returns>
        /// <exception cref="InvalidObjectException"> if the object to resolve is not
        ///                                an instance of {@code Attribute} </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: protected Object readResolve() throws java.io.InvalidObjectException
        protected internal virtual Object ReadResolve()
        {
            if (this.GetType() != typeof(AttributedCharacterIterator_Attribute))
            {
                throw new InvalidObjectException("subclass didn't correctly implement readResolve");
            }

            AttributedCharacterIterator_Attribute instance = InstanceMap[Name];

            if (instance != null)
            {
                return(instance);
            }
            else
            {
                throw new InvalidObjectException("unknown attribute name");
            }
        }
コード例 #2
0
        /// <summary>
        /// Creates an AttributedCharacterIterator with the contents of
        /// <code>iterator</code> and the additional attribute <code>key</code>
        /// <code>value</code>.
        /// </summary>
        /// <param name="iterator"> Initial AttributedCharacterIterator to add arg to </param>
        /// <param name="key"> Key for AttributedCharacterIterator </param>
        /// <param name="value"> Value associated with key in AttributedCharacterIterator </param>
        /// <returns> AttributedCharacterIterator wrapping args </returns>
        internal virtual AttributedCharacterIterator CreateAttributedCharacterIterator(AttributedCharacterIterator iterator, AttributedCharacterIterator_Attribute key, Object value)
        {
            AttributedString @as = new AttributedString(iterator);

            @as.AddAttribute(key, value);
            return(@as.Iterator);
        }