1 /* 2 * Copyright the original author or authors. 3 * 4 * Licensed under the MOZILLA PUBLIC LICENSE, Version 1.1 (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.mozilla.org/MPL/MPL-1.1.html 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 17 import org.as2lib.core.BasicClass; 18 import org.as2lib.util.Stringifier; 19 import org.as2lib.env.reflect.ReflectUtil; 20 21 /** 22 * {@code ObjectStringifier} is the most basic stringifier form. 23 * 24 * <p>It stringifies all kinds of objects, this means classes, instances and 25 * primitives. 26 * 27 * @author Simon Wacker 28 */ 29 class org.as2lib.core.ObjectStringifier extends BasicClass implements Stringifier { 30 31 /** 32 * Returns the string representation of the passed-in {@code target} object. 33 * 34 * <p>The string representation is composed as follows: 35 * <pre> 36 * [type theFullQualifiedNameOfTheObjectsType] 37 * </pre> 38 * 39 * <p>The string representation of the class {@code org.as2lib.core.BasicClass} or 40 * instances of it looks like this: 41 * <pre> 42 * [type org.as2lib.core.BasicClass] 43 * </pre> 44 * 45 * @param target the target object to stringify 46 * @return the string representation of the passed-in {@code target} object 47 */ 48 public function execute(target):String { 49 return "[type " + ReflectUtil.getTypeName(target) + "]"; 50 } 51 52 }