org.fest.swing.format
Class IntrospectionComponentFormatter

java.lang.Object
  extended by org.fest.swing.format.ComponentFormatterTemplate
      extended by org.fest.swing.format.IntrospectionComponentFormatter
All Implemented Interfaces:
ComponentFormatter

public final class IntrospectionComponentFormatter
extends ComponentFormatterTemplate

Understands a formatter that uses introspection to display property values of a Component. This formatter does not support nested properties.

Author:
Alex Ruiz

Constructor Summary
IntrospectionComponentFormatter(Class<? extends Component> targetType, String... propertyNames)
          Creates a new IntrospectionComponentFormatter.
 
Method Summary
protected  String doFormat(Component c)
          Returns a String representation of the given Component, showing only the properties specified in this formatter's constructor.
 Class<? extends Component> targetType()
          Returns the type of Component this formatter supports.
 String toString()
           
 
Methods inherited from class org.fest.swing.format.ComponentFormatterTemplate
format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntrospectionComponentFormatter

public IntrospectionComponentFormatter(Class<? extends Component> targetType,
                                       String... propertyNames)
Creates a new IntrospectionComponentFormatter.

Parameters:
targetType - the type of Component that this formatter supports.
propertyNames - the property names to show as the String representation of a given Component.
Throws:
NullPointerException - if targetType is null.
Method Detail

doFormat

protected String doFormat(Component c)
Returns a String representation of the given Component, showing only the properties specified in this formatter's constructor.

Specified by:
doFormat in class ComponentFormatterTemplate
Parameters:
c - the given Component.
Returns:
a String representation of the given Component.
Throws:
NullPointerException - if the given Component is null.
IllegalArgumentException - if the type of the given Component is not supported by this formatter.
See Also:
targetType()

targetType

public Class<? extends Component> targetType()
Returns the type of Component this formatter supports.

Returns:
the type of Component this formatter supports.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2007-2011 FEST (Fixtures for Easy Software Testing). All Rights Reserved.