Package java.util

Examples of java.util.EnumSet$EnumSetIterator


        rawCollection.add(EnumWithInnerClass.a);
        result = set.containsAll(rawCollection);
        assertFalse("Should return false", result); //$NON-NLS-1$

        EnumSet rawSet = EnumSet.noneOf(EnumFoo.class);
        result = set.containsAll(rawSet);
        assertTrue("Should contain empty set", result); //$NON-NLS-1$

        emptySet = EnumSet.noneOf(EmptyEnum.class);
        result = set.containsAll(emptySet);
View Full Code Here


  static public class EnumSetSerializer extends Serializer<EnumSet> {
    public void write (Kryo kryo, Output output, EnumSet object) {
      Serializer serializer;
      if (object.isEmpty()) {
        EnumSet tmp = EnumSet.complementOf(object);
        if (tmp.isEmpty()) throw new KryoException("An EnumSet must have a defined Enum to be serialized.");
        serializer = kryo.writeClass(output, tmp.iterator().next().getClass()).getSerializer();
      } else {
        serializer = kryo.writeClass(output, object.iterator().next().getClass()).getSerializer();
      }
      output.writeInt(object.size(), true);
      for (Object element : object)
View Full Code Here

        serializer.write(kryo, output, element);
    }

    public EnumSet read (Kryo kryo, Input input, Class<EnumSet> type) {
      Registration registration = kryo.readClass(input);
      EnumSet object = EnumSet.noneOf(registration.getType());
      Serializer serializer = registration.getSerializer();
      int length = input.readInt(true);
      for (int i = 0; i < length; i++)
        object.add(serializer.read(kryo, input, null));
      return object;
    }
View Full Code Here

     */
    public EnumTypeConverter(DatabaseMapping mapping, Class enumClass, boolean useOrdinalValues) {
        super(mapping);
        m_enumClassName = enumClass.getName();
        m_enumClass = enumClass;
        EnumSet theEnums = EnumSet.allOf(enumClass);
        Iterator<Enum> i = theEnums.iterator();
       
        while (i.hasNext()) {
            Enum theEnum = i.next();
           
            if (useOrdinalValues) {
View Full Code Here

     * List the names of the passed Enum as a comma separated String
     * @param clazz
     * @return
     */
    private String stringify(Class<? extends Enum> clazz) {
        EnumSet enumSet = EnumSet.allOf(clazz);
        StringBuilder b = new StringBuilder();
        Iterator iter = enumSet.iterator();
        while (iter.hasNext()) {
            Enum anEnum= (Enum) iter.next();
            b.append(anEnum.name());
            if (iter.hasNext()) {
                b.append(", ");
View Full Code Here

    public boolean canConvert(Class type) {
        return EnumSet.class.isAssignableFrom(type);
    }

    public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) {
        EnumSet set = (EnumSet) source;
        Class enumTypeForSet = (Class) Fields.read(typeField, set);
        writer.addAttribute(mapper.aliasForAttribute("enum-type"), mapper.serializedClass(enumTypeForSet));
        writer.setValue(joinEnumValues(set));
    }
View Full Code Here

        return result.toString();
    }

    public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
        Class enumTypeForSet = mapper.realClass(reader.getAttribute(mapper.aliasForAttribute("enum-type")));
        EnumSet set = EnumSet.noneOf(enumTypeForSet);
        String[] enumValues = reader.getValue().split(",");
        for (int i = 0; i < enumValues.length; i++) {
            String enumValue = enumValues[i];
            if(enumValue.length() > 0) {
                set.add(Enum.valueOf(enumTypeForSet, enumValue));
            }
        }
        return set;
    }
View Full Code Here

      T result = (T) convertedItems;
      return result;
    }
    else if (erased.isAssignableFrom(EnumSet.class))
    {
      EnumSet enumSet = EnumSet.noneOf((Class<? extends Enum>) componentType);
      for (Object item : convertedItems)
      {
        Enum<?> e;
        if (item instanceof Enum<?> == false)
        {
          Enum<?> tmp = Enum.valueOf((Class<? extends Enum>) erased, (String) item);
          e = tmp;
        }
        else
        {
          e = (Enum<?>) item;
        }
        enumSet.add(e);
      }
      return (T) enumSet;
    }
    else if (erased.isArray())
    {
View Full Code Here

        ListBoxItemBean itemAll = new ListBoxItemBean();
        itemAll.setName("ALL");
        itemAll.setValue("ALL");
        itemAll.setSelected("ALL".equals(statusType));
        statusTypeBean.addBean(itemAll);
        EnumSet allStatus = EnumSet.allOf(AccountRequest.Status.class);
        for (Iterator itr = allStatus.iterator(); itr.hasNext(); ) {
            AccountRequest.Status status = (AccountRequest.Status)itr.next();
            String name = status.toString();
            ListBoxItemBean item = new ListBoxItemBean();
            item.setName(name);
            item.setValue(name);
View Full Code Here

            }
        };

        dbModel.addPropertyChangeListener(mfPcl);
        PersonalListCellRenderer cr = new PersonalListCellRenderer();
        EnumSet cards = Enums.getCards();
        for (Object card : cards) {
            mainCardsLstModel.addElement((Cards) card);
        }

        mainCardsLst.setModel(mainCardsLstModel);
View Full Code Here

TOP

Related Classes of java.util.EnumSet$EnumSetIterator

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.