001 /* 002 Copyright (C) 2001-2003 Renaud Pawlak <renaud@aopsys.com> 003 004 This program is free software; you can redistribute it and/or modify 005 it under the terms of the GNU Lesser General Public License as 006 published by the Free Software Foundation; either version 2 of the 007 License, or (at your option) any later version. 008 009 This program is distributed in the hope that it will be useful, but 010 WITHOUT ANY WARRANTY; without even the implied warranty of 011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 Lesser General Public License for more details. 013 014 You should have received a copy of the GNU Lesser General Public 015 License along with this program; if not, write to the Free Software 016 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 017 USA */ 018 019 package org.objectweb.jac.core; 020 021 /** 022 * This class implements useful static methods to manipulate JAC objects 023 * and names. 024 * 025 * @see NameRepository 026 * @see org.objectweb.jac.aspects.naming.NamingAC 027 */ 028 029 public class Naming { 030 031 public static String FORCE_NAME="Naming.FORCE_NAME"; 032 033 /** 034 * Sets the name of the next created object within the current 035 * thread. */ 036 public static void setName(String name) { 037 Collaboration.get().addAttribute(FORCE_NAME, name); 038 } 039 040 /** 041 * Returns the JAC name of a JAC object. 042 * 043 * <p>Equivalent to <code>NameRepository.get().getName(object)</code>. 044 * 045 * @see NameRepository#getName(Object) */ 046 public static String getName(Object object) { 047 return NameRepository.get().getName(object); 048 } 049 050 /** 051 * Returns the JAC object named name. 052 * 053 * <p>Equivalent to <code>NameRepository.get().getObject(name)</code>. 054 * 055 * @see NameRepository#getObject(String) */ 056 public static Object getObject(String name) { 057 return NameRepository.get().getObject(name); 058 } 059 060 /** Name of configuration file parser */ 061 public static final String PARSER_NAME = "parserimpl#0"; 062 }