org.fugerit.java.dsb.DataServiceWrapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of data-service-base Show documentation
Show all versions of data-service-base Show documentation
Simple data resources load/save interface layer.
The newest version!
package org.fugerit.java.dsb;
import java.io.IOException;
import java.io.InputStream;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.ToString;
/**
* Class wrapping another DataService
*/
@NoArgsConstructor
@RequiredArgsConstructor
@ToString
public class DataServiceWrapper implements DataService {
@NonNull private DataService dataService;
/**
* Unwrap the inner DataService.
*
* @return the wrapped DataService
*/
public DataService unwrap() {
return this.dataService;
}
/**
* Wrap this DataService around another.
*
* @param dataService the DataService to wrap
*/
public void wrap( DataService dataService ) {
this.dataService = dataService;
}
@Override
public InputStream load(String id) throws IOException {
return this.unwrap().load(id);
}
@Override
public String save(InputStream data) throws IOException {
return this.unwrap().save(data);
}
@Override
public String save(InputStream data, String resourceName) throws IOException {
return this.unwrap().save(data, resourceName);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy