Browse Source

Merged GeneralTypeDefinition and TypeDefinition into one class.

Made all the TypeDefinition and ConverterTypeDefinition immutable objects as that eases evolution. See mailing list for more explanation


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271106 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Donald 23 years ago
parent
commit
ccdeef5fa0
3 changed files with 32 additions and 99 deletions
  1. +8
    -31
      proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/deployer/ConverterDefinition.java
  2. +0
    -52
      proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/deployer/GeneralTypeDefinition.java
  3. +24
    -16
      proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/deployer/TypeDefinition.java

+ 8
- 31
proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/deployer/ConverterDefinition.java View File

@@ -15,23 +15,16 @@ package org.apache.myrmidon.interfaces.deployer;
public class ConverterDefinition
extends TypeDefinition
{
private String m_sourceType;
private String m_destinationType;
private final String m_sourceType;
private final String m_destinationType;

/**
* Returns the type's role.
*/
public String getRoleShorthand()
public ConverterDefinition( final String className,
final String sourceType,
final String destinationType )
{
return "converter";
}

/**
* Returns the type's name.
*/
public String getName()
{
return getClassname();
super( className, "converter", className );
m_sourceType = sourceType;
m_destinationType = destinationType;
}

/**
@@ -42,14 +35,6 @@ public class ConverterDefinition
return m_sourceType;
}

/**
* Sets the converter's source type.
*/
public void setSourceType( final String sourceType )
{
m_sourceType = sourceType;
}

/**
* Returns the converter's destination type.
*/
@@ -57,12 +42,4 @@ public class ConverterDefinition
{
return m_destinationType;
}

/**
* Sets the converter's destination type.
*/
public void setDestinationType( final String destinationType )
{
m_destinationType = destinationType;
}
}

+ 0
- 52
proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/deployer/GeneralTypeDefinition.java View File

@@ -1,52 +0,0 @@
/*
* 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.txt file.
*/
package org.apache.myrmidon.interfaces.deployer;

/**
* A general-purpose type definition.
*
* @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
*/
public class GeneralTypeDefinition
extends TypeDefinition
{
private String m_name;
private String m_roleShorthand;

/**
* Returns the type's role.
*/
public String getRoleShorthand()
{
return m_roleShorthand;
}

/**
* Sets the type's role.
*/
public void setType( String roleShorthand )
{
m_roleShorthand = roleShorthand;
}

/**
* Returns the type's name.
*/
public String getName()
{
return m_name;
}

/**
* Sets the type's name.
*/
public void setName( String name )
{
m_name = name;
}
}

+ 24
- 16
proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/deployer/TypeDefinition.java View File

@@ -8,38 +8,46 @@
package org.apache.myrmidon.interfaces.deployer;

/**
* A basic type definition. This class is used to build a type definition,
* from a typelib descriptor, or via introspection.
* A general-purpose type definition.
*
* @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
*/
public abstract class TypeDefinition
public class TypeDefinition
{
private String m_className;
private final String m_name;
private final String m_role;
private final String m_classname;

/**
* Returns the type's name.
*/
public abstract String getName();
public TypeDefinition( final String name,
final String roleShorthand,
final String className )
{
m_name = name;
m_role = roleShorthand;
m_classname = className;
}

/**
* Returns the type's role.
* Returns the type's implementation class name.
*/
public abstract String getRoleShorthand();
public final String getClassname()
{
return m_classname;
}

/**
* Returns the type's implementation class name.
* Returns the type's role.
*/
public String getClassname()
public final String getRole()
{
return m_className;
return m_role;
}

/**
* Sets the type's implementation class name.
* Returns the type's name.
*/
public void setClassname( final String className )
public String getName()
{
m_className = className;
return m_name;
}
}

Loading…
Cancel
Save