| 1 | /* |
|---|
| 2 | * Copyright 2009 NCHOVY |
|---|
| 3 | * |
|---|
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
|---|
| 5 | * you may not use this file except in compliance with the License. |
|---|
| 6 | * You may obtain a copy of the License at |
|---|
| 7 | * |
|---|
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
|---|
| 9 | * |
|---|
| 10 | * Unless required by applicable law or agreed to in writing, software |
|---|
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
|---|
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|---|
| 13 | * See the License for the specific language governing permissions and |
|---|
| 14 | * limitations under the License. |
|---|
| 15 | */ |
|---|
| 16 | package org.krakenapps.filter; |
|---|
| 17 | |
|---|
| 18 | import java.util.Set; |
|---|
| 19 | |
|---|
| 20 | /** |
|---|
| 21 | * Represents the communication unit of filter. Composed of header and |
|---|
| 22 | * properties. Message is immutable. |
|---|
| 23 | * |
|---|
| 24 | * @author xeraph |
|---|
| 25 | * @since 1.0.0 |
|---|
| 26 | */ |
|---|
| 27 | public interface Message { |
|---|
| 28 | /** |
|---|
| 29 | * Returns the message specification. |
|---|
| 30 | */ |
|---|
| 31 | public MessageSpec getMessageSpec(); |
|---|
| 32 | |
|---|
| 33 | /** |
|---|
| 34 | * Returns a Set of property keys. |
|---|
| 35 | */ |
|---|
| 36 | public Set<String> keySet(); |
|---|
| 37 | |
|---|
| 38 | /** |
|---|
| 39 | * Checks if specific key is contained. |
|---|
| 40 | * |
|---|
| 41 | * @param key |
|---|
| 42 | * the name of property |
|---|
| 43 | * @return true if key exists. |
|---|
| 44 | */ |
|---|
| 45 | public boolean containsKey(String key); |
|---|
| 46 | |
|---|
| 47 | /** |
|---|
| 48 | * Returns the value of the property |
|---|
| 49 | * |
|---|
| 50 | * @param key |
|---|
| 51 | * the name of property |
|---|
| 52 | * @returns the value of the property. null if not exists. |
|---|
| 53 | */ |
|---|
| 54 | public Object get(String key); |
|---|
| 55 | |
|---|
| 56 | /** |
|---|
| 57 | * Returns a Set of header keys. |
|---|
| 58 | */ |
|---|
| 59 | public Set<String> headerKeySet(); |
|---|
| 60 | |
|---|
| 61 | /** |
|---|
| 62 | * Checks if specific header is contained. |
|---|
| 63 | * |
|---|
| 64 | * @param key |
|---|
| 65 | * the name of header |
|---|
| 66 | * @return true if header key exists |
|---|
| 67 | */ |
|---|
| 68 | public boolean containsHeader(String key); |
|---|
| 69 | |
|---|
| 70 | /** |
|---|
| 71 | * Returns the value of the header. |
|---|
| 72 | * |
|---|
| 73 | * @param key |
|---|
| 74 | * the name of header |
|---|
| 75 | * @return the value of the header. null if not exists. |
|---|
| 76 | */ |
|---|
| 77 | public Object getHeader(String key); |
|---|
| 78 | } |
|---|