org.apache.maven.model.building
Class StringModelSource

java.lang.Object
  extended by org.apache.maven.model.building.StringModelSource
All Implemented Interfaces:
ModelSource

public class StringModelSource
extends Object
implements ModelSource

Wraps an ordinary CharSequence as a model source.

Author:
Benjamin Bentmann

Constructor Summary
StringModelSource(CharSequence pom)
          Creates a new model source backed by the specified string.
StringModelSource(CharSequence pom, String location)
          Creates a new model source backed by the specified string.
 
Method Summary
 InputStream getInputStream()
          Gets a byte stream to the POM contents.
 String getLocation()
          Provides a user-friendly hint about the location of the POM.
 String getModel()
          Gets the character sequence of this model source.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StringModelSource

public StringModelSource(CharSequence pom)
Creates a new model source backed by the specified string.

Parameters:
pom - The POM's string representation, may be empty or null.

StringModelSource

public StringModelSource(CharSequence pom,
                         String location)
Creates a new model source backed by the specified string.

Parameters:
pom - The POM's string representation, may be empty or null.
location - The location to report for this use, may be null.
Method Detail

getInputStream

public InputStream getInputStream()
                           throws IOException
Description copied from interface: ModelSource
Gets a byte stream to the POM contents. Closing the returned stream is the responsibility of the caller.

Specified by:
getInputStream in interface ModelSource
Returns:
A byte stream to the POM contents, never null.
Throws:
IOException

getLocation

public String getLocation()
Description copied from interface: ModelSource
Provides a user-friendly hint about the location of the POM. This could be a local file path, a URI or just an empty string. The intention is to assist users during error reporting.

Specified by:
getLocation in interface ModelSource
Returns:
A user-friendly hint about the location of the POM, never null.

getModel

public String getModel()
Gets the character sequence of this model source.

Returns:
The underlying character stream, never null.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2001–2013 The Apache Software Foundation. All rights reserved.