RepositoryID.java revision 608:7e06bf1dcb09
1/*
2 * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.  Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25/*
26 * COMPONENT_NAME: idl.parser
27 *
28 * ORIGINS: 27
29 *
30 * Licensed Materials - Property of IBM
31 * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
32 * RMI-IIOP v1.0
33 *
34 */
35
36package com.sun.tools.corba.se.idl;
37
38// NOTES:
39// -D57110<daz> Add method to verify format (CORBA 2.3).
40
41public class RepositoryID
42{
43  public RepositoryID ()
44  {
45    _id = "";
46  } // ctor
47
48  public RepositoryID (String id)
49  {
50    _id = id;
51  } // ctor
52
53  public String ID ()
54  {
55    return _id;
56  } // ID
57
58  public Object clone ()
59  {
60    return new RepositoryID (_id);
61  } // clone
62
63  public String toString ()
64  {
65    return ID ();
66  } // toString
67
68  /**
69   * Determine is a supplied string meets the minimal format requirement
70   * for a Repository ID.
71   * @return true iff supplied string has form '<format>:<string>', where
72   * <format> is any non-empty string not containing ':'.
73   **/
74  public static boolean hasValidForm (String string)
75  {
76    return string != null && string.indexOf (':') > 0;
77  } // hasValidForm
78
79  private String _id;
80} // class RepositoryID
81