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.PropertyInfo;
    20  
    21  /**
    22   * {@code PropertyInfoStringifier} stringifies {@link PropertyInfo} instances.
    23   *
    24   * @author Simon Wacker
    25   */
    26  class org.as2lib.env.reflect.stringifier.PropertyInfoStringifier extends BasicClass implements Stringifier {
    27  	
    28  	/**
    29  	 * Returns the string representation of the passed-in {@link PropertyInfo} instance.
    30  	 * 
    31  	 * <p>The string representation is composed as follows:
    32  	 * <pre>
    33  	 *   fullQualifiedDeclaringTypeName.propertyName
    34  	 * </pre>
    35  	 *
    36  	 * <p>Or if static:
    37  	 * <pre>
    38  	 *   static fullQualifiedDeclaringTypeName.propertyName
    39  	 * </pre>
    40  	 *
    41  	 * @param target an instance of type {@link PropertyInfo} to stringify
    42  	 * @return the string representation of the passed-in {@code target} property info
    43  	 */
    44  	public function execute(target):String {
    45  		var property:PropertyInfo = PropertyInfo(target);
    46  		var result:String = "";
    47  		if (property.isStatic()) {
    48  			result += "static ";
    49  		}
    50  		result += property.getDeclaringType().getFullName();
    51  		result += "." + property.getName();
    52  		return result;
    53  	}
    54  	
    55  }