Skip to content
Snippets Groups Projects
Commit c6c831c6 authored by Florian Hölzl's avatar Florian Hölzl
Browse files

further rework of code generator (still to weird)

refs 857
parent eb0928fa
No related branches found
No related tags found
No related merge requests found
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2012 ForTISS GmbH |
| |
| 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 org.fortiss.tooling.kernel.extension.base;
import org.fortiss.tooling.kernel.extension.ITransformationProvider;
import org.fortiss.tooling.kernel.extension.data.ITransformationContext;
import org.fortiss.tooling.kernel.extension.exception.TransformationFailedException;
/**
* Base class for {@link ITransformationProvider}s.
*
* @param <S>
* the source object class
* @param <T>
* the target class
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: E70B50712E9BA8739D02E8FE703FC5C0
*/
public abstract class TransformationProviderBase<S extends Object, T extends Object> implements
ITransformationProvider {
/** Returns the source class this provider can handle. */
protected abstract Class<S> getSourceClass();
/** {@inheritDoc} */
@Override
public abstract Class<T> getTargetClass();
/** {@inheritDoc} */
@Override
public abstract T transform(Object source, ITransformationContext context)
throws TransformationFailedException;
/** {@inheritDoc} */
@Override
public boolean
canHandleChainTransformation(Class<?> sourceClass, ITransformationContext context) {
return getSourceClass().isAssignableFrom(sourceClass);
}
/** {@inheritDoc} */
@Override
public boolean canTransform(Object source, ITransformationContext context) {
return getSourceClass().isInstance(source);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment