Class FieldTypeMatcherStrategy
- java.lang.Object
-
- org.powermock.reflect.internal.matcherstrategies.FieldMatcherStrategy
-
- org.powermock.reflect.internal.matcherstrategies.FieldTypeMatcherStrategy
-
- Direct Known Subclasses:
AssignableFromFieldTypeMatcherStrategy
,AssignableToFieldTypeMatcherStrategy
public class FieldTypeMatcherStrategy extends FieldMatcherStrategy
-
-
Constructor Summary
Constructors Constructor Description FieldTypeMatcherStrategy(Class<?> fieldType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
matches(Field field)
A field matcher that checks if a field matches a given criteria.void
notFound(Class<?> type, boolean isInstanceField)
Throws anFieldNotFoundException
if the strategy criteria could not be found.String
toString()
-
-
-
Constructor Detail
-
FieldTypeMatcherStrategy
public FieldTypeMatcherStrategy(Class<?> fieldType)
-
-
Method Detail
-
matches
public boolean matches(Field field)
Description copied from class:FieldMatcherStrategy
A field matcher that checks if a field matches a given criteria.- Specified by:
matches
in classFieldMatcherStrategy
- Parameters:
field
- The field to check whether it matches the strategy or not.- Returns:
true
if this field matches the strategy,false
otherwise.
-
notFound
public void notFound(Class<?> type, boolean isInstanceField) throws FieldNotFoundException
Description copied from class:FieldMatcherStrategy
Throws anFieldNotFoundException
if the strategy criteria could not be found.- Specified by:
notFound
in classFieldMatcherStrategy
- Parameters:
type
- The type of the object that was not found.isInstanceField
-true
if the field that was looked after was an instance field orfalse
if it was a static field.- Throws:
FieldNotFoundException
-
-