| 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 | public class MessageSpecImpl implements MessageSpec { |
|---|
| 19 | private String name; |
|---|
| 20 | private String description; |
|---|
| 21 | private MessageSpecVersionRange range; |
|---|
| 22 | |
|---|
| 23 | public MessageSpecImpl(String name, MessageSpecVersion version) { |
|---|
| 24 | this(name, null, version); |
|---|
| 25 | } |
|---|
| 26 | |
|---|
| 27 | public MessageSpecImpl(String name, int majorVersion, int minorVersion) { |
|---|
| 28 | this(name, new MessageSpecVersionImpl(majorVersion, minorVersion)); |
|---|
| 29 | } |
|---|
| 30 | |
|---|
| 31 | public MessageSpecImpl(String name, String description, MessageSpecVersion version) { |
|---|
| 32 | this(name, description, new MessageSpecVersionRangeImpl(version, version)); |
|---|
| 33 | } |
|---|
| 34 | |
|---|
| 35 | public MessageSpecImpl(String name, String description, MessageSpecVersionRange range) { |
|---|
| 36 | this.name = name; |
|---|
| 37 | this.description = description; |
|---|
| 38 | this.range = range; |
|---|
| 39 | } |
|---|
| 40 | |
|---|
| 41 | @Override |
|---|
| 42 | public String getName() { |
|---|
| 43 | return name; |
|---|
| 44 | } |
|---|
| 45 | |
|---|
| 46 | @Override |
|---|
| 47 | public String getDescription() { |
|---|
| 48 | return description; |
|---|
| 49 | } |
|---|
| 50 | |
|---|
| 51 | @Override |
|---|
| 52 | public MessageSpecVersionRange getVersionRange() { |
|---|
| 53 | return range; |
|---|
| 54 | } |
|---|
| 55 | |
|---|
| 56 | @Override |
|---|
| 57 | public MessageSpecVersion getLatestVersion() { |
|---|
| 58 | return range.getUpperBound(); |
|---|
| 59 | } |
|---|
| 60 | } |
|---|