1 /* 2 * Copyright 2008 the original author or authors. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package org.openehealth.ipf.platform.camel.core.adapter; 17 18 import org.apache.camel.Exchange; 19 import org.apache.camel.Expression; 20 21 /** 22 * An expression that evaluates to a constant parameter array inpdependent of 23 * the {@link Exchange} argument. 24 * 25 * @author Martin Krasser 26 */ 27 public class StaticParams implements Expression { 28 29 private final Object[] params; 30 31 /** 32 * Creates a new {@link StaticParams} expression. 33 * 34 * @param params 35 * the constant evaluation result. 36 */ 37 public StaticParams(Object... params) { 38 this.params = params; 39 } 40 41 /** 42 * Evaluates to the params array used to construct this expression. 43 * 44 * @param exchange 45 * ignored. 46 * @param type 47 * ignored. 48 */ 49 @Override 50 public <T> T evaluate(Exchange exchange, Class<T> type) { 51 return type.cast(params); 52 } 53 54 }