Package com.opencloud.sentinel.util
Class SubscribedEventID
- java.lang.Object
-
- com.opencloud.sentinel.util.SubscribedEventID
-
public final class SubscribedEventID extends java.lang.Object
A value object representing a subscribed SIP event and optional ID parameter. UseSIPUtil.getSubscribedEventID(org.jainslee.resources.sip.SipMessage)
to obtainSubscribedEventID
values from SIP SUBSCRIBE, NOTIFY or REFER messages.
-
-
Constructor Summary
Constructors Constructor Description SubscribedEventID(java.io.DataInput in)
Constructs a new SubscribedEventID object by deserializing data from a stream that was written bytoStream(java.io.DataOutput)
.SubscribedEventID(java.lang.String name, java.lang.String id)
Create a newSubscribedEventID
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
static SubscribedEventID
fromString(java.lang.String s)
Get aSubscribedEventID
from a string.java.lang.String
getID()
Returns the Subscribed event ID.java.lang.String
getName()
Returns Subscribed event name.java.lang.String
getTemplatePackageName()
Return the name of this event's template-package, if any.int
hashCode()
boolean
isRefer()
Returns true if the event is a refer.boolean
isUnqualifiedRefer()
Returns true if the event is an unqualified refer.void
toStream(java.io.DataOutput out)
Serializes this object to a stream in a form suitable for reading bySubscribedEventID(java.io.DataInput)
.java.lang.String
toString()
-
-
-
Constructor Detail
-
SubscribedEventID
public SubscribedEventID(java.lang.String name, @Nullable java.lang.String id)
Create a newSubscribedEventID
- Parameters:
name
- the event nameid
- an ID string, may benull
-
SubscribedEventID
public SubscribedEventID(java.io.DataInput in) throws java.io.IOException
Constructs a new SubscribedEventID object by deserializing data from a stream that was written bytoStream(java.io.DataOutput)
.- Parameters:
in
- input stream.- Throws:
java.io.IOException
-
-
Method Detail
-
fromString
public static SubscribedEventID fromString(java.lang.String s)
Get aSubscribedEventID
from a string.- Parameters:
s
- a string in the form<event-name>[;id=<id>]
- Returns:
- a new
SubscribedEventID
instance
-
toStream
public void toStream(java.io.DataOutput out) throws java.io.IOException
Serializes this object to a stream in a form suitable for reading bySubscribedEventID(java.io.DataInput)
.- Parameters:
out
- the stream to write to- Throws:
java.io.IOException
- if an I/O error occurs
-
getName
public java.lang.String getName()
Returns Subscribed event name.- Returns:
- the event name.
-
getID
@Nullable public java.lang.String getID()
Returns the Subscribed event ID.- Returns:
- an ID string, may be
null
-
getTemplatePackageName
public java.lang.String getTemplatePackageName()
Return the name of this event's template-package, if any. For example, the event "dialog.winfo" has the template-package "winfo".- Returns:
- the template-package name, which is the string after the last "." character in the event name, or null if this event is not from a template-package.
- See Also:
- RFC 6665 §5.2.
-
isRefer
public boolean isRefer()
Returns true if the event is a refer.- Returns:
- true if the event name equals "refer", otherwise returns false.
-
isUnqualifiedRefer
public boolean isUnqualifiedRefer()
Returns true if the event is an unqualified refer.- Returns:
- true true if the event name equals "refer" and the ID is null, otherwise returns false.
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-