Java Code Examples for java.util.EnumSet#isEmpty()

The following examples show how to use java.util.EnumSet#isEmpty() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
public void setString(String s, String cf) throws InvalidDLNAProtocolAttributeException {
    EnumSet<DLNAFlags> value = EnumSet.noneOf(DLNAFlags.class);
    try {
        int parseInt = Integer.parseInt(s.substring(0, s.length() - 24), 16);
        for (DLNAFlags op : DLNAFlags.values()) {
            int code = op.getCode() & parseInt;
            if (op.getCode() == code) {
                value.add(op);
            }
        }
    } catch (Exception e) {
    }

    if (value.isEmpty())
        throw new InvalidDLNAProtocolAttributeException("Can't parse DLNA flags integer from: " + s);

    setValue(value);
}
 
Example 2
Source Project: j2objc   File: TimeZoneGenericNames.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Returns a collection of time zone display name matches for the specified types in the
 * given text at the given offset. This method only finds matches from the TimeZoneNames
 * used by this object.
 * @param text the text
 * @param start the start offset in the text
 * @param types the set of name types.
 * @return A collection of match info.
 */
private Collection<MatchInfo> findTimeZoneNames(String text, int start, EnumSet<GenericNameType> types) {
    Collection<MatchInfo> tznamesMatches = null;

    // Check if the target name type is really in the TimeZoneNames
    EnumSet<NameType> nameTypes = EnumSet.noneOf(NameType.class);
    if (types.contains(GenericNameType.LONG)) {
        nameTypes.add(NameType.LONG_GENERIC);
        nameTypes.add(NameType.LONG_STANDARD);
    }
    if (types.contains(GenericNameType.SHORT)) {
        nameTypes.add(NameType.SHORT_GENERIC);
        nameTypes.add(NameType.SHORT_STANDARD);
    }

    if (!nameTypes.isEmpty()) {
        // Find matches in the TimeZoneNames
        tznamesMatches = _tznames.find(text, start, nameTypes);
    }
    return tznamesMatches;
}
 
Example 3
Source Project: ehcache3   File: EventListenerWrapper.java    License: Apache License 2.0 6 votes vote down vote up
public EventListenerWrapper(CacheEventListener<? super K, ? super V> listener, final EventFiring firing, final EventOrdering ordering,
                     final EnumSet<EventType> forEvents) {
  if (listener == null) {
    throw new NullPointerException("listener cannot be null");
  }
  if (firing == null) {
    throw new NullPointerException("firing cannot be null");
  }
  if (ordering == null) {
    throw new NullPointerException("ordering cannot be null");
  }
  if (forEvents == null) {
    throw new NullPointerException("forEvents cannot be null");
  }
  if (forEvents.isEmpty()) {
    throw new IllegalArgumentException("forEvents cannot be empty");
  }
  this.listener = listener;
  this.firing = firing;
  this.ordering = ordering;
  this.forEvents = forEvents;
}
 
Example 4
public int getWeakPower(BlockFace side) {
    if (!this.canProvidePower) {
        return 0;
    } else {
        int power = this.getDamage();

        if (power == 0) {
            return 0;
        } else if (side == BlockFace.UP) {
            return power;
        } else {
            EnumSet<BlockFace> enumset = EnumSet.noneOf(BlockFace.class);

            for (BlockFace face : Plane.HORIZONTAL) {
                if (this.isPowerSourceAt(face)) {
                    enumset.add(face);
                }
            }

            if (side.getAxis().isHorizontal() && enumset.isEmpty()) {
                return power;
            } else if (enumset.contains(side) && !enumset.contains(side.rotateYCCW()) && !enumset.contains(side.rotateY())) {
                return power;
            } else {
                return 0;
            }
        }
    }
}
 
Example 5
public static Set<OperationEntry.Flag> immutableSetOf(EnumSet<OperationEntry.Flag> flags) {
    if (flags == null || flags.isEmpty()) {
        return Collections.emptySet();
    }
    Set<Flag> result = flagSets.get(flags);
    if (result == null) {
        Set<Flag> immutable = Collections.unmodifiableSet(flags);
        Set<Flag> existing = flagSets.putIfAbsent(flags, immutable);
        result = existing == null ? immutable : existing;
    }

    return result;
}
 
Example 6
Source Project: big-c   File: EnumSetParam.java    License: Apache License 2.0 5 votes vote down vote up
/** Convert an EnumSet to a string of comma separated values. */
public static <E extends Enum<E>> String toString(EnumSet<E> set) {
  if (set == null || set.isEmpty()) {
    return "";
  } else {
    final StringBuilder b = new StringBuilder();
    final Iterator<E> i = set.iterator();
    b.append(i.next());
    while (i.hasNext()) {
      b.append(',').append(i.next());
    }
    return b.toString();
  }
}
 
Example 7
@Override
public long addCacheDirective(CacheDirectiveInfo directive,
    EnumSet<CacheFlag> flags) throws IOException {
  try {
    AddCacheDirectiveRequestProto.Builder builder =
        AddCacheDirectiveRequestProto.newBuilder().
            setInfo(PBHelper.convert(directive));
    if (!flags.isEmpty()) {
      builder.setCacheFlags(PBHelper.convertCacheFlags(flags));
    }
    return rpcProxy.addCacheDirective(null, builder.build()).getId();
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
 
Example 8
Source Project: WearableBackpacks   File: GuiScrollable.java    License: MIT License 5 votes vote down vote up
public GuiScrollable(EnumSet<Direction> directions) {
	if (directions.isEmpty()) throw new IllegalArgumentException(
		"Argument 'directions' must be at least one Direction");
	this.directions = directions;
	for (Direction direction : directions) {
		GuiScrollbar scrollbar = new GuiScrollbar(direction);
		if (direction == Direction.HORIZONTAL)
			_scrollbarHor = scrollbar; else _scrollbarVer = scrollbar;
		add(scrollbar);
	}
}
 
Example 9
@Override
public EnumSet<Change> save(PhpModule phpModule) {
    EnumSet<Change> changes = EnumSet.noneOf(Change.class);
    saveEnabled(changes);
    saveAppDir(changes);
    saveCacheIgnored(changes);
    if (changes.isEmpty()) {
        return null;
    }
    return changes;
}
 
Example 10
Source Project: activemq-artemis   File: AddressInfo.java    License: Apache License 2.0 5 votes vote down vote up
public AddressInfo setRoutingTypes(final EnumSet<RoutingType> routingTypes) {
   this.routingTypes = routingTypes;
   if (routingTypes != null && !routingTypes.isEmpty()) {
      this.firstSeen = routingTypes.iterator().next();
   } else {
      this.firstSeen = null;
   }
   return this;
}
 
Example 11
private void parseRemoteDestinationOutboundSocketBinding(final XMLExtendedStreamReader reader,
        final ModelNode outboundSocketBindingAddOperation) throws XMLStreamException {

    final EnumSet<Attribute> required = EnumSet.of(Attribute.HOST, Attribute.PORT);

    // Handle attributes
    final int count = reader.getAttributeCount();
    for (int i = 0; i < count; i++) {
        final String value = reader.getAttributeValue(i);
        if (!isNoNamespaceAttribute(reader, i)) {
            throw unexpectedAttribute(reader, i);
        } else {
            final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
            required.remove(attribute);
            switch (attribute) {
                case HOST: {
                    RemoteDestinationOutboundSocketBindingResourceDefinition.HOST.parseAndSetParameter(value,
                            outboundSocketBindingAddOperation, reader);
                    break;
                }
                case PORT: {
                    RemoteDestinationOutboundSocketBindingResourceDefinition.PORT.parseAndSetParameter(value,
                            outboundSocketBindingAddOperation, reader);
                    break;
                }
                default:
                    throw unexpectedAttribute(reader, i);
            }
        }
    }

    if (!required.isEmpty()) {
        throw missingRequired(reader, required);
    }
    // Handle elements
    requireNoContent(reader);
}
 
Example 12
Source Project: lams   File: SchemaUpdate.java    License: GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public void execute(EnumSet<TargetType> targetTypes, Metadata metadata, ServiceRegistry serviceRegistry) {
	if ( targetTypes.isEmpty() ) {
		LOG.debug( "Skipping SchemaExport as no targets were specified" );
		return;
	}

	exceptions.clear();
	LOG.runningHbm2ddlSchemaUpdate();

	Map config = new HashMap();
	config.putAll( serviceRegistry.getService( ConfigurationService.class ).getSettings() );
	config.put( AvailableSettings.HBM2DDL_DELIMITER, delimiter );
	config.put( AvailableSettings.FORMAT_SQL, format );

	final SchemaManagementTool tool = serviceRegistry.getService( SchemaManagementTool.class );

	final ExceptionHandler exceptionHandler = haltOnError
			? ExceptionHandlerHaltImpl.INSTANCE
			: new ExceptionHandlerCollectingImpl();

	final ExecutionOptions executionOptions = SchemaManagementToolCoordinator.buildExecutionOptions(
			config,
			exceptionHandler
	);

	final TargetDescriptor targetDescriptor = SchemaExport.buildTargetDescriptor( targetTypes, outputFile, serviceRegistry );

	try {
		tool.getSchemaMigrator( config ).doMigration( metadata, executionOptions, targetDescriptor );
	}
	finally {
		if ( exceptionHandler instanceof ExceptionHandlerCollectingImpl ) {
			exceptions.addAll( ( (ExceptionHandlerCollectingImpl) exceptionHandler ).getExceptions() );
		}
	}
}
 
Example 13
public final void setInformationModel(InformationModel model, String[] tss, EnumSet<QueryOption> queryOptions) {
    this.model = model;
    rq.addPresentationContext(new PresentationContext(1, model.cuid, tss));
    if (!queryOptions.isEmpty()) {
        model.adjustQueryOptions(queryOptions);
        rq.addExtendedNegotiation(
            new ExtendedNegotiation(model.cuid, QueryOption.toExtendedNegotiationInformation(queryOptions)));
    }
    if (model.level != null) {
        addLevel(model.level);
    }
}
 
Example 14
@Override
public long addCacheDirective(CacheDirectiveInfo directive,
    EnumSet<CacheFlag> flags) throws IOException {
  try {
    AddCacheDirectiveRequestProto.Builder builder =
        AddCacheDirectiveRequestProto.newBuilder().
            setInfo(PBHelper.convert(directive));
    if (!flags.isEmpty()) {
      builder.setCacheFlags(PBHelper.convertCacheFlags(flags));
    }
    return rpcProxy.addCacheDirective(null, builder.build()).getId();
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
 
Example 15
private static PermissionFactory parsePermission(final XMLStreamReader reader, final ModuleLoader loader, final ModuleIdentifier identifier)
        throws XMLStreamException {

    // permission element has no attributes.
    requireNoAttributes(reader);

    String permissionClass = null;
    String permissionName = null;
    String permissionActions = null;

    EnumSet<Element> requiredElements = EnumSet.of(Element.CLASS_NAME);
    while (reader.hasNext()) {
        switch (reader.nextTag()) {
            case XMLStreamConstants.END_ELEMENT: {
                // check if all required permission elements have been processed.
                if (!requiredElements.isEmpty())
                    throw missingRequiredElement(reader, requiredElements);

                // build a permission and add it to the list.
                PermissionFactory factory = new ModularPermissionFactory(loader, identifier, permissionClass,
                        permissionName, permissionActions);
                return factory;
            }
            case XMLStreamConstants.START_ELEMENT: {
                Element element = Element.forName(reader.getLocalName());
                requiredElements.remove(element);
                switch (element) {
                    case CLASS_NAME: {
                        requireNoAttributes(reader);
                        permissionClass = reader.getElementText();
                        break;
                    }
                    case NAME: {
                        requireNoAttributes(reader);
                        permissionName = reader.getElementText();
                        break;
                    }
                    case ACTIONS: {
                        requireNoAttributes(reader);
                        permissionActions = reader.getElementText();
                        break;
                    }
                    default: {
                        throw unexpectedElement(reader);
                    }
                }
                break;
            }
            default: {
                throw unexpectedContent(reader);
            }
        }
    }
    throw unexpectedEndOfDocument(reader);
}
 
Example 16
Source Project: jdk8u60   File: Type.java    License: GNU General Public License v2.0 4 votes vote down vote up
/** replace types in all bounds - this might trigger listener notification */
public void substBounds(List<Type> from, List<Type> to, Types types) {
    List<Type> instVars = from.diff(to);
    //if set of instantiated ivars is empty, there's nothing to do!
    if (instVars.isEmpty()) return;
    final EnumSet<InferenceBound> boundsChanged = EnumSet.noneOf(InferenceBound.class);
    UndetVarListener prevListener = listener;
    try {
        //setup new listener for keeping track of changed bounds
        listener = new UndetVarListener() {
            public void varChanged(UndetVar uv, Set<InferenceBound> ibs) {
                boundsChanged.addAll(ibs);
            }
        };
        for (Map.Entry<InferenceBound, List<Type>> _entry : bounds.entrySet()) {
            InferenceBound ib = _entry.getKey();
            List<Type> prevBounds = _entry.getValue();
            ListBuffer<Type> newBounds = new ListBuffer<>();
            ListBuffer<Type> deps = new ListBuffer<>();
            //step 1 - re-add bounds that are not dependent on ivars
            for (Type t : prevBounds) {
                if (!t.containsAny(instVars)) {
                    newBounds.append(t);
                } else {
                    deps.append(t);
                }
            }
            //step 2 - replace bounds
            bounds.put(ib, newBounds.toList());
            //step 3 - for each dependency, add new replaced bound
            for (Type dep : deps) {
                addBound(ib, types.subst(dep, from, to), types, true);
            }
        }
    } finally {
        listener = prevListener;
        if (!boundsChanged.isEmpty()) {
            notifyChange(boundsChanged);
        }
    }
}
 
Example 17
@Override
void parseLoggingProfileElement(final XMLExtendedStreamReader reader, final List<ModelNode> operations, final Set<String> profileNames) throws XMLStreamException {
    // Attributes
    String name = null;
    final EnumSet<Attribute> required = EnumSet.of(Attribute.NAME);
    final int count = reader.getAttributeCount();
    for (int i = 0; i < count; i++) {
        requireNoNamespaceAttribute(reader, i);
        final String value = reader.getAttributeValue(i);
        final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
        required.remove(attribute);
        switch (attribute) {
            case NAME: {
                name = value;
                break;
            }
            default:
                throw unexpectedAttribute(reader, i);
        }
    }
    if (!required.isEmpty()) {
        throw missingRequired(reader, required);
    }
    if (!profileNames.add(name)) {
        throw duplicateNamedElement(reader, name);
    }
    // Setup the address
    final PathAddress profileAddress = SUBSYSTEM_ADDRESS.append(LOGGING_PROFILE, name);
    operations.add(Util.createAddOperation(profileAddress));

    final List<ModelNode> loggerOperations = new ArrayList<>();
    final List<ModelNode> asyncHandlerOperations = new ArrayList<>();
    final List<ModelNode> handlerOperations = new ArrayList<>();
    final List<ModelNode> formatterOperations = new ArrayList<>();

    final Set<String> loggerNames = new HashSet<>();
    final Set<String> handlerNames = new HashSet<>();
    final Set<String> formatterNames = new HashSet<>();
    boolean gotRoot = false;
    while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
        final Element element = Element.forName(reader.getLocalName());
        switch (element) {
            case LOGGER: {
                parseLoggerElement(reader, profileAddress, loggerOperations, loggerNames);
                break;
            }
            case ROOT_LOGGER: {
                if (gotRoot) {
                    throw unexpectedElement(reader);
                }
                gotRoot = true;
                parseRootLoggerElement(reader, profileAddress, loggerOperations);
                break;
            }
            case CONSOLE_HANDLER: {
                parseConsoleHandlerElement(reader, profileAddress, handlerOperations, handlerNames);
                break;
            }
            case FILE_HANDLER: {
                parseFileHandlerElement(reader, profileAddress, handlerOperations, handlerNames);
                break;
            }
            case CUSTOM_HANDLER: {
                parseCustomHandlerElement(reader, profileAddress, handlerOperations, handlerNames);
                break;
            }
            case PERIODIC_ROTATING_FILE_HANDLER: {
                parsePeriodicRotatingFileHandlerElement(reader, profileAddress, handlerOperations, handlerNames);
                break;
            }
            case PERIODIC_SIZE_ROTATING_FILE_HANDLER: {
                parsePeriodicSizeRotatingHandlerElement(reader, profileAddress, handlerOperations, handlerNames);
                break;
            }
            case SIZE_ROTATING_FILE_HANDLER: {
                parseSizeRotatingHandlerElement(reader, profileAddress, handlerOperations, handlerNames);
                break;
            }
            case ASYNC_HANDLER: {
                parseAsyncHandlerElement(reader, profileAddress, asyncHandlerOperations, handlerNames);
                break;
            }
            case SYSLOG_HANDLER: {
                parseSyslogHandler(reader, profileAddress, handlerOperations, handlerNames);
                break;
            }
            case FORMATTER: {
                parseFormatter(reader, profileAddress, formatterOperations, formatterNames);
                break;
            }
            default: {
                reader.handleAny(operations);
                break;
            }
        }
    }
    operations.addAll(formatterOperations);
    operations.addAll(handlerOperations);
    operations.addAll(asyncHandlerOperations);
    operations.addAll(loggerOperations);
}
 
Example 18
@Override
void parseLoggingProfileElement(final XMLExtendedStreamReader reader, final List<ModelNode> operations, final Set<String> profileNames) throws XMLStreamException {
    // Attributes
    String name = null;
    final EnumSet<Attribute> required = EnumSet.of(Attribute.NAME);
    final int count = reader.getAttributeCount();
    for (int i = 0; i < count; i++) {
        requireNoNamespaceAttribute(reader, i);
        final String value = reader.getAttributeValue(i);
        final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
        required.remove(attribute);
        switch (attribute) {
            case NAME: {
                name = value;
                break;
            }
            default:
                throw unexpectedAttribute(reader, i);
        }
    }
    if (!required.isEmpty()) {
        throw missingRequired(reader, required);
    }
    if (!profileNames.add(name)) {
        throw duplicateNamedElement(reader, name);
    }
    // Setup the address
    final PathAddress profileAddress = SUBSYSTEM_ADDRESS.append(LOGGING_PROFILE, name);
    operations.add(Util.createAddOperation(profileAddress));

    final List<ModelNode> loggerOperations = new ArrayList<>();
    final List<ModelNode> asyncHandlerOperations = new ArrayList<>();
    final List<ModelNode> handlerOperations = new ArrayList<>();
    final List<ModelNode> formatterOperations = new ArrayList<>();

    final Set<String> loggerNames = new HashSet<>();
    final Set<String> handlerNames = new HashSet<>();
    final Set<String> formatterNames = new HashSet<>();
    boolean gotRoot = false;
    while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
        final Element element = Element.forName(reader.getLocalName());
        switch (element) {
            case LOGGER: {
                parseLoggerElement(reader, profileAddress, loggerOperations, loggerNames);
                break;
            }
            case ROOT_LOGGER: {
                if (gotRoot) {
                    throw unexpectedElement(reader);
                }
                gotRoot = true;
                parseRootLoggerElement(reader, profileAddress, loggerOperations);
                break;
            }
            case CONSOLE_HANDLER: {
                parseConsoleHandlerElement(reader, profileAddress, handlerOperations, handlerNames);
                break;
            }
            case FILE_HANDLER: {
                parseFileHandlerElement(reader, profileAddress, handlerOperations, handlerNames);
                break;
            }
            case CUSTOM_HANDLER: {
                parseCustomHandlerElement(reader, profileAddress, handlerOperations, handlerNames);
                break;
            }
            case PERIODIC_ROTATING_FILE_HANDLER: {
                parsePeriodicRotatingFileHandlerElement(reader, profileAddress, handlerOperations, handlerNames);
                break;
            }
            case SIZE_ROTATING_FILE_HANDLER: {
                parseSizeRotatingHandlerElement(reader, profileAddress, handlerOperations, handlerNames);
                break;
            }
            case ASYNC_HANDLER: {
                parseAsyncHandlerElement(reader, profileAddress, asyncHandlerOperations, handlerNames);
                break;
            }
            case SYSLOG_HANDLER: {
                parseSyslogHandler(reader, profileAddress, handlerOperations, handlerNames);
                break;
            }
            case FORMATTER: {
                parseFormatter(reader, profileAddress, formatterOperations, formatterNames);
                break;
            }
            default: {
                reader.handleAny(operations);
                break;
            }
        }
    }
    operations.addAll(formatterOperations);
    operations.addAll(handlerOperations);
    operations.addAll(asyncHandlerOperations);
    operations.addAll(loggerOperations);
}
 
Example 19
private static List<PermissionFactory> parsePermissions(final XMLStreamReader reader, final ModuleLoader loader, final ModuleIdentifier identifier)
        throws XMLStreamException {

    List<PermissionFactory> factories = new ArrayList<PermissionFactory>();

    // parse the permissions attributes.
    EnumSet<Attribute> requiredAttributes = EnumSet.of(Attribute.VERSION);
    for (int i = 0; i < reader.getAttributeCount(); i++) {
        final String attributeNamespace = reader.getAttributeNamespace(i);
        if (attributeNamespace != null && !attributeNamespace.isEmpty()) {
            continue;
        }
        Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
        switch (attribute) {
            case VERSION: {
                String version = reader.getAttributeValue(i);
                if (!"7".equals(version))
                    throw SecurityManagerLogger.ROOT_LOGGER.invalidPermissionsXMLVersion(version, "7");
                break;
            }
            default: {
                throw unexpectedAttribute(reader, i);
            }
        }
        requiredAttributes.remove(attribute);
    }

    // check if all required attributes were parsed.
    if (!requiredAttributes.isEmpty())
        throw missingRequiredAttributes(reader, requiredAttributes);

    // parse the permissions sub-elements.
    while (reader.hasNext()) {
        switch (reader.nextTag()) {
            case XMLStreamConstants.END_ELEMENT: {
                return factories;
            }
            case XMLStreamConstants.START_ELEMENT: {
                Element element = Element.forName(reader.getLocalName());
                switch (element) {
                    case PERMISSION: {
                        PermissionFactory factory = parsePermission(reader, loader, identifier);
                        factories.add(factory);
                        break;
                    }
                    default: {
                        throw unexpectedElement(reader);
                    }
                }
                break;
            }
            default: {
                throw unexpectedContent(reader);
            }
        }
    }
    throw unexpectedEndOfDocument(reader);
}
 
Example 20
@Override
void parsePeriodicRotatingFileHandlerElement(final XMLExtendedStreamReader reader, final PathAddress address, final List<ModelNode> operations, final Set<String> names) throws XMLStreamException {
    final ModelNode operation = Util.createAddOperation();
    // Attributes
    String name = null;
    final EnumSet<Attribute> required = EnumSet.of(Attribute.NAME);
    final int count = reader.getAttributeCount();
    for (int i = 0; i < count; i++) {
        requireNoNamespaceAttribute(reader, i);
        final String value = reader.getAttributeValue(i);
        final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
        required.remove(attribute);
        switch (attribute) {
            case NAME: {
                name = value;
                break;
            }
            case AUTOFLUSH: {
                AUTOFLUSH.parseAndSetParameter(value, operation, reader);
                break;
            }
            case ENABLED: {
                ENABLED.parseAndSetParameter(value, operation, reader);
                break;
            }
            default:
                throw unexpectedAttribute(reader, i);
        }
    }
    if (!required.isEmpty()) {
        throw missingRequired(reader, required);
    }
    if (!names.add(name)) {
        throw duplicateNamedElement(reader, name);
    }

    // Setup the operation address
    addOperationAddress(operation, address, PeriodicHandlerResourceDefinition.NAME, name);

    final EnumSet<Element> requiredElem = EnumSet.of(Element.FILE, Element.SUFFIX);
    final EnumSet<Element> encountered = EnumSet.noneOf(Element.class);
    while (reader.nextTag() != END_ELEMENT) {
        final Element element = Element.forName(reader.getLocalName());
        if (!encountered.add(element)) {
            throw unexpectedElement(reader);
        }
        requiredElem.remove(element);
        switch (element) {
            case LEVEL: {
                LEVEL.parseAndSetParameter(readNameAttribute(reader), operation, reader);
                break;
            }
            case ENCODING: {
                ENCODING.parseAndSetParameter(readValueAttribute(reader), operation, reader);
                break;
            }
            case FILTER_SPEC: {
                PeriodicHandlerResourceDefinition.FILTER_SPEC.parseAndSetParameter(readValueAttribute(reader), operation, reader);
                break;
            }
            case FORMATTER: {
                parseHandlerFormatterElement(reader, operation);
                break;
            }
            case FILE: {
                parseFileElement(operation.get(FILE.getName()), reader);
                break;
            }
            case APPEND: {
                APPEND.parseAndSetParameter(readValueAttribute(reader), operation, reader);
                break;
            }
            case SUFFIX: {
                SUFFIX.parseAndSetParameter(readValueAttribute(reader), operation, reader);
                break;
            }
            default: {
                throw unexpectedElement(reader);
            }
        }
    }
    if (!requiredElem.isEmpty()) {
        throw missingRequired(reader, requiredElem);
    }
    operations.add(operation);
}