org.andromda.core.common
Class Merger

java.lang.Object
  extended by org.andromda.core.common.Merger

public class Merger
extends java.lang.Object

A class that performs the merging abilities for the AndroMDA core.

Merging takes place when the NamespaceProperties.MERGE_MAPPINGS_URI is found within the namespace and merge mappings are used to replace any matching patterns in the given string.

Author:
Chad Brandon

Constructor Summary
Merger()
           
 
Method Summary
 java.lang.String getMergedString(java.io.InputStream inputStream, java.lang.String namespace)
          Retrieves the merged string.
 java.lang.String getMergedString(java.lang.String string, java.lang.String namespace)
           Retrieves the merged string.
static Merger instance()
          Gets the shared Merger instance.
 boolean requiresMerge(java.lang.String namespace)
          Indicates whether or not the given namespace requires a merge.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Merger

public Merger()
Method Detail

instance

public static Merger instance()
Gets the shared Merger instance. Normally you'll want to retrieve the instance through this method.

Returns:
the shared instance.

getMergedString

public java.lang.String getMergedString(java.lang.String string,
                                        java.lang.String namespace)

Retrieves the merged string. The merging takes place when the NamespaceProperties.MERGE_MAPPINGS_URIis found within the namespace and the merge mappings are used to replace any matching patterns in the given string.

Parameters:
string - the String to be replaced
namespace - This namespace is searched when attempting to find the NamespaceProperties.MERGE_MAPPINGS_URI.
Returns:
the replaced String.

getMergedString

public java.lang.String getMergedString(java.io.InputStream inputStream,
                                        java.lang.String namespace)
Retrieves the merged string. The merging takes place when the NamespaceProperties.MERGE_MAPPINGS_URIis found within the namespace and the merge mappings are used to replace any matching patterns in the given inputStream.

Parameters:
inputStream - the InputStream instance which is first converted to a String and then merged.
namespace - This namespace is searched when attempting to find the NamespaceProperties.MERGE_MAPPINGS_URI.
Returns:
the replaced String.

requiresMerge

public boolean requiresMerge(java.lang.String namespace)
Indicates whether or not the given namespace requires a merge.

Parameters:
namespace - the namespace to evaluate.
Returns:
true/false


Copyright © 2003-2008 AndroMDA.org. All Rights Reserved.