Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.codehaus.mojo.rpm;
  
  /*
   * Licensed to the Apache Software Foundation (ASF) under one
   * or more contributor license agreements.  See the NOTICE file
   * distributed with this work for additional information
   * regarding copyright ownership.  The ASF licenses this file
   * to you under the Apache License, Version 2.0 (the
   * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
  *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
  */
 
 import java.util.List;

A base class to support triggers.

Author(s):
Brett Okken, Cerner Corporation
Since:
2.0-beta-4
 
 public abstract class BaseTrigger
     extends Scriptlet
 {
    
List of triggers.
 
     private List<Stringtriggers;

    
Gets the packages/versions to trigger on.

This is syntactically equivalent to a "Requires" specification (version numbers may be used). If multiple items are given, the trigger is run when *any* of those conditions becomes true.

Returns:
Returns the triggers.
 
     public List<StringgetTriggers()
     {
         return this.;
     }

    
Sets the packages/versions to trigger on.

Parameters:
triggers The triggers to set.
See also:
getTriggers()
 
     public void setTriggersList<Stringtriggers )
     {
         this. = triggers;
     }

    
 
     protected String buildScriptletLineString directive )
     {
         final StringBuilder builder = new StringBuildersuper.buildScriptletLinedirective ) );
 
         builder.append" -- " );
 
         final int size = .size();
         for ( int i = 0; i < size; ++i )
         {
             final String trigger = .geti );
 
             if ( i != 0 )
             {
                 builder.append", " );
             }
 
             builder.appendtrigger );
         }
 
         return builder.toString();
     }

    
Writes the complete trigger directive. Use instead of Scriptlet.write(java.io.PrintWriter,java.lang.String).

Parameters:
writer PrintWriter to write the trigger directive to.
Throws:
java.io.IOException
 
     protected void writeTriggerPrintWriter writer )
         throws IOException
     {
         writewritergetDirective() );
    }

    
Provides the trigger specific directive.

Returns:
The implementation specific directive.
    protected abstract String getDirective();

    
    public String toString()
    {
        StringBuilder buffer = new StringBuilder( 128 );
        buffer.appendgetClass().getName().substringgetClass().getName().lastIndexOf'.' ) ) );
        buffer.append'[' );
        buffer.append"subpackage=" );
        buffer.appendgetSubpackage() );
        buffer.append",program=" );
        buffer.appendgetProgram() );
        buffer.append",script=" );
        buffer.appendgetScript() );
        buffer.append",scriptFile=" );
        buffer.appendgetScriptFile() );
        buffer.append",fileEncoding=" );
        buffer.appendgetFileEncoding() );
        buffer.append",triggers=" );
        buffer.append );
        buffer.append"]" );
        return buffer.toString();
    }
New to GrepCode? Check out our FAQ X