Package java.util

Examples of java.util.Map


  @SuppressWarnings("unchecked")
  @Test
  public void testGetConverterNone() throws Exception
  {
    BindConvertInfo info = createStrictMock(BindConvertInfo.class);
    Map converterMap = createStrictMock(Map.class);
    Converter converter = createStrictMock(Converter.class);

    ValidationAnnotationReader reader = new ValidationAnnotationReader();

    expect(info.getConverterMap()).andReturn(converterMap);
    expect(converterMap.get("prop")).andReturn(converter);

    replay(info);
    replay(converterMap);

    assert converter == reader.getConverter(this.getClass(), "prop", info);
View Full Code Here


    Action action = null;

    ModuleConfig moduleConfig = actionConfig.getModuleConfig();
    String actionsKey = Constants.ACTIONS_KEY + moduleConfig.getPrefix();
   
    final Map applicationScope = context.getApplicationScope();
   
    Map<String, Action> actions = (Map<String, Action>) applicationScope.get(actionsKey);

    if (actions == null)
    {
      actions = new HashMap<String, Action>();
      applicationScope.put(actionsKey, actions);
    }

    boolean isNew = false;

    synchronized (actions)
View Full Code Here

            return;
        }

        Set<String> identifiers = analysis.getBoundIdentifiers().getGlobals().keySet();

        final Map map = createVariableContext( className,
                                               actionDescr.getText(),
                                               (ProcessBuildContext) context,
                                               (String[]) identifiers.toArray( new String[identifiers.size()] ),
                                               analysis.getNotBoundedIdentifiers(),
                                               contextResolver);
        map.put( "text",
                 ProcessKnowledgeHelperFixer.fix( actionDescr.getText() ));

        generatTemplates( "actionMethod",
                          "actionInvoker",
                          (ProcessBuildContext)context,
View Full Code Here

    }

    public void fillSimpleDataPool() {
        Map<Long, Object> lDao = simpleDaos.get(Location.class);
        Map<Long, Object> eDao = simpleDaos.get(Event.class);
        Map pDao = simpleDaos.get(Person.class);
        long pCounter = 0;
        long eCounter = 0;
        for (Person p : students.values()) {
            pDao.put(pCounter++, p);
        }
        for (Person p : teachers.values()) {
            pDao.put(pCounter++, p);
        }
        for (long i = 0; i < 20; i++) {
            Location loc = new Location("Raum " + i, 40);
            lDao.put(i, loc);
        }
View Full Code Here

    public Map createVariableContext(final String className,
                                     final String text,
                                     final ProcessBuildContext context,
                                     final String[] globals) {
        final Map map = new HashMap();

        map.put("methodName",
                className);

        map.put("package",
                context.getPkg().getName());

        map.put("processClassName",
                StringUtils.ucFirst(context.getProcessDescr().getClassName()));

        map.put("invokerClassName",
                context.getProcessDescr().getClassName() + StringUtils.ucFirst(className) + "Invoker");

        if (text != null) {
            map.put("text",
                    text);

            map.put("hashCode",
                    new Integer(text.hashCode()));
        }

        final List globalTypes = new ArrayList(globals.length);
        for (int i = 0, length = globals.length; i < length; i++) {
            globalTypes.add(context.getPkg().getGlobals().get(globals[i]).replace('$',
                    '.'));
        }

        map.put("globals",
                globals);

        map.put("globalTypes",
                globalTypes);

        return map;
    }
View Full Code Here

            final String text,
            final ProcessBuildContext context,
            final String[] globals,
            final Set<String> unboundIdentifiers,
            final ContextResolver contextResolver) {
      Map map = createVariableContext(className, text, context, globals);
      List<String> variables = new ArrayList<String>();
      final List variableTypes = new ArrayList(globals.length);
        for (String variableName: unboundIdentifiers) {
          VariableScope variableScope = (VariableScope) contextResolver.resolveContext(VariableScope.VARIABLE_SCOPE, variableName);
          if (variableScope != null) {
            variables.add(variableName);
            variableTypes.add(variableScope.findVariable(variableName).getType().getStringType());
          }
        }

        map.put("variables",
                variables);

        map.put("variableTypes",
                variableTypes);
      return map;
    }
View Full Code Here

            return;
        }

        Set<String> identifiers = analysis.getBoundIdentifiers().getGlobals().keySet();

        final Map map = createVariableContext( className,
                                               descr.getText(),
                                               (ProcessBuildContext) context,
                                               (String[]) identifiers.toArray( new String[identifiers.size()] ),
                                               analysis.getNotBoundedIdentifiers(),
                                               contextResolver);
        map.put( "text",
                 descr.getText() );

        generatTemplates( "returnValueEvaluatorMethod",
                          "returnValueEvaluatorInvoker",
                          (ProcessBuildContext)context,
View Full Code Here

        if (parsing == null) {
            if (Person.class.isAssignableFrom(obj.getClass())) {
                if ("constraints".equals(element.getName())) {
                    return (T) readConstraints(element);
                } else if ("eventsMap".equals(element.getName())) {
                    Map map = FastMap.newInstance();
                    for (Object evEl : element.elements()) {
                        Element evElement = (Element) evEl;
                        long ref = getRef(evElement);
                        Role role = Role.valueOf(evElement.attributeValue("role"));
                        map.put(getObject(ref, Event.class), role);
                    }
                    return (T) map;
                }
            } else if (Event.class.isAssignableFrom(obj.getClass())) {
                if ("constraints".equals(element.getName())) {
View Full Code Here

    context = new ClassPathXmlApplicationContext("applicationContext.xml");
  }

  @Test
  public void testCreation() {
    Map map = context.getBeansOfType(Mapper.class);
    assertFalse(map.isEmpty());
    Object bean = map.values().iterator().next();
    assertTrue(bean instanceof DozerBeanMapper);

    DozerBeanMapper mapper = (DozerBeanMapper) bean;
    assertFalse(mapper.getMappingFiles().isEmpty());
  }
View Full Code Here

  @Test
  public void testSimpleReverse() {
    A source = new A();
    source.setB(new B());
    Map dest = mapper.map(source, HashMap.class, NULL);
    assertNotNull(dest);
    assertTrue(dest.containsKey("key"));
    assertNotNull(dest.get("key"));
  }
View Full Code Here

TOP

Related Classes of java.util.Map

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.