public sealed class FieldOptions : 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 = 1
Field number for the "ctype" field.
Field Value |
Type |
Description |
int |
|
DebugRedactFieldNumber
public const int DebugRedactFieldNumber = 16
Field number for the "debug_redact" field.
Field Value |
Type |
Description |
int |
|
DeprecatedFieldNumber
public const int DeprecatedFieldNumber = 3
Field number for the "deprecated" field.
Field Value |
Type |
Description |
int |
|
JstypeFieldNumber
public const int JstypeFieldNumber = 6
Field number for the "jstype" field.
Field Value |
Type |
Description |
int |
|
LazyFieldNumber
public const int LazyFieldNumber = 5
Field number for the "lazy" field.
Field Value |
Type |
Description |
int |
|
PackedFieldNumber
public const int PackedFieldNumber = 2
Field number for the "packed" field.
Field Value |
Type |
Description |
int |
|
RetentionFieldNumber
public const int RetentionFieldNumber = 17
Field number for the "retention" field.
Field Value |
Type |
Description |
int |
|
TargetFieldNumber
public const int TargetFieldNumber = 18
Field number for the "target" field.
Field Value |
Type |
Description |
int |
|
TargetsFieldNumber
public const int TargetsFieldNumber = 19
Field number for the "targets" field.
Field Value |
Type |
Description |
int |
|
UninterpretedOptionFieldNumber
public const int UninterpretedOptionFieldNumber = 999
Field number for the "uninterpreted_option" field.
Field Value |
Type |
Description |
int |
|
UnverifiedLazyFieldNumber
public const int UnverifiedLazyFieldNumber = 15
Field number for the "unverified_lazy" field.
Field Value |
Type |
Description |
int |
|
WeakFieldNumber
public const int WeakFieldNumber = 10
Field number for the "weak" field.
Field Value |
Type |
Description |
int |
|
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 only implemented to support use of
[ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of
type "bytes" in the open source release -- sorry, we'll try to include
other types in a future version!
DebugRedact
public bool DebugRedact { get; set; }
Indicate that the field value should not be printed out when using debug
formats, e.g. when the field contains sensitive credentials.
Property Value |
Type |
Description |
bool |
|
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 |
bool |
|
Descriptor
public static MessageDescriptor Descriptor { get; }
HasCtype
public bool HasCtype { get; }
Gets whether the "ctype" field is set
Property Value |
Type |
Description |
bool |
|
HasDebugRedact
public bool HasDebugRedact { get; }
Gets whether the "debug_redact" field is set
Property Value |
Type |
Description |
bool |
|
HasDeprecated
public bool HasDeprecated { get; }
Gets whether the "deprecated" field is set
Property Value |
Type |
Description |
bool |
|
HasJstype
public bool HasJstype { get; }
Gets whether the "jstype" field is set
Property Value |
Type |
Description |
bool |
|
HasLazy
public bool HasLazy { get; }
Gets whether the "lazy" field is set
Property Value |
Type |
Description |
bool |
|
HasPacked
public bool HasPacked { get; }
Gets whether the "packed" field is set
Property Value |
Type |
Description |
bool |
|
HasRetention
public bool HasRetention { get; }
Gets whether the "retention" field is set
Property Value |
Type |
Description |
bool |
|
HasTarget
[Obsolete]
public bool HasTarget { get; }
Gets whether the "target" field is set
Property Value |
Type |
Description |
bool |
|
HasUnverifiedLazy
public bool HasUnverifiedLazy { get; }
Gets whether the "unverified_lazy" field is set
Property Value |
Type |
Description |
bool |
|
HasWeak
public bool HasWeak { get; }
Gets whether the "weak" field is set
Property Value |
Type |
Description |
bool |
|
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.
As of May 2022, lazy verifies the contents of the byte stream during
parsing. An invalid byte stream will cause the overall parsing to fail.
Property Value |
Type |
Description |
bool |
|
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 |
bool |
|
Parser
public static MessageParser<FieldOptions> Parser { get; }
Retention
public FieldOptions.Types.OptionRetention Retention { get; set; }
Target
[Obsolete]
public FieldOptions.Types.OptionTargetType Target { get; set; }
Targets
public RepeatedField<FieldOptions.Types.OptionTargetType> Targets { get; }
UninterpretedOption
public RepeatedField<UninterpretedOption> UninterpretedOption { get; }
The parser stores options it doesn't recognize here. See above.
UnverifiedLazy
public bool UnverifiedLazy { get; set; }
unverified_lazy does no correctness checks on the byte stream. This should
only be used where lazy with verification is prohibitive for performance
reasons.
Property Value |
Type |
Description |
bool |
|
Weak
public bool Weak { get; set; }
For Google-internal migration only. Do not use.
Property Value |
Type |
Description |
bool |
|
Methods
CalculateSize()
public int CalculateSize()
Calculates the size of this message in Protocol Buffer wire format, in bytes.
Returns |
Type |
Description |
int |
The number of bytes required to write this message
to a coded output stream.
|
ClearCtype()
Clears the value of the "ctype" field
ClearDebugRedact()
public void ClearDebugRedact()
Clears the value of the "debug_redact" 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)
Clears the value of the specified extension
Type Parameter |
Name |
Description |
TValue |
|
ClearExtension<TValue>(RepeatedExtension<FieldOptions, TValue>)
public void ClearExtension<TValue>(RepeatedExtension<FieldOptions, TValue> extension)
Clears the value of the specified repeated 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
ClearRetention()
public void ClearRetention()
Clears the value of the "retention" field
ClearTarget()
[Obsolete]
public void ClearTarget()
Clears the value of the "target" field
ClearUnverifiedLazy()
public void ClearUnverifiedLazy()
Clears the value of the "unverified_lazy" field
ClearWeak()
Clears the value of the "weak" field
Clone()
public FieldOptions Clone()
Creates a deep clone of this object.
Returns |
Type |
Description |
FieldOptions |
A deep clone of this object.
|
Equals(FieldOptions)
public bool Equals(FieldOptions other)
Returns |
Type |
Description |
bool |
|
Equals(object)
public override bool Equals(object other)
Parameter |
Name |
Description |
other |
object
|
Returns |
Type |
Description |
bool |
|
Overrides
GetExtension<TValue>(Extension<FieldOptions, TValue>)
public TValue GetExtension<TValue>(Extension<FieldOptions, TValue> extension)
Gets the value of the specified 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 |
int |
|
Overrides
GetOrInitializeExtension<TValue>(RepeatedExtension<FieldOptions, TValue>)
public RepeatedField<TValue> GetOrInitializeExtension<TValue>(RepeatedExtension<FieldOptions, TValue> extension)
Gets the value of the specified repeated extension, registering it if it hasn't already been registered.
Type Parameter |
Name |
Description |
TValue |
|
HasExtension<TValue>(Extension<FieldOptions, TValue>)
public bool HasExtension<TValue>(Extension<FieldOptions, TValue> extension)
Gets whether the value of the specified extension is set
Returns |
Type |
Description |
bool |
|
Type Parameter |
Name |
Description |
TValue |
|
public void MergeFrom(CodedInputStream input)
Merges the data from the specified coded input stream with the current message.
Remarks
MergeFrom(FieldOptions)
public void MergeFrom(FieldOptions other)
Merges the given message into this one.
Remarks
SetExtension<TValue>(Extension<FieldOptions, TValue>, TValue)
public void SetExtension<TValue>(Extension<FieldOptions, TValue> extension, TValue value)
Sets the value of the specified extension
Type Parameter |
Name |
Description |
TValue |
|
ToString()
public override string ToString()
Returns |
Type |
Description |
string |
|
Overrides
WriteTo(CodedOutputStream)
public void WriteTo(CodedOutputStream output)
Writes the data to the given coded output stream.
Parameter |
Name |
Description |
output |
CodedOutputStream
Coded output stream to write the data to. Must not be null.
|
Extension Methods