RepositoryID.java revision 672:2bb058ce572e
1254721Semaste/* 2254721Semaste * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. 3254721Semaste * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4254721Semaste * 5254721Semaste * This code is free software; you can redistribute it and/or modify it 6254721Semaste * under the terms of the GNU General Public License version 2 only, as 7254721Semaste * published by the Free Software Foundation. Oracle designates this 8254721Semaste * particular file as subject to the "Classpath" exception as provided 9254721Semaste * by Oracle in the LICENSE file that accompanied this code. 10254721Semaste * 11254721Semaste * This code is distributed in the hope that it will be useful, but WITHOUT 12254721Semaste * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13258054Semaste * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14258054Semaste * version 2 for more details (a copy is included in the LICENSE file that 15258054Semaste * accompanied this code). 16258054Semaste * 17258054Semaste * You should have received a copy of the GNU General Public License version 18258054Semaste * 2 along with this work; if not, write to the Free Software Foundation, 19258054Semaste * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20258054Semaste * 21254721Semaste * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22254721Semaste * or visit www.oracle.com if you need additional information or have any 23254721Semaste * questions. 24254721Semaste */ 25258054Semaste/* 26258054Semaste * COMPONENT_NAME: idl.parser 27258054Semaste * 28258054Semaste * ORIGINS: 27 29254721Semaste * 30258054Semaste * Licensed Materials - Property of IBM 31254721Semaste * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 32254721Semaste * RMI-IIOP v1.0 33258054Semaste * 34258054Semaste */ 35254721Semaste 36254721Semastepackage com.sun.tools.corba.se.idl; 37254721Semaste 38254721Semaste// NOTES: 39258054Semaste// -D57110<daz> Add method to verify format (CORBA 2.3). 40254721Semaste 41254721Semastepublic class RepositoryID 42254721Semaste{ 43254721Semaste public RepositoryID () 44254721Semaste { 45254721Semaste _id = ""; 46254721Semaste } // ctor 47254721Semaste 48254721Semaste public RepositoryID (String id) 49254721Semaste { 50254721Semaste _id = id; 51254721Semaste } // ctor 52254721Semaste 53254721Semaste public String ID () 54258054Semaste { 55254721Semaste return _id; 56254721Semaste } // ID 57254721Semaste 58254721Semaste public Object clone () 59254721Semaste { 60254721Semaste return new RepositoryID (_id); 61254721Semaste } // clone 62254721Semaste 63258054Semaste public String toString () 64254721Semaste { 65254721Semaste return ID (); 66254721Semaste } // toString 67254721Semaste 68254721Semaste /** 69254721Semaste * Determine is a supplied string meets the minimal format requirement 70254721Semaste * for a Repository ID. 71254721Semaste * @return true if supplied string has form {@code '<format>:<string>'}, where 72254721Semaste * {@code <format>} is any non-empty string not containing ':'. 73254721Semaste **/ 74258054Semaste public static boolean hasValidForm (String string) 75254721Semaste { 76254721Semaste return string != null && string.indexOf (':') > 0; 77254721Semaste } // hasValidForm 78254721Semaste 79254721Semaste private String _id; 80254721Semaste} // class RepositoryID 81254721Semaste