Class FieldOptions (3.15.8)

public sealed class FieldOptions : object, IExtendableMessage<FieldOptions>, IMessage<FieldOptions>, IEquatable<FieldOptions>, IDeepCloneable<FieldOptions>, IBufferMessage, IMessage

Inheritance

Object > FieldOptions

Namespace

Google.Protobuf.Reflection

Assembly

Google.Protobuf.dll

Constructors

FieldOptions()

public FieldOptions()

FieldOptions(FieldOptions)

public FieldOptions(FieldOptions other)
Parameter
NameDescription
otherFieldOptions

Fields

CtypeFieldNumber

public const int CtypeFieldNumber = null

Field number for the "ctype" field.

Field Value
TypeDescription
Int32

DeprecatedFieldNumber

public const int DeprecatedFieldNumber = null

Field number for the "deprecated" field.

Field Value
TypeDescription
Int32

JstypeFieldNumber

public const int JstypeFieldNumber = null

Field number for the "jstype" field.

Field Value
TypeDescription
Int32

LazyFieldNumber

public const int LazyFieldNumber = null

Field number for the "lazy" field.

Field Value
TypeDescription
Int32

PackedFieldNumber

public const int PackedFieldNumber = null

Field number for the "packed" field.

Field Value
TypeDescription
Int32

UninterpretedOptionFieldNumber

public const int UninterpretedOptionFieldNumber = null

Field number for the "uninterpreted_option" field.

Field Value
TypeDescription
Int32

WeakFieldNumber

public const int WeakFieldNumber = null

Field number for the "weak" field.

Field Value
TypeDescription
Int32

Properties

Ctype

public FieldOptions.Types.CType Ctype { get; set; }

The ctype option instructs the C++ code generator to use a different representation of the field than it normally would. See the specific options below. This option is not yet implemented in the open source release -- sorry, we'll try to include it in a future version!

Property Value
TypeDescription
FieldOptions.Types.CType

Deprecated

public bool Deprecated { get; set; }

Is this field deprecated? Depending on the target platform, this can emit Deprecated annotations for accessors, or it will be completely ignored; in the very least, this is a formalization for deprecating fields.

Property Value
TypeDescription
Boolean

Descriptor

public static MessageDescriptor Descriptor { get; }
Property Value
TypeDescription
MessageDescriptor

HasCtype

public bool HasCtype { get; }

Gets whether the "ctype" field is set

Property Value
TypeDescription
Boolean

HasDeprecated

public bool HasDeprecated { get; }

Gets whether the "deprecated" field is set

Property Value
TypeDescription
Boolean

HasJstype

public bool HasJstype { get; }

Gets whether the "jstype" field is set

Property Value
TypeDescription
Boolean

HasLazy

public bool HasLazy { get; }

Gets whether the "lazy" field is set

Property Value
TypeDescription
Boolean

HasPacked

public bool HasPacked { get; }

Gets whether the "packed" field is set

Property Value
TypeDescription
Boolean

HasWeak

public bool HasWeak { get; }

Gets whether the "weak" field is set

Property Value
TypeDescription
Boolean

Jstype

public FieldOptions.Types.JSType Jstype { get; set; }

The jstype option determines the JavaScript type used for values of the field. The option is permitted only for 64 bit integral and fixed types (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING is represented as JavaScript string, which avoids loss of precision that can happen when a large value is converted to a floating point JavaScript. Specifying JS_NUMBER for the jstype causes the generated JavaScript code to use the JavaScript "number" type. The behavior of the default option JS_NORMAL is implementation dependent.

This option is an enum to permit additional types to be added, e.g. goog.math.Integer.

Property Value
TypeDescription
FieldOptions.Types.JSType

Lazy

public bool Lazy { get; set; }

Should this field be parsed lazily? Lazy applies only to message-type fields. It means that when the outer message is initially parsed, the inner message's contents will not be parsed but instead stored in encoded form. The inner message will actually be parsed when it is first accessed.

This is only a hint. Implementations are free to choose whether to use eager or lazy parsing regardless of the value of this option. However, setting this option true suggests that the protocol author believes that using lazy parsing on this field is worth the additional bookkeeping overhead typically needed to implement it.

This option does not affect the public interface of any generated code; all method signatures remain the same. Furthermore, thread-safety of the interface is not affected by this option; const methods remain safe to call from multiple threads concurrently, while non-const methods continue to require exclusive access.

Note that implementations may choose not to check required fields within a lazy sub-message. That is, calling IsInitialized() on the outer message may return true even if the inner message has missing required fields. This is necessary because otherwise the inner message would have to be parsed in order to perform the check, defeating the purpose of lazy parsing. An implementation which chooses not to check required fields must be consistent about it. That is, for any particular sub-message, the implementation must either always check its required fields, or never check its required fields, regardless of whether or not the message has been parsed.

Property Value
TypeDescription
Boolean

Packed

public bool Packed { get; set; }

The packed option can be enabled for repeated primitive fields to enable a more efficient representation on the wire. Rather than repeatedly writing the tag and type for each element, the entire array is encoded as a single length-delimited blob. In proto3, only explicit setting it to false will avoid using packed encoding.

Property Value
TypeDescription
Boolean

Parser

public static MessageParser<FieldOptions> Parser { get; }
Property Value
TypeDescription
MessageParser<FieldOptions>

UninterpretedOption

public RepeatedField<UninterpretedOption> UninterpretedOption { get; }

The parser stores options it doesn't recognize here. See above.

Property Value
TypeDescription
RepeatedField<UninterpretedOption>

Weak

public bool Weak { get; set; }

For Google-internal migration only. Do not use.

Property Value
TypeDescription
Boolean

Methods

CalculateSize()

public int CalculateSize()
Returns
TypeDescription
Int32

ClearCtype()

public void ClearCtype()

Clears the value of the "ctype" field

ClearDeprecated()

public void ClearDeprecated()

Clears the value of the "deprecated" field

ClearExtension<TValue>(Extension<FieldOptions, TValue>)

public void ClearExtension<TValue>(Extension<FieldOptions, TValue> extension)
Parameter
NameDescription
extensionExtension<FieldOptions, TValue>
Type Parameter
NameDescription
TValue

ClearExtension<TValue>(RepeatedExtension<FieldOptions, TValue>)

public void ClearExtension<TValue>(RepeatedExtension<FieldOptions, TValue> extension)
Parameter
NameDescription
extensionRepeatedExtension<FieldOptions, TValue>
Type Parameter
NameDescription
TValue

ClearJstype()

public void ClearJstype()

Clears the value of the "jstype" field

ClearLazy()

public void ClearLazy()

Clears the value of the "lazy" field

ClearPacked()

public void ClearPacked()

Clears the value of the "packed" field

ClearWeak()

public void ClearWeak()

Clears the value of the "weak" field

Clone()

public FieldOptions Clone()
Returns
TypeDescription
FieldOptions

Equals(FieldOptions)

public bool Equals(FieldOptions other)
Parameter
NameDescription
otherFieldOptions
Returns
TypeDescription
Boolean

Equals(Object)

public override bool Equals(object other)
Parameter
NameDescription
otherObject
Returns
TypeDescription
Boolean

GetExtension<TValue>(Extension<FieldOptions, TValue>)

public TValue GetExtension<TValue>(Extension<FieldOptions, TValue> extension)
Parameter
NameDescription
extensionExtension<FieldOptions, TValue>
Returns
TypeDescription
TValue
Type Parameter
NameDescription
TValue

GetExtension<TValue>(RepeatedExtension<FieldOptions, TValue>)

public RepeatedField<TValue> GetExtension<TValue>(RepeatedExtension<FieldOptions, TValue> extension)
Parameter
NameDescription
extensionRepeatedExtension<FieldOptions, TValue>
Returns
TypeDescription
RepeatedField<TValue>
Type Parameter
NameDescription
TValue

GetHashCode()

public override int GetHashCode()
Returns
TypeDescription
Int32

GetOrInitializeExtension<TValue>(RepeatedExtension<FieldOptions, TValue>)

public RepeatedField<TValue> GetOrInitializeExtension<TValue>(RepeatedExtension<FieldOptions, TValue> extension)
Parameter
NameDescription
extensionRepeatedExtension<FieldOptions, TValue>
Returns
TypeDescription
RepeatedField<TValue>
Type Parameter
NameDescription
TValue

HasExtension<TValue>(Extension<FieldOptions, TValue>)

public bool HasExtension<TValue>(Extension<FieldOptions, TValue> extension)
Parameter
NameDescription
extensionExtension<FieldOptions, TValue>
Returns
TypeDescription
Boolean
Type Parameter
NameDescription
TValue

MergeFrom(CodedInputStream)

public void MergeFrom(CodedInputStream input)
Parameter
NameDescription
inputCodedInputStream

MergeFrom(FieldOptions)

public void MergeFrom(FieldOptions other)
Parameter
NameDescription
otherFieldOptions

SetExtension<TValue>(Extension<FieldOptions, TValue>, TValue)

public void SetExtension<TValue>(Extension<FieldOptions, TValue> extension, TValue value)
Parameters
NameDescription
extensionExtension<FieldOptions, TValue>
valueTValue
Type Parameter
NameDescription
TValue

ToString()

public override string ToString()
Returns
TypeDescription
String

WriteTo(CodedOutputStream)

public void WriteTo(CodedOutputStream output)
Parameter
NameDescription
outputCodedOutputStream

Explicit Interface Implementations

IBufferMessage.InternalMergeFrom(ref ParseContext)

void IBufferMessage.InternalMergeFrom(ref ParseContext input)
Parameter
NameDescription
inputParseContext

IBufferMessage.InternalWriteTo(ref WriteContext)

void IBufferMessage.InternalWriteTo(ref WriteContext output)
Parameter
NameDescription
outputWriteContext

IMessage.Descriptor

MessageDescriptor IMessage.Descriptor { get; }
Returns
TypeDescription
MessageDescriptor