1 /* 2 * Copyright (C) Christian Schulte, 2005-206 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * o Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 12 * o Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in 14 * the documentation and/or other materials provided with the 15 * distribution. 16 * 17 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 18 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 19 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 * $JOMC: TransformerResourceType.java 3880 2011-10-24 01:00:25Z schulte2005 $ 29 * 30 */ 31 package org.jomc.mojo; 32 33 import java.util.ArrayList; 34 import java.util.LinkedList; 35 import java.util.List; 36 37 /** 38 * Datatype describing a XSLT document resource. 39 * 40 * @author <a href="mailto:schulte2005@users.sourceforge.net">Christian Schulte</a> 41 * @version $JOMC: TransformerResourceType.java 3880 2011-10-24 01:00:25Z schulte2005 $ 42 * @since 1.2 43 */ 44 public class TransformerResourceType extends ResourceType 45 { 46 47 /** Transformation parameter resources. */ 48 private List<TransformationParameterResource> transformationParameterResources; 49 50 /** Transformation parameters. */ 51 private List<TransformationParameter> transformationParameters; 52 53 /** Transformation output properties. */ 54 private List<TransformationOutputProperty> transformationOutputProperties; 55 56 /** Creates a new {@code TransformerResourceType} instance. */ 57 public TransformerResourceType() 58 { 59 super(); 60 } 61 62 /** 63 * Gets the transformation parameter resource to apply. 64 * <p>This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make 65 * to the returned list will be present inside the object. This is why there is no {@code set} method for the 66 * transformation parameter resources property.</p> 67 * 68 * @return The transformation parameter resources to apply. 69 */ 70 public final List<TransformationParameterResource> getTransformationParameterResources() 71 { 72 if ( this.transformationParameterResources == null ) 73 { 74 this.transformationParameterResources = new LinkedList<TransformationParameterResource>(); 75 } 76 77 return this.transformationParameterResources; 78 } 79 80 /** 81 * Gets the transformation parameters to apply. 82 * <p>This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make 83 * to the returned list will be present inside the object. This is why there is no {@code set} method for the 84 * transformation parameters property.</p> 85 * 86 * @return The transformation parameters to apply. 87 */ 88 public final List<TransformationParameter> getTransformationParameters() 89 { 90 if ( this.transformationParameters == null ) 91 { 92 this.transformationParameters = new LinkedList<TransformationParameter>(); 93 } 94 95 return this.transformationParameters; 96 } 97 98 /** 99 * Gets the transformation output properties to apply. 100 * <p>This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make 101 * to the returned list will be present inside the object. This is why there is no {@code set} method for the 102 * transformation output properties property.</p> 103 * 104 * @return The transformation output properties to apply. 105 */ 106 public final List<TransformationOutputProperty> getTransformationOutputProperties() 107 { 108 if ( this.transformationOutputProperties == null ) 109 { 110 this.transformationOutputProperties = new LinkedList<TransformationOutputProperty>(); 111 } 112 113 return this.transformationOutputProperties; 114 } 115 116 /** 117 * Creates and returns a copy of this object. 118 * 119 * @return A copy of this object. 120 */ 121 @Override 122 public TransformerResourceType clone() 123 { 124 final TransformerResourceType clone = (TransformerResourceType) super.clone(); 125 126 if ( this.transformationOutputProperties != null ) 127 { 128 clone.transformationOutputProperties = 129 new ArrayList<TransformationOutputProperty>( this.transformationOutputProperties.size() ); 130 131 for ( TransformationOutputProperty e : this.transformationOutputProperties ) 132 { 133 clone.transformationOutputProperties.add( e.clone() ); 134 } 135 } 136 137 if ( this.transformationParameterResources != null ) 138 { 139 clone.transformationParameterResources = 140 new ArrayList<TransformationParameterResource>( this.transformationParameterResources.size() ); 141 142 for ( TransformationParameterResource e : this.transformationParameterResources ) 143 { 144 clone.transformationParameterResources.add( e.clone() ); 145 } 146 } 147 148 if ( this.transformationParameters != null ) 149 { 150 clone.transformationParameters = 151 new ArrayList<TransformationParameter>( this.transformationParameters.size() ); 152 153 for ( TransformationParameter e : this.transformationParameters ) 154 { 155 clone.transformationParameters.add( e.clone() ); 156 } 157 } 158 159 return clone; 160 } 161 162 }