net.sf.ipsedixit.core.FieldHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ipsedixit Show documentation
Show all versions of ipsedixit Show documentation
Ipsedixit is a lightweight provider of arbitrary data, mocks and dummies for your Java testing pleasure. It is designed to reduce the amount
of boilerplate setup code in your tests, allowing you to spend more time solving more interesting problems. Check out the wiki for the latest
docco and examples.
The newest version!
/*
* Copyright 2008 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.sf.ipsedixit.core;
/**
* A FieldHandler
is able to create values for it's supported field type. Ipsedixit contains a set of
* FieldHandler
's for most standard Java types - see the list of implementing classes.
*/
public interface FieldHandler {
/**
* Create a value for the supported type. The value must be equal to, or be a subclass/implementation of
* the supported type. Implementations may use metadata from the
* {@link net.sf.ipsedixit.core.MutableField}
to help in creating values.
*
* @param mutableField a representation of the Field that should be created.
* @return an instance of mutableField.getType(), or an implementation/subclass of it.
*/
Object getValueFor(MutableField mutableField);
/**
* Can (or should) this FieldHandler
create instances of the type identified by the
* {@link net.sf.ipsedixit.core.MutableField}
.
*
* @param mutableField the MutableField
to test.
* @return true if and only if both conditions are true: this FieldHandler
can create instances of
* {@link net.sf.ipsedixit.core.MutableField#getType()}
, and should also handle this
* field based on extra metadata in the MutableField
.
*/
boolean supports(MutableField mutableField);
}