001    /**
002     * MyStringType.java
003     * jCOLIBRI2 framework. 
004     * @author Juan A. Recio-García.
005     * GAIA - Group for Artificial Intelligence Applications
006     * http://gaia.fdi.ucm.es
007     * 01/06/2007
008     */
009    package jcolibri.test.test2;
010    
011    /**
012     * This class shows how to define your own data types for an attribute of the case.
013     * You only need to implement TypeAdaptor.
014     * <p>
015     * IMPORTANT: You must define the equals() method to avoid problems with the data base connector.
016     * If you continue having problems try returning always "true".
017     * 
018     * @author Juan A. Recio-Garcia
019     *
020     */
021    public class MyStringType implements jcolibri.connector.TypeAdaptor{
022            
023            private String _internalString; 
024            
025            public MyStringType()
026            {
027            }
028            
029            public void fromString(String content) throws Exception {
030                    _internalString = content;
031            }
032            
033            public String toString(){
034                    return _internalString;
035            }
036            
037            public boolean equals(Object o)
038            {
039                    MyStringType mst = (MyStringType) o;
040                    return mst._internalString.equals(this._internalString);
041            }
042    }