Package java.util

Examples of java.util.EnumSet$SerializationProxy


    /**
     * This method returns all valid algorithms for PolicyLevel.A.
     * @return An EnumSet with all valid algorithms.
     */
    public static EnumSet getAAlgorithms() {
        EnumSet aAlgorithms = EnumSet.noneOf(Algorithms.class);
        for (Algorithms val : Algorithms.values()) {
            if (val.getLevel() == PolicyLevel.A) {
                aAlgorithms.add(val);
            }
        }
        return aAlgorithms;
    }
View Full Code Here


    /**
     * This method returns all valid algorithms for PolicyLevel.C.
     * @return An EnumSet with all valid algorithms.
     */
    public static EnumSet getCAlgorithms() {
        EnumSet cAlgorithms = EnumSet.noneOf(Algorithms.class);
        for (Algorithms val : Algorithms.values()) {
            if (val.getLevel() == PolicyLevel.C) {
                cAlgorithms.add(val);
            }
        }
        return cAlgorithms;
    }
View Full Code Here

    /**
     * This method returns all valid algorithms for PolicyLevel.I.
     * @return An EnumSet with all valid algorithms.
     */
    public static EnumSet getIAlgorithms() {
        EnumSet iAlgorithms = EnumSet.noneOf(Algorithms.class);
        for (Algorithms val : Algorithms.values()) {
            if (val.getLevel() == PolicyLevel.I) {
                iAlgorithms.add(val);
            }
        }
        return iAlgorithms;
    }   
View Full Code Here

    public boolean canConvert(Class type) {
        return typeField != null && EnumSet.class.isAssignableFrom(type);
    }

    public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) {
        EnumSet set = (EnumSet) source;
        Class enumTypeForSet = (Class) Fields.read(typeField, set);
        String attributeName = mapper.aliasForSystemAttribute("enum-type");
        if (attributeName != null) {
            writer.addAttribute(attributeName, mapper.serializedClass(enumTypeForSet));
        }
View Full Code Here

        String attributeName = mapper.aliasForSystemAttribute("enum-type");
        if (attributeName == null) {
            throw new ConversionException("No EnumType specified for EnumSet");
        }
        Class enumTypeForSet = mapper.realClass(reader.getAttribute(attributeName));
        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

        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

        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

        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

TOP

Related Classes of java.util.EnumSet$SerializationProxy

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.