com.creditcloud.common.taglib.Functions.java Source code

Java tutorial

Introduction

Here is the source code for com.creditcloud.common.taglib.Functions.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.creditcloud.common.taglib;

import java.util.Collection;
import org.apache.commons.codec.binary.Base64;

/**
 * JSTL?function
 *
 * @author sobranie
 */
public class Functions {

    public static String base64(String value) {
        return Base64.encodeBase64URLSafeString(value.getBytes());
    }

    /**
     * ????
     * 
     * @param all
     * @param item
     * @return 
     */
    public static boolean contains(Collection all, Object item) {
        return all.contains(item);
    }

    /**
     * ??????.
     * 
     * ????
     * 
     * @param all
     * @param items
     * @return 
     */
    public static boolean containsAny(Collection all, Collection items) {
        for (Object item : items) {
            if (all.contains(item)) {
                return true;
            }
        }
        return false;
    }
}