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