Re: how to set a state



On 15 Maj, 14:47, Lew <l...@xxxxxxxxxxxxx> wrote:
mike wrote:
Hi,

I am using a class called session that contains a has an internal
state object. However I can only do get on the state.
This is the code I need to test but since I cannot set the sate since
Session is an external interface with an innner class called State. Is
there a way around this for me?

cheers,

//mikael

switch (session.getState()) {

case TERMINATED:
//Do something
break;

case EARLY:
//do something
break;

case CONFIRMED:
//do something
break;

case INITIAL:
//do something
break;

}
}

In the first place, what is the point of this code fragment? You don't
provide the code for Session, you don't provide the code for State, and you
don't provide the code for State's enclosing class.

I am using a SIP API that I am not responsible for.


What are we supposed to
do, read your mind? Instead you provide a snippet that tells us nothing
relevant to your question. We can't even tell from this or your other post on
this code whether getState() returns an enum or an int. Come on, dude.
<http://sscce.org/>

getState returns the following:

/ Method descriptor #21 ()Ljavax/servlet/sip/SipSession$State;
public abstract javax.servlet.sip.SipSession.State getState();

As to your question, if Session is an "external" (what does that mean?)
interface, then it cannot have any inner classes.

<http://java.sun.com/docs/books/jls/third_edition/html/interfaces.html...>

Interfaces may contain member type declarations (§8.5).
A member type declaration in an interface is implicitly static and public.

<http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.5.2>

The static keyword may modify the declaration of a member type C
within the body of a non-inner class T.
Its effect is to declare that C is not an inner class.

<http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.1.3>

An inner class is a nested class that is not
explicitly or implicitly declared static.

Next, what *does* set the State? It's got to come from somewhere. Where? How?

Answer our questions that we may answer yours.
<http://sscce.org/>

--
Lew

.



Relevant Pages

  • Re: how to set a state
    ... Session is an external interface with an innner class called State. ... As to your question, if Session is an "external" interface, then it cannot have any inner classes. ... A member type declaration in an interface is implicitly static and public. ...
    (comp.lang.java.help)
  • Re: implementing roles in OOP......
    ... > relationship instantiation from relationship navigation. ... > It's not an interface issue; ... > The Client provides the Visitor reference when it invokes ... autognerate the declaration for me. ...
    (comp.object)
  • Re: HOWTO set up minimal sink object in console COM client?
    ... Here is my MyObject declaration: ... my console based COM object client should be able to response to ... > object for a COM interface. ... does it mean sink object is always COM object? ...
    (microsoft.public.vc.atl)
  • Re: International Spectrum 2008 Sessions for Distribution
    ... More and more businesses need to interface with FedEx and UPS to ... look at existing systems and business processes before deployment. ... Join this session to learn about the hurdles and opportunities of ... Designing ERP Applications ...
    (comp.databases.pick)
  • Re: Why do we have to manually separate interface and implementation?
    ... once in the class declaration and again in the ... In what way is a "proper module system" lacking? ... Keeping the interface separate from the implementation allows you to ... C++ header files are ...
    (comp.lang.cpp)