1 package org.apache.maven.doxia.linkcheck.validation; 2 3 /* 4 * Licensed to the Apache Software Foundation (ASF) under one 5 * or more contributor license agreements. See the NOTICE file 6 * distributed with this work for additional information 7 * regarding copyright ownership. The ASF licenses this file 8 * to you under the Apache License, Version 2.0 (the 9 * "License"); you may not use this file except in compliance 10 * with the License. You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, 15 * software distributed under the License is distributed on an 16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 * KIND, either express or implied. See the License for the 18 * specific language governing permissions and limitations 19 * under the License. 20 */ 21 22 import java.io.Serializable; 23 24 /** 25 * This class is used to return status responses from the validation handlers. A persistent result means that it can be 26 * stored in the persistent cache and used across runs. 27 * 28 * @author <a href="mailto:bwalding@apache.org">Ben Walding</a> 29 * @author <a href="mailto:aheritier@apache.org">Arnaud Heritier</a> 30 * @version $Id: LinkValidationResult.java 799838 2009-08-01 11:23:24Z vsiveton $ 31 */ 32 public class LinkValidationResult 33 implements Serializable 34 { 35 /** serialVersionUID. */ 36 private static final long serialVersionUID = -8346824125135406813L; 37 38 /** Validation result level: not mine. */ 39 public static final int NOTMINE = 0; 40 41 /** The persistent property. */ 42 private final boolean persistent; 43 44 /** The status. */ 45 private final int status; 46 47 /** The error message. */ 48 private final String errorMessage; 49 50 /** 51 * Returns the persistent property. 52 * 53 * @return boolean 54 */ 55 public boolean isPersistent() 56 { 57 return this.persistent; 58 } 59 60 /** 61 * Returns the status. 62 * 63 * @return int 64 */ 65 public int getStatus() 66 { 67 return this.status; 68 } 69 70 /** 71 * Returns the errorMessage. 72 * 73 * @return the errorMessage. 74 */ 75 public String getErrorMessage() 76 { 77 return this.errorMessage; 78 } 79 80 /** 81 * Constructor: initializes status, persistent and errorMessage. 82 * 83 * @param stat The status. 84 * @param persistent The persistent. 85 * @param message The errorMessage. 86 */ 87 public LinkValidationResult( int stat, boolean persistent, String message ) 88 { 89 this.status = stat; 90 91 this.persistent = persistent; 92 93 this.errorMessage = message; 94 } 95 96 /** {@inheritDoc} */ 97 public String toString() 98 { 99 StringBuffer sb = new StringBuffer(); 100 101 sb.append( "persistent=" ).append( this.persistent ).append( '\n' ); 102 sb.append( "status=" ).append( this.status ).append( '\n' ); 103 sb.append( "errorMessage=" ).append( this.errorMessage ); 104 105 return sb.toString(); 106 } 107 }