View Javadoc

1   /*
2    * Copyright 2004-2006 the Seasar Foundation and the Others.
3    *
4    * Licensed under the Apache 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.apache.org/licenses/LICENSE-2.0
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, 
13   * either express or implied. See the License for the specific language
14   * governing permissions and limitations under the License.
15   */
16  package com.isenshi.util.converter.function;
17  
18  import java.util.Properties;
19  
20  import org.seasar.tuigwaa.model.core.TgwAttribute;
21  import org.seasar.tuigwaa.model.core.TgwEntity;
22  import org.seasar.tuigwaa.util.TgwNameUtils;
23  
24  import com.isenshi.util.functor.UnaryFunction;
25  
26  public abstract class ConverterFunction implements UnaryFunction {
27  
28  	private String sourceField;
29  
30  	private String targetField;
31  
32  	private TgwEntity entity;
33  
34  	public String getSourceField() {
35  		return sourceField;
36  	}
37  
38  	public void setSourceField(String sourceField) {
39  		this.sourceField = sourceField;
40  	}
41  
42  	public String getTargetField() {
43  		return targetField;
44  	}
45  
46  	public void setTargetField(String targetField) {
47  		this.targetField = targetField;
48  	}
49  
50  	public TgwEntity getEntity() {
51  		return entity;
52  	}
53  
54  	public void setEntity(TgwEntity entity) {
55  		this.entity = entity;
56  	}
57  
58  	public TgwAttribute getAttribute() {
59  		return getEntity().getField(
60  				TgwNameUtils.toPropertyName(getTargetField()));
61  	}
62  	
63  	public Properties getExtraProperties(){
64  		return null;
65  	}
66  	
67  	// public abstract Object evaluate(Object obj);
68  
69  }