cz.jalasoft.util.text.FragmentConverters Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of JalasoftUtils Show documentation
Show all versions of JalasoftUtils Show documentation
A collection of utility classes that might be useful.
The newest version!
package cz.jalasoft.util.text;
import cz.jalasoft.util.converter.ConversionException;
import cz.jalasoft.util.converter.Converter;
/**
* Created by honzales on 9.6.15.
*/
public interface FragmentConverters {
/*
public static > Converter withoutCharacters(final CharMatcher matcher) {
return new Converter() {
@Override
public TextFragment convert(T from) throws ConversionException {
String newText = matcher.removeFrom(from.text());
return Fragment.fromText(newText);
}
@Override
public Class sourceType() {
return
}
@Override
public Class targetType() {
return TextFragment.class;
}
};
}*/
static Converter toHtmlEscaped() {
return new Converter() {
@Override
public TextFragment convert(TextFragment from) throws ConversionException {
String text = from.text();
String newText = text.replace("&", "&");
return Fragment.fromText(newText);
}
@Override
public Class sourceType() {
return TextFragment.class;
}
@Override
public Class targetType() {
return TextFragment.class;
}
};
}
}