View Javadoc

1   /**
2    * Copyright 2005-2015 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.krms.framework.engine.expression;
17  
18  /**
19   * Interface to extend to implement custom coerce of {@link String}s to an instance of the given type, when when validating
20   * {@link org.kuali.rice.krms.framework.engine.Proposition} {@link org.kuali.rice.krms.api.engine.Term}s
21   *
22   * @author Kuali Rice Team (rice.collab@kuali.org)
23   */
24  public interface StringCoercionExtension {
25  
26      /**
27       * Can this StringCoercionExtension coerce the given type and value into an Object?
28       * @param type of Object to coerce to.
29       * @param value value to use for coerced type
30       * @return boolean true if this StringCoercionExtension can coerce this type and value
31       */
32      boolean canCoerce(String type, String value);
33  
34      /**
35       * Returns an Object of the given type populated with the given value.
36       * @param type to coerce Object to
37       * @param value to coerce
38       * @return Object of given type with given value
39       */
40      Object coerce(String type, String value);
41  }