MergeResult.java :  » UML » MetaBoss » com » metaboss » sdlctools » services » jdktools » Java Open Source

Java Open Source » UML » MetaBoss 
MetaBoss » com » metaboss » sdlctools » services » jdktools » MergeResult.java
// THIS SOFTWARE IS PROVIDED BY SOFTARIS PTY.LTD. AND OTHER METABOSS
// CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
// BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTARIS PTY.LTD.
// OR OTHER METABOSS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
// EVEN IF SOFTARIS PTY.LTD. OR OTHER METABOSS CONTRIBUTORS ARE ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// Copyright 2000-2005  Softaris Pty.Ltd. All Rights Reserved.
package com.metaboss.sdlctools.services.jdktools;

/** This structure contains template merge output */
public final  class MergeResult
{
    /** This fields contains true if compiler has succeeded */
    private boolean mIsSuccessful = false;
    /** This fields contains the printout of the compilation */
    private String mMergeLogPrintout = "";
    /** This field contains the result of the merge */
    private String mMergedOutput = "";

    /** Creates the result containing the failure */
    public static MergeResult createMergeFailure(String pMergeLogPrintout)
    {
        MergeResult lResult = new MergeResult();
        lResult.mIsSuccessful = false;
        lResult.mMergeLogPrintout = pMergeLogPrintout;
        lResult.mMergedOutput = "";
        return lResult;
    }

    /** Creates the result containing the success */
    public static MergeResult createMergeSuccess(String pMergedOutput, String pMergeLogPrintout)
    {
        MergeResult lResult = new MergeResult();
        lResult.mIsSuccessful = true;
        lResult.mMergeLogPrintout = (pMergeLogPrintout == null) ? "" : pMergeLogPrintout;
        lResult.mMergedOutput = pMergedOutput;
        return lResult;
    }

    /** Creates the result containing the success */
    public static MergeResult createMergeSuccess(String pMergedOutput)
    {
        MergeResult lResult = new MergeResult();
        lResult.mIsSuccessful = true;
        lResult.mMergeLogPrintout = "";
        lResult.mMergedOutput = pMergedOutput;
        return lResult;
    }

    /** Returns true if result is successfull */
    public boolean isSuccessful()
    {
        return mIsSuccessful;
    }

    /** Returns result of the merge */
    public String getMergedOutput()
    {
        if (!mIsSuccessful)
            throw new java.lang.IllegalStateException("Merged output is only available from successful merge result");
        return mMergedOutput;
    }

    /** Returns contents of the log output */
    public String getMergeLogPrintout()
    {
        return mMergeLogPrintout;
    }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.