Package net.morimekta.providence
Class PApplicationException._Builder
- java.lang.Object
-
- net.morimekta.providence.PMessageBuilder<PApplicationException,PApplicationException._Field>
-
- net.morimekta.providence.PApplicationException._Builder
-
- All Implemented Interfaces:
PBuilder<PApplicationException>,BinaryReader
- Enclosing class:
- PApplicationException
public static class PApplicationException._Builder extends PMessageBuilder<PApplicationException,PApplicationException._Field> implements BinaryReader
Base exception thrown on non-declared exceptions on a service call, and other server-side service call issues.
-
-
Constructor Summary
Constructors Constructor Description _Builder()Make a pservice.PApplicationException builder instance._Builder(PApplicationException base)Make a mutating builder off a base pservice.PApplicationException.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PApplicationException._BuilderaddTo(int key, java.lang.Object value)Adds a value to a set or list container.PApplicationExceptionbuild()Build the instance value.PApplicationException._Builderclear(int key)Clear the provided field value.PApplicationException._BuilderclearId()Clear theidfield.PApplicationException._BuilderclearMessage()Clear themessagefield.PExceptionDescriptor<PApplicationException,PApplicationException._Field>descriptor()Get the descriptor for the message being built.booleanequals(java.lang.Object o)PApplicationExceptionTypegetId()The application exception type.java.lang.StringgetMessage()Exception message.inthashCode()PApplicationException._BuilderinitCause(java.lang.Throwable cause)Initializes the cause of the pservice.PApplicationExceptionbooleanisModified(int key)Checks if a specific field is modified on the builder.booleanisModifiedId()Checks if theidfield has been modified since the builder was created.booleanisModifiedMessage()Checks if themessagefield has been modified since the builder was created.booleanisSet(int key)Checks if a specific field is set on the builder.booleanisSetId()Checks for presence of theidfield.booleanisSetMessage()Checks for presence of themessagefield.PApplicationException._Buildermerge(PApplicationException from)Merges the provided message into the builder.PMessageBuildermutator(int key)Get the builder for the given message contained in this builder.voidreadBinary(net.morimekta.util.io.BigEndianBinaryReader reader, boolean strict)Read the binary content into the current builder.PApplicationException._Builderset(int key, java.lang.Object value)Set the provided field value.PApplicationException._BuildersetId(PApplicationExceptionType value)Set theidfield value.PApplicationException._BuildersetMessage(java.lang.String value)Set themessagefield value.booleanvalid()Checks if the current set data is enough to make a valid struct.voidvalidate()Checks if the current set data is enough to make a valid struct.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from class net.morimekta.providence.PMessageBuilder
addTo, clear, isModified, isSet, modifiedFields, mutator, presentFields, set
-
-
-
-
Constructor Detail
-
_Builder
public _Builder()
Make a pservice.PApplicationException builder instance.
-
_Builder
public _Builder(PApplicationException base)
Make a mutating builder off a base pservice.PApplicationException.- Parameters:
base- The base PApplicationException
-
-
Method Detail
-
merge
@Nonnull public PApplicationException._Builder merge(PApplicationException from)
Description copied from class:PMessageBuilderMerges the provided message into the builder. Contained messages should in turn be merged and not replaced wholesale. Sets are unioned (addAll) and maps will overwrite / replace on a per-key basis (putAll).- Specified by:
mergein classPMessageBuilder<PApplicationException,PApplicationException._Field>- Parameters:
from- The message to merge values from.- Returns:
- The message builder.
-
setMessage
@Nonnull public PApplicationException._Builder setMessage(java.lang.String value)
Set themessagefield value.Exception message.
- Parameters:
value- The new value- Returns:
- The builder
-
isSetMessage
public boolean isSetMessage()
Checks for presence of themessagefield.- Returns:
- True if message has been set.
-
isModifiedMessage
public boolean isModifiedMessage()
Checks if themessagefield has been modified since the builder was created.- Returns:
- True if message has been modified.
-
clearMessage
@Nonnull public PApplicationException._Builder clearMessage()
Clear themessagefield.- Returns:
- The builder
-
getMessage
public java.lang.String getMessage()
Exception message.- Returns:
- The
messagefield value
-
setId
@Nonnull public PApplicationException._Builder setId(PApplicationExceptionType value)
Set theidfield value.The application exception type.
- Parameters:
value- The new value- Returns:
- The builder
-
isSetId
public boolean isSetId()
Checks for presence of theidfield.- Returns:
- True if id has been set.
-
isModifiedId
public boolean isModifiedId()
Checks if theidfield has been modified since the builder was created.- Returns:
- True if id has been modified.
-
clearId
@Nonnull public PApplicationException._Builder clearId()
Clear theidfield.- Returns:
- The builder
-
getId
public PApplicationExceptionType getId()
The application exception type.- Returns:
- The
idfield value
-
initCause
@Nonnull public PApplicationException._Builder initCause(java.lang.Throwable cause)
Initializes the cause of the pservice.PApplicationException- Parameters:
cause- The cause- Returns:
- Builder instance
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
mutator
public PMessageBuilder mutator(int key)
Description copied from class:PMessageBuilderGet the builder for the given message contained in this builder. If the sub-builder does not exist, create, either from existing instance or from scratch.- Specified by:
mutatorin classPMessageBuilder<PApplicationException,PApplicationException._Field>- Parameters:
key- The field key.- Returns:
- The field builder.
-
set
@Nonnull public PApplicationException._Builder set(int key, java.lang.Object value)
Description copied from class:PMessageBuilderSet the provided field value.- Specified by:
setin classPMessageBuilder<PApplicationException,PApplicationException._Field>- Parameters:
key- The key of the field to set.value- The value to be set.- Returns:
- The message builder.
-
isSet
public boolean isSet(int key)
Description copied from class:PMessageBuilderChecks if a specific field is set on the builder.- Specified by:
isSetin classPMessageBuilder<PApplicationException,PApplicationException._Field>- Parameters:
key- The key of the field to check.- Returns:
- True if the field is set.
-
isModified
public boolean isModified(int key)
Description copied from class:PMessageBuilderChecks if a specific field is modified on the builder.- Specified by:
isModifiedin classPMessageBuilder<PApplicationException,PApplicationException._Field>- Parameters:
key- The key of the field to check.- Returns:
- True if the field is modified.
-
addTo
@Nonnull public PApplicationException._Builder addTo(int key, java.lang.Object value)
Description copied from class:PMessageBuilderAdds a value to a set or list container.- Specified by:
addToin classPMessageBuilder<PApplicationException,PApplicationException._Field>- Parameters:
key- The key of the container field to add too.value- The value to add.- Returns:
- The message builder.
-
clear
@Nonnull public PApplicationException._Builder clear(int key)
Description copied from class:PMessageBuilderClear the provided field value.- Specified by:
clearin classPMessageBuilder<PApplicationException,PApplicationException._Field>- Parameters:
key- The key of the field to clear.- Returns:
- The message builder.
-
valid
public boolean valid()
Description copied from class:PMessageBuilderChecks if the current set data is enough to make a valid struct. It will check for all required fields, and if any are missing it will return false.- Specified by:
validin classPMessageBuilder<PApplicationException,PApplicationException._Field>- Returns:
- True for a valid message.
-
validate
public void validate()
Description copied from class:PMessageBuilderChecks if the current set data is enough to make a valid struct. It will check for all required fields, and if any are missing it will throw anIllegalStateExceptionwith an appropriate error message.- Specified by:
validatein classPMessageBuilder<PApplicationException,PApplicationException._Field>
-
descriptor
@Nonnull public PExceptionDescriptor<PApplicationException,PApplicationException._Field> descriptor()
Description copied from class:PMessageBuilderGet the descriptor for the message being built.- Specified by:
descriptorin classPMessageBuilder<PApplicationException,PApplicationException._Field>- Returns:
- The struct descriptor.
-
readBinary
public void readBinary(net.morimekta.util.io.BigEndianBinaryReader reader, boolean strict) throws java.io.IOExceptionDescription copied from interface:BinaryReaderRead the binary content into the current builder. NOTE: This method is not intended to be used directly. Instead use theBinarySerializer.deserialize(InputStream, PMessageDescriptor)call.- Specified by:
readBinaryin interfaceBinaryReader- Parameters:
reader- The reader to read from.strict- If content should be handled strictly. True means to fail on everything that Apache thrift failed read() on.- Throws:
java.io.IOException- When unable to read message for any reason.
-
build
public PApplicationException build()
Description copied from interface:PBuilderBuild the instance value.- Specified by:
buildin interfacePBuilder<PApplicationException>- Returns:
- The instance value.
-
-