Package org.glassfish.rmic.iiop
Class CompoundType.Method
- java.lang.Object
-
- org.glassfish.rmic.iiop.CompoundType.Method
-
- All Implemented Interfaces:
java.lang.Cloneable
,ContextElement
- Enclosing class:
- CompoundType
public class CompoundType.Method extends java.lang.Object implements ContextElement, java.lang.Cloneable
A CompoundType.Method object encapsulates IIOP-specific information about a particular method in the interface represented by the outer instance.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String[]
argumentNames
private Type[]
arguments
private int
attributeKind
private java.lang.String
attributeName
private int
attributePairIndex
private Identifier
declaredBy
private CompoundType
enclosing
private ValueType[]
exceptions
private java.lang.String
idlName
private ValueType[]
implExceptions
private MemberDefinition
memberDef
private java.lang.String
name
private Type
returnType
private java.lang.String
stringRep
private java.lang.String
vis
-
Constructor Summary
Constructors Constructor Description Method(CompoundType enclosing, MemberDefinition memberDef, boolean quiet, ContextStack stack)
Create a new Method object corresponding to the given method definition.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.Object
clone()
Cloning is supported by returning a shallow copy of this object.private void
collectCompatibleExceptions(ValueType[] from, ValueType[] with, java.util.Vector<ValueType> list)
Add to the supplied list all exceptions in the "from" array that are subclasses of an exception in the "with" array.void
destroy()
Release all resources.boolean
equals(java.lang.Object obj)
Equality check based on method signature.java.lang.String[]
getArgumentNames()
Return the names of the argument types of this method.Type[]
getArguments()
Return the argument types of this method.int
getAttributeKind()
Return the attribute kind.java.lang.String
getAttributeName()
Return the attribute name.int
getAttributePairIndex()
For kinds ATTRIBUTE_GET_RW or ATTRIBUTE_IS_RW, return the index of the matching ATTRIBUTE_SET method, and vice-versa.Identifier
getDeclaredBy()
Return the identifier for the class or interface which declares this method.java.lang.String
getElementName()
Return context element name.CompoundType
getEnclosing()
Return the compound type which contains this method.ValueType[]
getExceptions()
Return an array of the exception classes declared to be thrown by this remote method.ValueType[]
getFilteredStubExceptions(ValueType[] list)
Return an array containing only those exceptions which need to be handled explicitly by the stub.java.lang.String
getIDLName()
IDL_Naming Return the IDL name of this method.ValueType[]
getImplExceptions()
Same as getExceptions(), except when method is in an ImplementationType and the exceptions list is narrower.MemberDefinition
getMemberDefinition()
Return the MemberDefinition from which this method was created.java.lang.String
getName()
Return the name of this method.Type
getReturnType()
Get the return type of this method.Type
getType()
Return the type of this method.ValueType[]
getUniqueCatchList(ValueType[] list)
Return an array containing only those exceptions which need to be caught.java.lang.String
getVisibility()
Return the visibility (e.g.int
hashCode()
boolean
isAttribute()
Is this method an attribute? Return true if getAttributeKind != ATTRIBUTE_NONE.boolean
isConstructor()
Return true if this is a constructor.boolean
isInherited()
Is this method inherited?boolean
isNormalMethod()
Return true if this is NOT a constructor&&
is not an attribute.boolean
isPrivate()
boolean
isProtected()
boolean
isPublic()
Methods to check various attributes.boolean
isReadWriteAttribute()
Is this method a read-write attribute?boolean
isStatic()
private java.lang.String
makeArgName(int argNum, Type type)
Make up an argument name for the given type.CompoundType.Method
mergeWith(CompoundType.Method other)
Return a new Method object that is a legal combination of this method object and another one.void
setAttributeKind(int kind)
Set attribute kind.void
setAttributeName(java.lang.String name)
Set attribute name.void
setAttributePairIndex(int index)
Set pair index.void
setDeclaredBy(Identifier by)
Set the declaredBy Identifier.void
setIDLName(java.lang.String idlName)
Set the idl name.void
setImplExceptions(ValueType[] exceptions)
Set the implExceptions array.protected void
swapInvalidTypes()
Convert all invalid types to valid ones.java.lang.String
toString()
Return the string representation of this method.
-
-
-
Field Detail
-
memberDef
private MemberDefinition memberDef
-
enclosing
private CompoundType enclosing
-
exceptions
private ValueType[] exceptions
-
implExceptions
private ValueType[] implExceptions
-
returnType
private Type returnType
-
arguments
private Type[] arguments
-
argumentNames
private java.lang.String[] argumentNames
-
vis
private java.lang.String vis
-
name
private java.lang.String name
-
idlName
private java.lang.String idlName
-
stringRep
private java.lang.String stringRep
-
attributeKind
private int attributeKind
-
attributeName
private java.lang.String attributeName
-
attributePairIndex
private int attributePairIndex
-
declaredBy
private Identifier declaredBy
-
-
Constructor Detail
-
Method
public Method(CompoundType enclosing, MemberDefinition memberDef, boolean quiet, ContextStack stack) throws java.lang.Exception
Create a new Method object corresponding to the given method definition.- Throws:
java.lang.Exception
-
-
Method Detail
-
isInherited
public boolean isInherited()
Is this method inherited?
-
isAttribute
public boolean isAttribute()
Is this method an attribute? Return true if getAttributeKind != ATTRIBUTE_NONE.
-
isReadWriteAttribute
public boolean isReadWriteAttribute()
Is this method a read-write attribute?
-
getAttributeKind
public int getAttributeKind()
Return the attribute kind.
-
getAttributeName
public java.lang.String getAttributeName()
Return the attribute name. Will be null if attribute kind == ATTRIBUTE_NONE.
-
getAttributePairIndex
public int getAttributePairIndex()
For kinds ATTRIBUTE_GET_RW or ATTRIBUTE_IS_RW, return the index of the matching ATTRIBUTE_SET method, and vice-versa. For all other cases, return -1.
-
getElementName
public java.lang.String getElementName()
Return context element name.- Specified by:
getElementName
in interfaceContextElement
-
equals
public boolean equals(java.lang.Object obj)
Equality check based on method signature.- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
mergeWith
public CompoundType.Method mergeWith(CompoundType.Method other)
Return a new Method object that is a legal combination of this method object and another one. This requires determining the exceptions declared by the combined method, which must be only those exceptions that may thrown by both of the old methods.
-
collectCompatibleExceptions
private void collectCompatibleExceptions(ValueType[] from, ValueType[] with, java.util.Vector<ValueType> list) throws ClassNotFound
Add to the supplied list all exceptions in the "from" array that are subclasses of an exception in the "with" array.- Throws:
ClassNotFound
-
getEnclosing
public CompoundType getEnclosing()
Return the compound type which contains this method.
-
getDeclaredBy
public Identifier getDeclaredBy()
Return the identifier for the class or interface which declares this method.
-
getVisibility
public java.lang.String getVisibility()
Return the visibility (e.g. "public final") of this member.
-
isPublic
public boolean isPublic()
Methods to check various attributes.
-
isProtected
public boolean isProtected()
-
isPrivate
public boolean isPrivate()
-
isStatic
public boolean isStatic()
-
getName
public java.lang.String getName()
Return the name of this method.
-
getIDLName
public java.lang.String getIDLName()
IDL_Naming Return the IDL name of this method.
-
getType
public Type getType()
Return the type of this method.
-
isConstructor
public boolean isConstructor()
Return true if this is a constructor.
-
isNormalMethod
public boolean isNormalMethod()
Return true if this is NOT a constructor&&
is not an attribute.
-
getReturnType
public Type getReturnType()
Get the return type of this method. May be null.
-
getArguments
public Type[] getArguments()
Return the argument types of this method.
-
getArgumentNames
public java.lang.String[] getArgumentNames()
Return the names of the argument types of this method.
-
getMemberDefinition
public MemberDefinition getMemberDefinition()
Return the MemberDefinition from which this method was created.
-
getExceptions
public ValueType[] getExceptions()
Return an array of the exception classes declared to be thrown by this remote method. For methods with the same name and type signature inherited from multiple remote interfaces, the array will contain the set of exceptions declared in all of the interfaces' methods that can be legally thrown in each of them.
-
getImplExceptions
public ValueType[] getImplExceptions()
Same as getExceptions(), except when method is in an ImplementationType and the exceptions list is narrower.
-
getUniqueCatchList
public ValueType[] getUniqueCatchList(ValueType[] list)
Return an array containing only those exceptions which need to be caught. Removes java.rmi.RemoteException, java.lang.RuntimeException, java.lang.Error, and their subclasses, then removes any exceptions which are more derived than another in the list. Returns null if no exceptions need to be caught.
-
getFilteredStubExceptions
public ValueType[] getFilteredStubExceptions(ValueType[] list)
Return an array containing only those exceptions which need to be handled explicitly by the stub. Removes java.lang.RuntimeException, java.lang.Error, and their subclasses, since these are all passed back as CORBA system exceptions. Also removes subclasses of java.rmi.RemoteException but not java.rmi.RemoteException itself, since this may need to be thrown by the stub.
-
toString
public java.lang.String toString()
Return the string representation of this method.- Overrides:
toString
in classjava.lang.Object
-
setAttributeKind
public void setAttributeKind(int kind)
Set attribute kind. May only be called during initialization.
-
setAttributePairIndex
public void setAttributePairIndex(int index)
Set pair index. May only be called during initialization.
-
setAttributeName
public void setAttributeName(java.lang.String name)
Set attribute name. May only be called during initialization.
-
setIDLName
public void setIDLName(java.lang.String idlName)
Set the idl name. May only be called during initialization.
-
setImplExceptions
public void setImplExceptions(ValueType[] exceptions)
Set the implExceptions array. May only be called during initialization.
-
setDeclaredBy
public void setDeclaredBy(Identifier by)
Set the declaredBy Identifier. May only be called during initialization.
-
swapInvalidTypes
protected void swapInvalidTypes()
Convert all invalid types to valid ones.
-
destroy
public void destroy()
Release all resources.
-
makeArgName
private java.lang.String makeArgName(int argNum, Type type)
Make up an argument name for the given type.
-
clone
protected java.lang.Object clone()
Cloning is supported by returning a shallow copy of this object.- Overrides:
clone
in classjava.lang.Object
-
-