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()
FieldOptions(FieldOptions)
public FieldOptions(FieldOptions other)
Fields
CtypeFieldNumber
public const int CtypeFieldNumber = null
Field number for the "ctype" field.
Field Value |
---|
Type | Description |
Int32 | |
DeprecatedFieldNumber
public const int DeprecatedFieldNumber = null
Field number for the "deprecated" field.
Field Value |
---|
Type | Description |
Int32 | |
JstypeFieldNumber
public const int JstypeFieldNumber = null
Field number for the "jstype" field.
Field Value |
---|
Type | Description |
Int32 | |
LazyFieldNumber
public const int LazyFieldNumber = null
Field number for the "lazy" field.
Field Value |
---|
Type | Description |
Int32 | |
PackedFieldNumber
public const int PackedFieldNumber = null
Field number for the "packed" field.
Field Value |
---|
Type | Description |
Int32 | |
UninterpretedOptionFieldNumber
public const int UninterpretedOptionFieldNumber = null
Field number for the "uninterpreted_option" field.
Field Value |
---|
Type | Description |
Int32 | |
WeakFieldNumber
public const int WeakFieldNumber = null
Field number for the "weak" field.
Field Value |
---|
Type | Description |
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!
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 |
---|
Type | Description |
Boolean | |
Descriptor
public static MessageDescriptor Descriptor { get; }
HasCtype
public bool HasCtype { get; }
Gets whether the "ctype" field is set
Property Value |
---|
Type | Description |
Boolean | |
HasDeprecated
public bool HasDeprecated { get; }
Gets whether the "deprecated" field is set
Property Value |
---|
Type | Description |
Boolean | |
HasJstype
public bool HasJstype { get; }
Gets whether the "jstype" field is set
Property Value |
---|
Type | Description |
Boolean | |
HasLazy
public bool HasLazy { get; }
Gets whether the "lazy" field is set
Property Value |
---|
Type | Description |
Boolean | |
HasPacked
public bool HasPacked { get; }
Gets whether the "packed" field is set
Property Value |
---|
Type | Description |
Boolean | |
HasWeak
public bool HasWeak { get; }
Gets whether the "weak" field is set
Property Value |
---|
Type | Description |
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.
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 |
---|
Type | Description |
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 |
---|
Type | Description |
Boolean | |
Parser
public static MessageParser<FieldOptions> Parser { get; }
UninterpretedOption
public RepeatedField<UninterpretedOption> UninterpretedOption { get; }
The parser stores options it doesn't recognize here. See above.
Weak
public bool Weak { get; set; }
For Google-internal migration only. Do not use.
Property Value |
---|
Type | Description |
Boolean | |
Methods
CalculateSize()
public int CalculateSize()
Returns |
---|
Type | Description |
Int32 | |
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)
Type Parameter |
---|
Name | Description |
TValue | |
ClearExtension<TValue>(RepeatedExtension<FieldOptions, TValue>)
public void ClearExtension<TValue>(RepeatedExtension<FieldOptions, TValue> extension)
Type Parameter |
---|
Name | Description |
TValue | |
ClearJstype()
public void ClearJstype()
Clears the value of the "jstype" field
ClearLazy()
Clears the value of the "lazy" field
ClearPacked()
public void ClearPacked()
Clears the value of the "packed" field
ClearWeak()
Clears the value of the "weak" field
Clone()
public FieldOptions Clone()
Equals(FieldOptions)
public bool Equals(FieldOptions other)
Equals(Object)
public override bool Equals(object other)
Parameter |
---|
Name | Description |
other | Object
|
GetExtension<TValue>(Extension<FieldOptions, TValue>)
public TValue GetExtension<TValue>(Extension<FieldOptions, TValue> extension)
Returns |
---|
Type | Description |
TValue | |
Type Parameter |
---|
Name | Description |
TValue | |
GetExtension<TValue>(RepeatedExtension<FieldOptions, TValue>)
public RepeatedField<TValue> GetExtension<TValue>(RepeatedExtension<FieldOptions, TValue> extension)
Type Parameter |
---|
Name | Description |
TValue | |
GetHashCode()
public override int GetHashCode()
Returns |
---|
Type | Description |
Int32 | |
GetOrInitializeExtension<TValue>(RepeatedExtension<FieldOptions, TValue>)
public RepeatedField<TValue> GetOrInitializeExtension<TValue>(RepeatedExtension<FieldOptions, TValue> extension)
Type Parameter |
---|
Name | Description |
TValue | |
HasExtension<TValue>(Extension<FieldOptions, TValue>)
public bool HasExtension<TValue>(Extension<FieldOptions, TValue> extension)
Type Parameter |
---|
Name | Description |
TValue | |
public void MergeFrom(CodedInputStream input)
MergeFrom(FieldOptions)
public void MergeFrom(FieldOptions other)
SetExtension<TValue>(Extension<FieldOptions, TValue>, TValue)
public void SetExtension<TValue>(Extension<FieldOptions, TValue> extension, TValue value)
Type Parameter |
---|
Name | Description |
TValue | |
ToString()
public override string ToString()
WriteTo(CodedOutputStream)
public void WriteTo(CodedOutputStream output)
Explicit Interface Implementations
IBufferMessage.InternalMergeFrom(ref ParseContext)
void IBufferMessage.InternalMergeFrom(ref ParseContext input)
IBufferMessage.InternalWriteTo(ref WriteContext)
void IBufferMessage.InternalWriteTo(ref WriteContext output)
IMessage.Descriptor
MessageDescriptor IMessage.Descriptor { get; }