jp.co.golorp.emarf.properties.collection.AppSet.java Source code

Java tutorial

Introduction

Here is the source code for jp.co.golorp.emarf.properties.collection.AppSet.java

Source

/*
 * Apache License, Version 2.0???????
 * ?????????????
 *
 * ??http://www.apache.org/licenses/LICENSE-2.0?????
 *
 * ???????????????
 * ????????
 * ??????????????????????
 *
 * ????????????????????????
 */
package jp.co.golorp.emarf.properties.collection;

import java.util.Iterator;
import java.util.LinkedHashSet;

import org.apache.commons.lang3.StringUtils;

import jp.co.golorp.emarf.util.StringUtil;

/**
 * Set
 *
 * @param <T>
 *            ??
 * @author oukuf@golorp
 */
public final class AppSet<T> extends LinkedHashSet<Object> {

    /**
     * @param name
     *            ??
     * @return ???suffix?set????
     */
    public boolean isEnd(final String name) {

        if (StringUtil.isNotBlank(name)) {
            for (Iterator<?> suffixes = this.iterator(); suffixes.hasNext();) {
                String suffix = (String) suffixes.next();
                if (StringUtils.isNotBlank(suffix) && name.replaceFirst("\\[[0-9]+\\]", "").endsWith(suffix)) {
                    return true;
                }
            }
        }

        return false;
    }

}