1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22/* 23 * ident "%Z%%M% %I% %E% SMI" 24 * 25 * Copyright (c) 2000 by Sun Microsystems, Inc. 26 * All rights reserved. 27 */ 28 29/* 30 * Copyright (C) 1996 Active Software, Inc. 31 * All rights reserved. 32 * 33 * @(#) AMRefConverter.java 1.15 - last change made 07/25/97 34 */ 35 36package sunsoft.jws.visual.rt.type; 37 38/** 39 * Converts references to attribute manager objects into their 40 * names and back again. 41 * 42 * @see AMRef 43 * @version 1.15, 07/25/97 44 */ 45public class AMRefConverter extends Converter { 46 /** 47 * Converts an AMRef object to a string. 48 */ 49 public String convertToString(Object obj) { 50 if (obj != null) 51 return (((AMRef) obj).getName()); 52 else 53 return (/* NOI18N */""); 54 } 55 56 /** 57 * Converts a string into an AMRef object. 58 * 59 * @param s string to convert 60 */ 61 public Object convertFromString(String s) { 62 if (s != null && s.length() != 0) 63 return (new AMRef(s)); 64 else 65 return (null); 66 } 67 68 /** 69 * Returns code for creating an AMRef object. 70 * 71 * @param obj AMRef object for which to generate code 72 */ 73 public String convertToCode(Object obj) { 74 return (/* NOI18N */"new AMRef(\"" + convertToString(obj) 75 + /* NOI18N */"\")"); 76 } 77} 78