001/* 002 * Copyright (C) 2005 Christian Schulte <cs@schulte.it> 003 * All rights reserved. 004 * 005 * Redistribution and use in source and binary forms, with or without 006 * modification, are permitted provided that the following conditions 007 * are met: 008 * 009 * o Redistributions of source code must retain the above copyright 010 * notice, this list of conditions and the following disclaimer. 011 * 012 * o Redistributions in binary form must reproduce the above copyright 013 * notice, this list of conditions and the following disclaimer in 014 * the documentation and/or other materials provided with the 015 * distribution. 016 * 017 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 018 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 019 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 020 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, 021 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 022 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 023 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 024 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 025 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 026 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 027 * 028 * $JOMC: TransformerResourceType.java 5135 2016-04-08 13:53:07Z schulte $ 029 * 030 */ 031package org.jomc.mojo; 032 033import java.util.ArrayList; 034import java.util.LinkedList; 035import java.util.List; 036 037/** 038 * Datatype describing a XSLT document resource. 039 * 040 * @author <a href="mailto:cs@schulte.it">Christian Schulte</a> 041 * @version $JOMC: TransformerResourceType.java 5135 2016-04-08 13:53:07Z schulte $ 042 * @since 1.2 043 */ 044public class TransformerResourceType extends ResourceType 045{ 046 047 /** 048 * Transformation parameter resources. 049 */ 050 private List<TransformationParameterResource> transformationParameterResources; 051 052 /** 053 * Transformation parameters. 054 */ 055 private List<TransformationParameter> transformationParameters; 056 057 /** 058 * Transformation output properties. 059 */ 060 private List<TransformationOutputProperty> transformationOutputProperties; 061 062 /** 063 * Creates a new {@code TransformerResourceType} instance. 064 */ 065 public TransformerResourceType() 066 { 067 super(); 068 } 069 070 /** 071 * Gets the transformation parameter resource to apply. 072 * <p> 073 * This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make 074 * to the returned list will be present inside the object. This is why there is no {@code set} method for the 075 * transformation parameter resources property. 076 * </p> 077 * 078 * @return The transformation parameter resources to apply. 079 */ 080 public final List<TransformationParameterResource> getTransformationParameterResources() 081 { 082 if ( this.transformationParameterResources == null ) 083 { 084 this.transformationParameterResources = new LinkedList<TransformationParameterResource>(); 085 } 086 087 return this.transformationParameterResources; 088 } 089 090 /** 091 * Gets the transformation parameters to apply. 092 * <p> 093 * This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make 094 * to the returned list will be present inside the object. This is why there is no {@code set} method for the 095 * transformation parameters property. 096 * </p> 097 * 098 * @return The transformation parameters to apply. 099 */ 100 public final List<TransformationParameter> getTransformationParameters() 101 { 102 if ( this.transformationParameters == null ) 103 { 104 this.transformationParameters = new LinkedList<TransformationParameter>(); 105 } 106 107 return this.transformationParameters; 108 } 109 110 /** 111 * Gets the transformation output properties to apply. 112 * <p> 113 * This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make 114 * to the returned list will be present inside the object. This is why there is no {@code set} method for the 115 * transformation output properties property. 116 * </p> 117 * 118 * @return The transformation output properties to apply. 119 */ 120 public final List<TransformationOutputProperty> getTransformationOutputProperties() 121 { 122 if ( this.transformationOutputProperties == null ) 123 { 124 this.transformationOutputProperties = new LinkedList<TransformationOutputProperty>(); 125 } 126 127 return this.transformationOutputProperties; 128 } 129 130 /** 131 * Creates and returns a copy of this object. 132 * 133 * @return A copy of this object. 134 */ 135 @Override 136 public TransformerResourceType clone() 137 { 138 final TransformerResourceType clone = (TransformerResourceType) super.clone(); 139 140 if ( this.transformationOutputProperties != null ) 141 { 142 clone.transformationOutputProperties = 143 new ArrayList<TransformationOutputProperty>( this.transformationOutputProperties.size() ); 144 145 for ( final TransformationOutputProperty e : this.transformationOutputProperties ) 146 { 147 clone.transformationOutputProperties.add( e.clone() ); 148 } 149 } 150 151 if ( this.transformationParameterResources != null ) 152 { 153 clone.transformationParameterResources = 154 new ArrayList<TransformationParameterResource>( this.transformationParameterResources.size() ); 155 156 for ( final TransformationParameterResource e : this.transformationParameterResources ) 157 { 158 clone.transformationParameterResources.add( e.clone() ); 159 } 160 } 161 162 if ( this.transformationParameters != null ) 163 { 164 clone.transformationParameters = 165 new ArrayList<TransformationParameter>( this.transformationParameters.size() ); 166 167 for ( final TransformationParameter e : this.transformationParameters ) 168 { 169 clone.transformationParameters.add( e.clone() ); 170 } 171 } 172 173 return clone; 174 } 175 176}