1 /* 2 * Copyright 2011-2013 smartics, Kronseder & Reiner GmbH 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 de.smartics.util.source; 17 18 import java.io.Serializable; 19 20 import de.smartics.util.lang.Arg; 21 22 /** 23 * The default implementation is a POJO that allows to set the properties of a 24 * method info. 25 */ 26 public final class DefaultMethodInfo implements Serializable, MethodInfo 27 { 28 // ********************************* Fields ********************************* 29 30 // --- constants ------------------------------------------------------------ 31 32 /** 33 * The class version identifier. 34 */ 35 private static final long serialVersionUID = 1L; 36 37 // --- members -------------------------------------------------------------- 38 39 /** 40 * The signature of the test method. This includes the test name and the 41 * parameter types list (with brackets). 42 */ 43 private final String methodSignature; 44 45 /** 46 * The location of the test. This is the location of the test method. 47 */ 48 private final SourceCodeLocation location; 49 50 // ****************************** Initializer ******************************* 51 52 // ****************************** Constructors ****************************** 53 54 /** 55 * Default constructor. 56 * 57 * @param methodSignature the signature of the test method. 58 * @param location the location of the test. 59 * @throws IllegalArgumentException if {@code methodSignature} is blank. 60 * @throws NullPointerException if {@code location} is <code>null</code>. 61 */ 62 public DefaultMethodInfo(final String methodSignature, 63 final SourceCodeLocation location) throws IllegalArgumentException, 64 NullPointerException 65 { 66 Arg.checkNotBlank("methodSignature", methodSignature); 67 Arg.checkNotNull("location", location); 68 this.methodSignature = methodSignature; 69 this.location = location; 70 } 71 72 // ****************************** Inner Classes ***************************** 73 74 // ********************************* Methods ******************************** 75 76 // --- init ----------------------------------------------------------------- 77 78 // --- get&set -------------------------------------------------------------- 79 80 // --- business ------------------------------------------------------------- 81 82 /** 83 * Returns the signature of the test method. This includes the test name and 84 * the parameter types list (with brackets). 85 * 86 * @return the signature of the test method. Never <code>null</code>. 87 */ 88 @Override 89 public String getMethodSignature() 90 { 91 return methodSignature; 92 } 93 94 /** 95 * Returns the location of the test. This is the location of the test method. 96 * 97 * @return the location of the test. Never <code>null</code>. 98 */ 99 @Override 100 public SourceCodeLocation getLocation() 101 { 102 return location; 103 } 104 105 // --- object basics -------------------------------------------------------- 106 107 }