Class StubStrategy
- java.lang.Object
-
- org.wildfly.iiop.openjdk.rmi.marshal.strategy.StubStrategy
-
public class StubStrategy extends Object
AnStubStrategyfor a given method knows how to marshal the sequence of method parameters into a CDR output stream, how to unmarshal from a CDR input stream the return value of the method, and how to unmarshal from a CDR input stream an application exception thrown by the method.- Version:
- $Revision: 81018 $
- Author:
- Francisco Reverbel
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectconvertLocalRetval(Object obj)Converts the return value of a local invocation into the expected type.static StubStrategyforMethod(String[] paramTypes, String[] excepIds, String[] excepTypes, String retvalType, ClassLoader cl)Returns anStubStrategyfor a method, given descriptions of the method parameters, exceptions, and return value.booleanisDeclaredException(Throwable t)Checks if a givenThrowableinstance corresponds to an exception declared by thisStubStrategy's method.booleanisNonVoid()Returns true if thisStubStrategy's method is non void.ExceptionreadException(String id, org.omg.CORBA_2_3.portable.InputStream in)Unmarshals from an input stream an exception thrown by the method.ObjectreadRetval(org.omg.CORBA_2_3.portable.InputStream in)Unmarshals from an input stream the return value of the method.voidwriteParams(org.omg.CORBA_2_3.portable.OutputStream out, Object[] params)Marshals the sequence of method parameters into an output stream.
-
-
-
Method Detail
-
forMethod
public static StubStrategy forMethod(String[] paramTypes, String[] excepIds, String[] excepTypes, String retvalType, ClassLoader cl)
Returns anStubStrategyfor a method, given descriptions of the method parameters, exceptions, and return value. Parameter and return value descriptions are "marshaller abbreviated names".- Parameters:
paramTypes- a string array with marshaller abbreviated names for the method parametersexcepIds- a string array with the CORBA repository ids of the exceptions thrown by the methodexcepTypes- a string array with the Java class names of the exceptions thrown by the methodretvalType- marshaller abbreaviated name for the return value of the methodcl- aClassLoaderto load value classes (if null, the current thread's context class loader will be used)- Returns:
- an
StubStrategyfor the operation with the parameters, exceptions, and return value specified. - See Also:
CDRStream.abbrevFor(Class clz)
-
writeParams
public void writeParams(org.omg.CORBA_2_3.portable.OutputStream out, Object[] params)Marshals the sequence of method parameters into an output stream.- Parameters:
out- a CDR output streamparams- an object array with the parameters.
-
isNonVoid
public boolean isNonVoid()
Returns true if thisStubStrategy's method is non void.
-
readRetval
public Object readRetval(org.omg.CORBA_2_3.portable.InputStream in)
Unmarshals from an input stream the return value of the method.- Parameters:
in- a CDR input stream- Returns:
- a value unmarshaled from the stream.
-
readException
public Exception readException(String id, org.omg.CORBA_2_3.portable.InputStream in)
Unmarshals from an input stream an exception thrown by the method.- Parameters:
id- the repository id of the exception to unmarshalin- a CDR input stream- Returns:
- an exception unmarshaled from the stream.
-
isDeclaredException
public boolean isDeclaredException(Throwable t)
Checks if a givenThrowableinstance corresponds to an exception declared by thisStubStrategy's method.- Parameters:
t- an exception class- Returns:
- true if
tis an instance of any of the exceptions declared by thisStubStrategy's method, false otherwise.
-
convertLocalRetval
public Object convertLocalRetval(Object obj)
Converts the return value of a local invocation into the expected type. A conversion is needed if the return value is a remote interface (in this casePortableRemoteObject.narrow()must be called).- Parameters:
obj- the return value to be converted- Returns:
- the converted value.
-
-