Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
Greeter |
|
| 1.5;1.5 |
1 | /* | |
2 | * $Id: Greeter.java 19191 2010-08-25 21:05:23Z tcarlson $ | |
3 | * -------------------------------------------------------------------------------------- | |
4 | * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com | |
5 | * | |
6 | * The software in this package is published under the terms of the CPAL v1.0 | |
7 | * license, a copy of which has been included with this distribution in the | |
8 | * LICENSE.txt file. | |
9 | */ | |
10 | ||
11 | package org.mule.example.hello; | |
12 | ||
13 | /** | |
14 | * <code>Greeter</code> expects a valid <code>NameString</code> object. If invalid, | |
15 | * an exception is created and returned. The outbound router will filter exceptions | |
16 | * as user errors and return the messages to the original requester accordingly. | |
17 | */ | |
18 | public class Greeter | |
19 | { | |
20 | 0 | private String greeting = ""; |
21 | ||
22 | public Greeter() | |
23 | 0 | { |
24 | 0 | greeting = LocaleMessage.getGreetingPart1(); |
25 | 0 | } |
26 | ||
27 | public Object greet(NameString person) | |
28 | { | |
29 | 0 | Object payload = person; |
30 | 0 | if (person.isValid()) |
31 | { | |
32 | 0 | person.setGreeting(greeting); |
33 | } | |
34 | else | |
35 | { | |
36 | 0 | payload = new Exception(LocaleMessage.getInvalidUserNameError()); |
37 | } | |
38 | 0 | return payload; |
39 | } | |
40 | } |