Interface SOAPInstanceBuilder
-
- All Known Implementing Classes:
GenericLiteralObjectSerializer.SOAPGenericObjectInstanceBuilder,GenericObjectSerializer.SOAPGenericObjectInstanceBuilder,LiteralRequestSerializer.ParameterArrayBuilder,LiteralResponseSerializer.SOAPResponseStructureBuilder,SOAPRequestSerializer.ParameterArrayBuilder,SOAPResponseSerializer.SOAPResponseStructureBuilder,StructMapSerializer.StructMapBuilder
public interface SOAPInstanceBuilder- Author:
- JAX-RPC Development Team
-
-
Field Summary
Fields Modifier and Type Field Description static intGATES_CONSTRUCTIONstatic intGATES_INITIALIZATIONstatic intREQUIRES_COMPLETIONstatic intREQUIRES_CREATIONstatic intREQUIRES_INITIALIZATION
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidconstruct()Create a new instance optionally using cached values as constructor parameters:ObjectgetInstance()Return the instance that is being built.voidinitialize()If there is no default constructor then the constructor arguments will have to be cached until they all arrive.intmemberGateType(int memberIndex)Return the activity that is gated by a member along with the state that member has to be in in order to allow the activity to proceed.voidsetInstance(Object instance)Use this method to cache an instance of the object.voidsetMember(int index, Object memberValue)Initialize the value of a member of the object or cache the value for later use during construction:
-
-
-
Field Detail
-
GATES_CONSTRUCTION
static final int GATES_CONSTRUCTION
- See Also:
- Constant Field Values
-
GATES_INITIALIZATION
static final int GATES_INITIALIZATION
- See Also:
- Constant Field Values
-
REQUIRES_CREATION
static final int REQUIRES_CREATION
- See Also:
- Constant Field Values
-
REQUIRES_INITIALIZATION
static final int REQUIRES_INITIALIZATION
- See Also:
- Constant Field Values
-
REQUIRES_COMPLETION
static final int REQUIRES_COMPLETION
- See Also:
- Constant Field Values
-
-
Method Detail
-
memberGateType
int memberGateType(int memberIndex)
Return the activity that is gated by a member along with the state that member has to be in in order to allow the activity to proceed. A member eitherGATES_CONSTRUCTIONor itGATES_INITIALIZATION. A member that needs to be created in order to allow its parent object to be created or initializedREQUIRES_CREATIONif it needs to be fully initialized in order to be used in the activity that it gates then itREQUIRES_INITIALIZATION. If it needs all of its own members to be initialized all the way down to the leaf members (members without sub-members), then itREQUIRES_COMPLETION. Note that in an object graph that contains loops none of the nodes on a looping branch will ever be considered to be in the "complete" state.Here is a sample implementation:
public int memberGateType(int memberIndex) { switch (memberIndex) { case CONSTRUCTOR_PARAM1: return GATES_CONSTRUCTION + REQUIRES_INITIALIZATION; case CONSTRUCTOR_PARAM2: return GATES_CONSTRUCTION + REQUIRES_CREATION; case CONSTRUCTOR_PARAM3: return GATES_CONSTRUCTION + REQUIRES_COMPLETION; case USED_IN_SETTER1: return GATES_INITIALIZATION + REQUIRES_COMPLETION; case USED_IN_SETTER2: return GATES_INITIALIZATION + REQUIRES_INITIALIZATION; case USED_IN_SETTER3: return GATES_INITIALIZATION + REQUIRES_CREATION; default : return GATES_INITIALIZATION + REQUIRES_CREATION; } }
-
construct
void construct()
Create a new instance optionally using cached values as constructor parameters:public void construct() { instance = new myType(); OR instance = new myType(args.param1, args.param2, args.param3, args.param4 ...); }
-
setMember
void setMember(int index, Object memberValue)Initialize the value of a member of the object or cache the value for later use during construction:public void setMember(int index, Object memberValue) { switch (index) { case INT_MEMBER1: // Set a public data member instance.intMember1 = ((Integer) memberValue).intValue(); // Or use a setter instance.setIntMember1(((Integer) memberValue).intValue()); // Or if there is no default constructor you save them up // for construction or initialization this.intMember1 = ((Integer) memberValue).intValue(); break; case OBJECT_MEMBER1: instance.setObjectMember1((myObjectType) memberValue); break; } }-
initialize
void initialize()
If there is no default constructor then the constructor arguments will have to be cached until they all arrive. In that case all of the other members of the object will have to be cached as well since they may arrive before the object is constructed. This method is called after the object is constructed and values for all members have arrived. If you have cached values insetmembernow is the time to use them to initialize members.public void initialize() { instance.setIntMember1(members.intMember1); instance.setObjectMember1(members.objectMember1); etc... }-
setInstance
void setInstance(Object instance)
Use this method to cache an instance of the object.
-
getInstance
Object getInstance()
Return the instance that is being built.
-
-
-
-