Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members  

TString.java

00001 /*
00002 *  Name:      TString.java
00003 *  Author:    Rafael Jesus Alcantara Perez
00004 *  Summary:   SQL type string.
00005 *  Date:      $Date: 2003/07/29 16:47:50 $
00006 *  Revision:  $Revision: 1.5 $
00007 *
00008 *  Copyright (C) 2002-2003  Rafael Jesus Alcantara Perez <rafa@dedalo-ing.com>
00009 *
00010 *  This program is free software; you can redistribute it and/or modify
00011 *  it under the terms of the GNU General Public License as published by
00012 *  the Free Software Foundation; either version 2 of the License, or
00013 *  (at your option) any later version.
00014 *
00015 *  This program is distributed in the hope that it will be useful,
00016 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 *  GNU General Public License for more details.
00019 *
00020 *  You should have received a copy of the GNU General Public License
00021 *  along with this program; if not, write to the Free Software
00022 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00023 *  MA 02111-1307, USA.
00024 */
00025 
00027 package org.uesqlc;
00028 
00029 
00031 public class TString implements IType
00032 {
00033 
00034   protected String   yValue = null;
00035 
00036 
00037   //
00038   //  C O N S T R U C T O R S
00039   //
00040 
00045   public TString() {}
00046 
00052   public TString (final String kySTRING)
00053   {
00054     if ( kySTRING != null )
00055     {
00056       yValue = new String (kySTRING);
00057     }
00058   }
00059 
00060   public IType set (final Object ktVALUE)
00061   {
00062     if ( ktVALUE == null )
00063     {
00064       yValue = null;
00065     }
00066     else
00067     {
00068       yValue = new String ((String) ktVALUE);
00069     }
00070     return this;
00071   }
00072 
00073 
00074   //
00075   //  S E L E C T O R S
00076   //
00077 
00083   public static TString _valueOf (final String kySOURCE)
00084   {
00085     return new TString (kySOURCE);
00086   }
00087 
00094   public static TString _composeSchemaLocation ( final String kyHOST_NAME   ,
00095                                                  final String kySCHEMA_NAME )
00096   {
00097     return new TString (kyHOST_NAME + '/' + kySCHEMA_NAME);
00098   }
00099 
00106   public static TString _composeUserLogin ( final String kyUSER_NAME     ,
00107                                             final String kyUSER_PASSWORD )
00108   {
00109     return new TString (kyUSER_NAME + '/' + kyUSER_PASSWORD);
00110   }
00111 
00112   public String get()
00113   {
00114 
00115     String   yResult;
00116 
00117     if ( isNull() )
00118     {
00119       yResult = "null";
00120     }
00121     else
00122     {
00123       //
00124       //  The number of  backslashes is duplicated  due to the way the 'String'
00125       //  interprets regular expressions.
00126       //
00127       yResult = "'" + yValue.replaceAll ("'", "''").replaceAll ("\\\\", "\\\\\\\\") + "'";
00128     }
00129     return yResult;
00130 
00131   }  // get()
00132 
00133   public boolean isNull()
00134   {
00135     return ( yValue == null );
00136   }
00137 
00138   public String toString()
00139   {
00140     return ( yValue == null ) ? null : yValue.toString();
00141   }
00142 
00143 }  // class TString

Generated on Mon Oct 13 02:40:10 2003 for UESQLC by doxygen1.2.18