com.github.andyshao.io.MessageFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Gear Show documentation
Show all versions of Gear Show documentation
Enhance and formating the coding of JDK
The newest version!
package com.github.andyshao.io;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
/**
*
* Title:
* Descript:
* Copyright: Copryright(c) Nov 4, 2015
* Encoding:UNIX UTF-8
*
* @author Andy.Shao
*
*/
public interface MessageFactory {
/**
* build {@link MessageContext}
*
* @return {@link MessageContext}
*/
public default MessageContext buildMessageContext() {
MessageContext context = new MessageContext() {
private final ConcurrentMap map = new ConcurrentHashMap<>();
@Override
public void clear() {
this.map.clear();
}
@Override
public boolean containsKey(Object key) {
return this.map.containsKey(key);
}
@Override
public boolean containsValue(Object value) {
return this.map.containsValue(value);
}
@Override
public Set> entrySet() {
return this.map.entrySet();
}
@Override
public Object get(Object key) {
return this.map.get(key);
}
@Override
public boolean isEmpty() {
return this.map.isEmpty();
}
@Override
public Set keySet() {
return this.map.keySet();
}
@Override
public Object put(String key , Object value) {
return this.map.put(key , value);
}
@Override
public void putAll(Map extends String , ? extends Object> m) {
this.map.putAll(m);
}
@Override
public Object putIfAbsent(String key , Object value) {
return this.map.putIfAbsent(key , value);
}
@Override
public Object remove(Object key) {
return this.map.remove(key);
}
@Override
public boolean remove(Object key , Object value) {
return this.map.remove(key , value);
}
@Override
public Object replace(String key , Object value) {
return this.map.replace(key , value);
}
@Override
public boolean replace(String key , Object oldValue , Object newValue) {
return this.map.replace(key , oldValue , newValue);
}
@Override
public int size() {
return this.map.size();
}
@Override
public Collection
© 2015 - 2025 Weber Informatics LLC | Privacy Policy