class TextLinks implements Parcelable {

    @Status
    public int apply(
            @NonNull Spannable text,
            @ApplyStrategy int applyStrategy,
            @Nullable SpanFactory spanFactory) {
        Preconditions.checkNotNull(text);
        checkValidApplyStrategy(applyStrategy);
        if (!mFullText.equals(text.toString())) {
            return STATUS_DIFFERENT_TEXT;
        }
        if (mLinks.isEmpty()) {
            return STATUS_NO_LINKS_FOUND;
        }

        if (spanFactory == null) {
            spanFactory = DEFAULT_SPAN_FACTORY;
        }
        int applyCount = 0;
        for (TextLink link : mLinks) {
            final TextLinkSpan span = spanFactory.createSpan(link);
            if (span != null) {
                final ClickableSpan[] existingSpans = text.getSpans(
                        link.getStart(), link.getEnd(), ClickableSpan.class);
                if (existingSpans.length > 0) {
                    if (applyStrategy == APPLY_STRATEGY_REPLACE) {
                        for (ClickableSpan existingSpan : existingSpans) {
                            text.removeSpan(existingSpan);
                        }
                        text.setSpan(span, link.getStart(), link.getEnd(),
                                Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
                        applyCount++;
                    }
                } else {
                    text.setSpan(span, link.getStart(), link.getEnd(),
                            Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
                    applyCount++;
                }
            }
        }
        if (applyCount == 0) {
            return STATUS_NO_LINKS_APPLIED;
        }
        return STATUS_LINKS_APPLIED;
    }

    private  TextLinks(String fullText, ArrayList<TextLink> links);
    private  TextLinks(Parcel in);

}