All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.avanza.astrix.beans.core.BeanProxy Maven / Gradle / Ivy

/*
 * Copyright 2014 Avanza Bank AB
 *
 * Licensed 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.
 */
package com.avanza.astrix.beans.core;

import java.util.function.Supplier;

import com.avanza.astrix.core.function.CheckedCommand;

import rx.Observable;

public interface BeanProxy {
	
	/**
	 * proxy an synchronous invocation. 

* * @param command * @return */ CheckedCommand proxyInvocation(CheckedCommand command); /** * Proxy a reactive invocation. The invocation is represented by * an Observable, although the underlying service method invocation can * use some other representation for the reactive result. * * * @param command * * @return A Proxied Supplier for the underlying invocation. Note * that the underlying (argument) supplier MUST be called synchronously * when invoking "get" on the returned Supplier. */ Supplier> proxyReactiveInvocation(Supplier> command); String name(); boolean isEnabled(); public static class NoProxy implements BeanProxy { @Override public CheckedCommand proxyInvocation(CheckedCommand command) { return command; } @Override public Supplier> proxyReactiveInvocation(Supplier> command) { return command; } public static BeanProxy create() { return new NoProxy(); } @Override public String name() { return "noProxy"; } @Override public boolean isEnabled() { return false; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy