001    /**
002     * Copyright 2005-2014 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.rice.krms.framework.engine.expression;
017    
018    /**
019     * Interface to extend to implement custom coerce of {@link String}s to an instance of the given type, when when validating
020     * {@link org.kuali.rice.krms.framework.engine.Proposition} {@link org.kuali.rice.krms.api.engine.Term}s
021     *
022     * @author Kuali Rice Team (rice.collab@kuali.org)
023     */
024    public interface StringCoercionExtension {
025    
026        /**
027         * Can this StringCoercionExtension coerce the given type and value into an Object?
028         * @param type of Object to coerce to.
029         * @param value value to use for coerced type
030         * @return boolean true if this StringCoercionExtension can coerce this type and value
031         */
032        boolean canCoerce(String type, String value);
033    
034        /**
035         * Returns an Object of the given type populated with the given value.
036         * @param type to coerce Object to
037         * @param value to coerce
038         * @return Object of given type with given value
039         */
040        Object coerce(String type, String value);
041    }