Example usage for org.apache.commons.collections FastHashMap FastHashMap

List of usage examples for org.apache.commons.collections FastHashMap FastHashMap

Introduction

In this page you can find the example usage for org.apache.commons.collections FastHashMap FastHashMap.

Prototype

public FastHashMap() 

Source Link

Document

Construct an empty map.

Usage

From source file:com.octo.captcha.service.captchastore.FastHashMapCaptchaStore.java

public FastHashMapCaptchaStore() {
    this.store = new FastHashMap();
}

From source file:com.whirlycott.cache.impl.FastHashMapImpl.java

public FastHashMapImpl() {
    log.debug(Messages.getString("FastHashMapImpl.creating_a_new_instance_of_fasthashmapimpl")); //$NON-NLS-1$
    c = new FastHashMap();
    ((FastHashMap) c).setFast(false);/* w w w. j  av  a2s. com*/
}

From source file:com.agimatec.validation.MetaBeanCache.java

public MetaBeanCache() {
    this.cacheById = new FastHashMap();
    cacheByClass = new FastHashMap();
    cacheByClass.setFast(true);
    cacheById.setFast(true);
}

From source file:com.octo.captcha.service.AbstractManageableCaptchaService.java

protected AbstractManageableCaptchaService(CaptchaStore captchaStore,
        com.octo.captcha.engine.CaptchaEngine captchaEngine, int minGuarantedStorageDelayInSeconds,
        int maxCaptchaStoreSize) {
    super(captchaStore, captchaEngine);

    this.setCaptchaStoreMaxSize(maxCaptchaStoreSize);
    this.setMinGuarantedStorageDelayInSeconds(minGuarantedStorageDelayInSeconds);
    this.setCaptchaStoreSizeBeforeGarbageCollection((int) Math.round(0.8 * maxCaptchaStoreSize));
    times = new FastHashMap();
}

From source file:net.jcreate.xkins.Context.java

/**
 * Devuelve los parmetros del contexto./*from   w w  w .j a  va 2s.c  o m*/
 * @return
 */
public Map getParameters() {
    if (this.parameters == null) {
        this.parameters = new FastHashMap();
    }

    return this.parameters;
}

From source file:com.agimatec.validation.xml.XMLMetaBeanInfos.java

private void initBeanLookup() {
    beanLookup = new FastHashMap();
    for (XMLMetaBean bean : beans) {
        beanLookup.put(bean.getId(), bean);
    }//from   w  w  w  . ja  v a  2  s  .c om
    ((FastHashMap) beanLookup).setFast(true);
}

From source file:com.agimatec.validation.xml.XMLMetaBeanInfos.java

private void initValidationLookup() throws Exception {
    validationLookup = new FastHashMap();
    for (XMLMetaValidator xv : validators) {
        if (xv.getJava() != null) {
            Validation validation = (Validation) ClassUtils.getClass(xv.getJava()).newInstance();
            xv.setValidation(validation);
            validationLookup.put(xv.getId(), xv);
        }//  ww  w. j  a  v a  2  s.  c  o m
    }
    ((FastHashMap) validationLookup).setFast(true);
}

From source file:jp.terasoluna.fw.validation.springmodules.SpringValidationErrorsTest.java

/**
 * testAddErrors01() <br>/* w w  w . j a v a2 s .  c  om*/
 * <br>
 * () <br>
 * C <br>
 * <br>
 * () bean:Object<br>
 * () field:Field<br>
 * field.getKey()="key"<br>
 * field.getMsg("name")="messageKey"<br>
 * field.getArg("name", 0)="arg0"<br>
 * field.getArg("name", 1)="arg1"<br>
 * field.getArg("name", 2)="arg2"<br>
 * field.getArg("name", 3)="arg3"<br>
 * () va:ValidationAction<br>
 * va.getName()="name"<br>
 * <br>
 * () rejectValue():??????<br>
 * fieldCode="key"<br>
 * errorCode="messageKey"<br>
 * args={<br>
 * MessageSourceResolvable{<br>
 * codes[0]={"arg0"}, arguments=null, defaultMessage="arg0"}, <br>
 * MessageSourceResolvable{<br>
 * codes[1]={"arg1"}, arguments=null, defaultMessage="arg1"}, <br>
 * MessageSourceResolvable{<br>
 * codes[2]={"arg2"}, arguments=null, defaultMessage="arg2"}, <br>
 * MessageSourceResolvable{<br>
 * codes[3]={"arg3"}, arguments=null, defaultMessage="arg3"}, <br>
 * }<br>
 * <br>
 * ?not null?? <br>
 * @throws Exception ?????
 */
@Test
public void testAddErrors01() throws Exception {
    // ??
    // bean
    Object bean = new Object();
    // field
    Field field = new Field();
    // field.getKey() : "key"
    field.setKey("key");

    // field.getMsg("name")?errorCode????
    FastHashMap hMsgs = new FastHashMap();
    Msg msg = new Msg();
    msg.setKey("messageKey");
    hMsgs.put("name", msg);
    ReflectionTestUtils.setField(field, "hMsgs", hMsgs);

    // Object[] args????
    @SuppressWarnings("rawtypes")
    Map[] args = new HashMap[4];

    // args[0]
    Arg arg = new Arg();
    arg.setKey("arg0");
    Map<String, Arg> hMap01 = new HashMap<String, Arg>();
    hMap01.put("name", arg);
    args[0] = hMap01;

    // args[1]
    arg = new Arg();
    arg.setKey("arg1");
    Map<String, Arg> hMap02 = new HashMap<String, Arg>();
    hMap02.put("name", arg);
    args[1] = hMap02;

    // args[2]
    arg = new Arg();
    arg.setKey("arg2");
    Map<String, Arg> hMap03 = new HashMap<String, Arg>();
    hMap03.put("name", arg);
    args[2] = hMap03;

    // args[3]
    arg = new Arg();
    arg.setKey("arg3");
    Map<String, Arg> hMap04 = new HashMap<String, Arg>();
    hMap04.put("name", arg);
    args[3] = hMap04;

    ReflectionTestUtils.setField(field, "args", args);

    // va
    ValidatorAction va = new ValidatorAction();

    // va.getName : "name"
    va.setName("name");

    // SpringValidationErrors?
    SpringValidationErrors validation = new SpringValidationErrors();

    // Errors? : ErrorsImpl01 - rejectValue???
    ErrorsImpl01 errors = new ErrorsImpl01();
    ReflectionTestUtils.setField(validation, "errors", errors);

    // 
    validation.addError(bean, field, va);

    // 
    ErrorsImpl01 assertErrors = (ErrorsImpl01) ReflectionTestUtils.getField(validation, "errors");
    // rejectValue?
    assertTrue(assertErrors.isRejectValue);

    // field?
    assertEquals("key", assertErrors.field);

    // errorCode?
    assertEquals("messageKey", assertErrors.errorCode);

    // assertSame(args, assertErrors.errorArgs);
    // errorArgs?
    Object[] objs = assertErrors.errorArgs;
    MessageSourceResolvable msr = null;
    for (int i = 0; i < objs.length; i++) {
        msr = (MessageSourceResolvable) objs[i];

        String[] strs = msr.getCodes();
        // codes[0] : "arg" + i
        assertEquals("arg" + i, strs[0]);
        // arguments : null
        assertNull(msr.getArguments());
        // defaultMessage : "arg" + i
        assertEquals("arg" + i, msr.getDefaultMessage());
    }

    // defaultMessage?
    assertEquals("messageKey", assertErrors.defaultMessage);
}

From source file:com.octo.captcha.service.AbstractManageableCaptchaService.java

/**
 * Empty the Store// w w w .  ja v a  2  s. c om
 */
public void emptyCaptchaStore() {
    //empty the store
    this.store.empty();
    //And the timestamps
    this.times = new FastHashMap();
}

From source file:net.jcreate.xkins.Skin.java

/**
 * @return/* w  w w.  j  a v a  2  s . c o m*/
 */
private Map getTemplatesModified() {
    if (templatesModified == null)
        templatesModified = new FastHashMap();
    return templatesModified;
}