📝 docs: add the annotation

This commit is contained in:
yadong.zhang 2021-09-15 11:12:46 +08:00
parent 092dc3f736
commit cd03979978
2 changed files with 70 additions and 21 deletions

View File

@ -32,46 +32,66 @@ public class JakartaSessionAdapter implements JapHttpSession {
this.session = session;
}
/**
* Returns the time when this session was created, measured in milliseconds since midnight January 1, 1970 GMT.
*
* @return a <code>long</code> specifying when this session was created, expressed in milliseconds since 1/1/1970
* GMT
*/
@Override
public long getCreationTime() {
return this.session.getCreationTime();
}
/**
* Returns a string containing the unique identifier assigned to this session. The identifier is assigned by the
* servlet container and is implementation dependent.
*
* @return a string specifying the identifier assigned to this session
*/
@Override
public String getId() {
return this.session.getId();
}
/**
* Returns the object bound with the specified name in this session, or <code>null</code> if no object is bound
* under the name.
*
* @param name a string specifying the name of the object
* @return the object with the specified name
*/
@Override
public Object getAttribute(String name) {
return this.session.getAttribute(name);
}
@Override
public Object getValue(String name) {
return this.getAttribute(name);
}
/**
* Binds an object to this session, using the name specified. If an object of the same name is already bound to the
* session, the object is replaced.
*
* @param name the name to which the object is bound; cannot be null
* @param value the object to be bound; cannot be null
*/
@Override
public void setAttribute(String name, Object value) {
this.session.setAttribute(name, value);
}
@Override
public void putValue(String name, Object value) {
this.setAttribute(name, value);
}
/**
* Removes the object bound with the specified name from this session. If the session does not have an object bound
* with the specified name, this method does nothing.
*
* @param name the name of the object to remove from this session
*/
@Override
public void removeAttribute(String name) {
this.session.removeAttribute(name);
}
@Override
public void removeValue(String name) {
this.removeAttribute(name);
}
/**
* Invalidates this session then unbinds any objects bound to it.
*/
@Override
public void invalidate() {
this.session.invalidate();

View File

@ -25,21 +25,50 @@ package com.fujieid.jap.http;
*/
public interface JapHttpSession {
/**
* Returns the time when this session was created, measured in milliseconds since midnight January 1, 1970 GMT.
*
* @return a <code>long</code> specifying when this session was created, expressed in milliseconds since 1/1/1970
* GMT
*/
long getCreationTime();
/**
* Returns a string containing the unique identifier assigned to this session. The identifier is assigned by the
* servlet container and is implementation dependent.
*
* @return a string specifying the identifier assigned to this session
*/
String getId();
/**
* Returns the object bound with the specified name in this session, or <code>null</code> if no object is bound
* under the name.
*
* @param name a string specifying the name of the object
* @return the object with the specified name
*/
Object getAttribute(String name);
Object getValue(String name);
/**
* Binds an object to this session, using the name specified. If an object of the same name is already bound to the
* session, the object is replaced.
*
* @param name the name to which the object is bound; cannot be null
* @param value the object to be bound; cannot be null
*/
void setAttribute(String name, Object value);
void putValue(String name, Object value);
/**
* Removes the object bound with the specified name from this session. If the session does not have an object bound
* with the specified name, this method does nothing.
*
* @param name the name of the object to remove from this session
*/
void removeAttribute(String name);
void removeValue(String name);
/**
* Invalidates this session then unbinds any objects bound to it.
*/
void invalidate();
}