diff options
Diffstat (limited to 'plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/properties/Properties.java')
-rw-r--r-- | plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/properties/Properties.java | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/properties/Properties.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/properties/Properties.java new file mode 100644 index 0000000000..10e80333f6 --- /dev/null +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/properties/Properties.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + */ +package org.eclipse.net4j.util.properties; + +import org.eclipse.net4j.util.CheckUtil; + +import java.util.ArrayList; +import java.util.List; + +/** + * Contains a list of {@link Property properties}. + * + * @author Eike Stepper + * @since 3.2 + */ +public class Properties<RECEIVER> implements IProperties<RECEIVER> +{ + private List<Property<RECEIVER>> properties = new ArrayList<Property<RECEIVER>>(); + + public Properties() + { + } + + public final void add(Property<RECEIVER> property) + { + CheckUtil.checkArg(property, "property"); + CheckUtil.checkArg(property.getName(), "property.getName()"); + properties.add(property); + } + + public final List<Property<RECEIVER>> getProperties() + { + return properties; + } + + public final Property<RECEIVER> getProperty(String name) + { + for (Property<RECEIVER> property : properties) + { + if (property.getName().equals(name)) + { + return property; + } + } + + return null; + } +} |