public abstract class AbstractReplacement extends Object
A replacement is responsible for replacing one link in the source file with the destination link.
Modifier and Type | Field and Description |
---|---|
protected String |
from |
protected String |
to |
Constructor and Description |
---|
AbstractReplacement(String from,
String to)
Creates a replacement that replaces the URL specified by from with the
URL specified by to.
|
Modifier and Type | Method and Description |
---|---|
static String |
apply(List<? extends AbstractReplacement> replacements,
String s) |
abstract String |
apply(String in)
applies this replacement to the given string.
|
static <T extends AbstractReplacement> |
create(Class<T> replacementType,
ImportMapping mapping,
boolean export)
Creates a list of replacements that can be applied to strings.
|
static <T extends AbstractReplacement> |
create(Class<T> replacementType,
ImportObject object,
boolean export)
This is a convenience method that instantiates a conforming replacement
implementation.
|
public AbstractReplacement(String from, String to)
create(Class, ImportObject, boolean)
or
create(Class, ImportMapping, boolean)
fails!public static <T extends AbstractReplacement> List<T> create(Class<T> replacementType, ImportMapping mapping, boolean export)
T
- The replacement implementation to use.replacementType
- The class of implementation to usemapping
- The mapping to implementexport
- If true, replace from textgrid url to local urlpublic static <T extends AbstractReplacement> T create(Class<T> replacementType, ImportObject object, boolean export) throws IllegalArgumentException, IllegalStateException
T
- The type of replacement to instantiatereplacementType
- the replacement implementationobject
- The mapping object used for the instantiationexport
- whether this is an export type replacement (from textgrid: uri
to local uri)IllegalArgumentException
- when the class passed in doesn't conform to the specificationIllegalStateException
- when something else goes wrong during instantiation: See the
nested exception for details.public static String apply(List<? extends AbstractReplacement> replacements, String s)
Copyright © 2015 TextGrid. All Rights Reserved.