org.assertj.swing.format
Class IntrospectionComponentFormatter
java.lang.Object
org.assertj.swing.format.ComponentFormatterTemplate
org.assertj.swing.format.IntrospectionComponentFormatter
- All Implemented Interfaces:
- ComponentFormatter
public final class IntrospectionComponentFormatter
- extends ComponentFormatterTemplate
Formatter that uses introspection to display property values of an AWT or Swing Component
. This formatter
does not support nested properties.
- Author:
- Alex Ruiz
IntrospectionComponentFormatter
public IntrospectionComponentFormatter(@Nonnull
Class<? extends Component> targetType,
@Nonnull
String... propertyNames)
- Creates a new
IntrospectionComponentFormatter
.
- Parameters:
targetType
- the type of AWT or Swing 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
.
doFormat
@RunsInCurrentThread
@Nonnull
protected String doFormat(@Nonnull
Component c)
- Returns a
String
representation of the given AWT or Swing 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
@Nonnull
public Class<? extends Component> targetType()
- Description copied from interface:
ComponentFormatter
- Returns the type of AWT or Swing
Component
this formatter supports.
- Returns:
- the type of AWT or Swing
Component
this formatter supports.
toString
public String toString()
- Overrides:
toString
in class Object
Copyright © 2014–2015 AssertJ. All rights reserved.