X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.db.services%2Fsrc%2Forg%2Fsimantics%2Fdb%2Fservices%2Fadaption%2Freflection%2FConstantAdapter.java;h=612ec04baaac9de0f1d795540784f2430b851383;hb=refs%2Fchanges%2F15%2F3115%2F4;hp=17fce001dd50d1b92dd8aeb2db2ba1e316e8aa12;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.db.services/src/org/simantics/db/services/adaption/reflection/ConstantAdapter.java b/bundles/org.simantics.db.services/src/org/simantics/db/services/adaption/reflection/ConstantAdapter.java index 17fce001d..612ec04ba 100644 --- a/bundles/org.simantics.db.services/src/org/simantics/db/services/adaption/reflection/ConstantAdapter.java +++ b/bundles/org.simantics.db.services/src/org/simantics/db/services/adaption/reflection/ConstantAdapter.java @@ -1,41 +1,41 @@ -/******************************************************************************* - * Copyright (c) 2007, 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.db.services.adaption.reflection; - -import org.simantics.db.Resource; -import org.simantics.db.ReadGraph; - -public class ConstantAdapter implements IDynamicAdapter2 { - - Object obj; - Class clazz; - - public ConstantAdapter(Class clazz, Object obj) { - this.clazz = clazz; - this.obj = obj; - } - - public ConstantAdapter(Object obj) { - this(obj.getClass(), obj); - } - - @Override - public Class getType() { - return clazz; - } - - @Override - public Object adapt(ReadGraph g, Resource r) { - return obj; - } - -} +/******************************************************************************* + * Copyright (c) 2007, 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.db.services.adaption.reflection; + +import org.simantics.db.Resource; +import org.simantics.db.ReadGraph; + +public class ConstantAdapter implements IDynamicAdapter2 { + + Object obj; + Class clazz; + + public ConstantAdapter(Class clazz, Object obj) { + this.clazz = clazz; + this.obj = obj; + } + + public ConstantAdapter(Object obj) { + this(obj.getClass(), obj); + } + + @Override + public Class getType() { + return clazz; + } + + @Override + public Object adapt(ReadGraph g, Resource r) { + return obj; + } + +}