/******************************************************************************* * Copyright (c) 2010 Association for Decentralized Information Management in * Industry THTH ry. * 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: * VTT Technical Research Centre of Finland - initial API and implementation *******************************************************************************/ package org.simantics.databoard.binding.reflection; import org.simantics.databoard.binding.Binding; import org.simantics.databoard.binding.UnionBinding; import org.simantics.databoard.binding.error.BindingException; import org.simantics.databoard.type.UnionType; /** * This class binds a java Enum-class with DataBoard's UnionType. * * * @author Toni Kalajainen */ public class EnumClassBinding extends UnionBinding { Class> clazz; Enum[] tags; public EnumClassBinding(UnionType type, Class> clazz) { this.type = type; this.tags = clazz.getEnumConstants(); this.clazz = clazz; componentBindings = new Binding[ tags.length ]; for (int i=0; i