Package org.fusesource.hawtbuf.proto
Class UninitializedMessageException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- org.fusesource.hawtbuf.proto.UninitializedMessageException
-
- All Implemented Interfaces:
java.io.Serializable
public class UninitializedMessageException extends java.lang.RuntimeExceptionThrown when attempting to build a protocol message that is missing required fields. This is aRuntimeExceptionbecause it normally represents a programming error: it happens when some code which constructs a message fails to set all the fields.parseFrom()methods do not throw this; they throw anInvalidProtocolBufferExceptionif required fields are missing, because it is not a programming error to receive an incomplete message. In other words,UninitializedMessageExceptionshould never be thrown by correct code, butInvalidProtocolBufferExceptionmight be.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<java.lang.String>missingFields
-
Constructor Summary
Constructors Constructor Description UninitializedMessageException(java.util.List<java.lang.String> missingFields)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description InvalidProtocolBufferExceptionasInvalidProtocolBufferException()Converts this exception to anInvalidProtocolBufferException.private static java.lang.StringbuildDescription(java.util.List<java.lang.String> missingFields)Construct the description string for this exception.java.util.List<java.lang.String>getMissingFields()Get a list of human-readable names of required fields missing from this message.
-
-
-
Method Detail
-
getMissingFields
public java.util.List<java.lang.String> getMissingFields()
Get a list of human-readable names of required fields missing from this message. Each name is a full path to a field, e.g. "foo.bar[5].baz".
-
asInvalidProtocolBufferException
public InvalidProtocolBufferException asInvalidProtocolBufferException()
Converts this exception to anInvalidProtocolBufferException. When a parsed message is missing required fields, this should be thrown instead ofUninitializedMessageException.
-
buildDescription
private static java.lang.String buildDescription(java.util.List<java.lang.String> missingFields)
Construct the description string for this exception.
-
-