/*******************************************************************************
- * Copyright (c) 2007, 2011 Association for Decentralized Information Management in
+ * Copyright (c) 2007, 2018 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
*
* Contributors:
* VTT Technical Research Centre of Finland - initial API and implementation
+ * Semantum Oy - gitlab #82
*******************************************************************************/
package org.simantics.databoard.binding.factory;
import org.simantics.databoard.binding.Binding;
import org.simantics.databoard.binding.reflection.BindingRequest;
+import org.simantics.databoard.type.Datatype;
public class BindingRepository {
classMap.clear();
}
+ /**
+ * {@link Datatype} class has annotations but it can be considered a "class
+ * request" as it is a fundamental building block of Databoard and it has a
+ * fixed structure. Therefore {@link #classMap} is allowed to contain a cached
+ * Datatype.class -> Binding mapping.
+ */
+ private static final String DATATYPE_CLASS_NAME = Datatype.class.getName();
+
boolean isClassRequest( BindingRequest request )
{
- return request.className != null && (request.annotations==null || request.annotations.length==0);
+ return (request.className != null
+ && ((request.annotations==null || request.annotations.length==0)
+ || DATATYPE_CLASS_NAME.equals(request.className))
+ );
}
}