|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| AppletParameter | Line # 33 | 3 | 0% | 2 | 0 | 100% |
1.0
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
| AppletParameter.AppletParameterBuilder | Line # 57 | 2 | 0% | 2 | 0 | 100% |
1.0
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
| No Tests | |||
| 1 | /* | |
| 2 | * Created on Jul 14, 2008 | |
| 3 | * | |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | |
| 5 | * the License. You may obtain a copy of the License at | |
| 6 | * | |
| 7 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 8 | * | |
| 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | |
| 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | |
| 11 | * specific language governing permissions and limitations under the License. | |
| 12 | * | |
| 13 | * Copyright @2008-2010 the original author or authors. | |
| 14 | */ | |
| 15 | package org.fest.swing.launcher; | |
| 16 | ||
| 17 | /** | |
| 18 | * Understands a fluent interface for creation of applet parameters. | |
| 19 | * <p> | |
| 20 | * For example, the following code listing: | |
| 21 | * | |
| 22 | * <pre> | |
| 23 | * // import static org.fest.swing.launcher.AppletParameter.name; | |
| 24 | * | |
| 25 | * AppletParameter = {@link #name(String) name}("bgcolor").{@link AppletParameterBuilder#value(String) value}("blue"); | |
| 26 | * </pre> | |
| 27 | * | |
| 28 | * will create an applet parameter with name "bgcolor" and value "blue." | |
| 29 | * </p> | |
| 30 | * | |
| 31 | * @author Yvonne Wang | |
| 32 | */ | |
| 33 | public class AppletParameter { | |
| 34 | ||
| 35 | public final String name; | |
| 36 | public final String value; | |
| 37 | ||
| 38 | 4 |
AppletParameter(String name, String value) { |
| 39 | 4 | this.name = name; |
| 40 | 4 | this.value = value; |
| 41 | } | |
| 42 | ||
| 43 | /** | |
| 44 | * Starting point of the fluent interface for creation of <code>{@link AppletParameter}</code>s. | |
| 45 | * @param name the name of the applet parameter. | |
| 46 | * @return a builder of <code>AppletParameter</code>s. | |
| 47 | */ | |
| 48 | 4 |
public static AppletParameterBuilder name(String name) { |
| 49 | 4 | return new AppletParameterBuilder(name); |
| 50 | } | |
| 51 | ||
| 52 | /** | |
| 53 | * Understands creation of <code>{@link AppletParameter}</code>s. | |
| 54 | * | |
| 55 | * @author Yvonne Wang | |
| 56 | */ | |
| 57 | public static class AppletParameterBuilder { | |
| 58 | ||
| 59 | private final String name; | |
| 60 | ||
| 61 | 4 |
AppletParameterBuilder(String name) { |
| 62 | 4 | this.name = name; |
| 63 | } | |
| 64 | ||
| 65 | /** | |
| 66 | * Creates a new <code>{@link AppletParameter}</code> with the given name and value. | |
| 67 | * @param value the value for the <code>AppletParameter</code>. | |
| 68 | * @return the created <code>AppletParameter</code>. | |
| 69 | */ | |
| 70 | 4 |
public AppletParameter value(String value) { |
| 71 | 4 | return new AppletParameter(name, value); |
| 72 | } | |
| 73 | } | |
| 74 | } | |
|
||||||||||||