package saker.rmi.connection
Builder class for custom construction of method properties.
public MethodTransferProperties | build() Creates the transfer properties specified by this builder. |
public Builder | cacheResult( Sets if the result of an RMI method call should be cached for future reuse. |
public Builder | defaultOnFailure( Sets if the default implementation should be called for the method in case of RMI error. |
public Builder | forbidden( Sets if this method is callable through RMI. |
public Builder | parameterWriter( Sets the write handler for the parameter at the specified index. |
public Builder | parameterWriters( Sets all of write handlers for every parameter. |
public Builder | Sets the method to redirect RMI calls to. |
public Builder | returnWriter( Sets the writer for the return value. |
public Builder | rmiExceptionRethrow( Sets the class which to use to rethrow RMI errors. |
public Builder | rmiExceptionRethrow( Sets the exception constructor which to use to rethrow RMI errors. |
Creates the transfer properties specified by this builder.
The constructed transfer properties.
Sets if the result of an RMI method call should be cached for future reuse.
cache
true
if the result should be cached.this
RMIInvalidConfigurationExceptionIn case of invalid configuration.
Sets if the default implementation should be called for the method in case of RMI error.
defaultonfailure
true
if the default implementation should be called.this
RMIInvalidConfigurationExceptionIn case of invalid configuration.
Sets if this method is callable through RMI.
When designing security sensitive applications, setting this true
on the server side transfer
properties doesn't protect against remote calls issued by the client. I.e. The forbidden method may still be
called by a malicious client.
forbidden
true
if it may not be called.this
RMIInvalidConfigurationExceptionIn case of invalid configuration.
Sets the write handler for the parameter at the specified index.
indexThe index of the parameter.
writerThe write handler.
this
public Builder parameterWriters(RMIObjectWriteHandler[] writers) throws IndexOutOfBoundsException, NullPointerException
Sets all of write handlers for every parameter.
The parameter array can contain null
, in which case the default write handler will be used.
writersThe write handlers for the parameters.
this
IndexOutOfBoundsExceptionIf the parameter array is not the same length as the parameter count.
NullPointerExceptionIf the parameter array is
null
.Sets the method to redirect RMI calls to.
methodThe redirected method or
null
to disable redirection.this
RMIInvalidConfigurationExceptionIn case of invalid configuration.
Sets the writer for the return value.
The argument writer will be used when the method is invoked by a remote client.
writerThe write handler.
this
public Builder rmiExceptionRethrow(Class<? extends Throwable> rethrowclass ) throws RMIInvalidConfigurationException
Sets the class which to use to rethrow RMI errors.
rethrowclassThe exception class to use or
null
to disable rethrowing.this
RMIInvalidConfigurationExceptionIn case of invalid configuration.
public Builder rmiExceptionRethrow(Constructor<? extends Throwable> rethrowconstructor ) throws RMIInvalidConfigurationException
Sets the exception constructor which to use to rethrow RMI errors.
rethrowconstructorThe constructor to create rethrown exceptions or
null
to disable rethrowing.this
RMIInvalidConfigurationExceptionIn case of invalid configuration.