From 16db5240fbf95e821e0081e76c64432853cde3a1 Mon Sep 17 00:00:00 2001 From: Peter Donald Date: Tue, 12 Jun 2001 13:40:24 +0000 Subject: [PATCH] Made a object to model imports. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269154 13f79535-47bb-0310-9956-ffa450edef68 --- .../myrmidon/components/model/Import.java | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 proposal/myrmidon/src/java/org/apache/myrmidon/components/model/Import.java diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/components/model/Import.java b/proposal/myrmidon/src/java/org/apache/myrmidon/components/model/Import.java new file mode 100644 index 000000000..e8e37a4f9 --- /dev/null +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/components/model/Import.java @@ -0,0 +1,82 @@ +/* + * Copyright (C) The Apache Software Foundation. All rights reserved. + * + * This software is published under the terms of the Apache Software License + * version 1.1, a copy of which has been included with this distribution in + * the LICENSE file. + */ +package org.apache.myrmidon.components.model; + +/** + * Imports in a build file. + * + * @author Peter Donald + */ +public class Import +{ + //Name of library (this is location independent) + private final String m_library; + + //Do we need this?? + //private final String m_namespace; + + //The type to be imported from library + private final String m_type; + + //The name of type instance + private final String m_name; + + public Import( final String library ) + { + this( library, null, null ); + } + + public Import( final String library, final String type, final String name ) + { + m_library = library; + m_type = type; + m_name = name; + + //If only one of name or type is null, throw an exception + if( null == m_type || null == m_name ) + { + if( null != m_type || null != m_name ) + { + throw new IllegalArgumentException( "Can not have an import that specifies " + + "only one of name or type" ); + } + } + } + + /** + * Get type + * + * @return the type + */ + public final String getType() + { + return m_type; + } + + /** + * Get name of imported + * + * @return the name + */ + public final String getName() + { + return m_name; + } + + /** + * Get name of library + * + * @return the library name + */ + public final String getLibrary() + { + return m_library; + } +} + +