summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/property/SimplePropertyObjectFactory.java
diff options
context:
space:
mode:
Diffstat (limited to 'branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/property/SimplePropertyObjectFactory.java')
-rw-r--r--branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/property/SimplePropertyObjectFactory.java64
1 files changed, 0 insertions, 64 deletions
diff --git a/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/property/SimplePropertyObjectFactory.java b/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/property/SimplePropertyObjectFactory.java
deleted file mode 100644
index 87d8d414e2..0000000000
--- a/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/property/SimplePropertyObjectFactory.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.core.property;
-
-import org.apache.tuscany.spi.ObjectCreationException;
-import org.apache.tuscany.spi.ObjectFactory;
-import org.apache.tuscany.spi.databinding.extension.SimpleTypeMapperExtension;
-import org.apache.tuscany.spi.idl.TypeInfo;
-import org.apache.tuscany.spi.model.Property;
-import org.w3c.dom.Element;
-
-public class SimplePropertyObjectFactory<P> implements ObjectFactory<P> {
- private SimpleTypeMapperExtension typeMapper;
- private Property<P> property;
- private Element value;
- private P instance;
-
- public SimplePropertyObjectFactory(Property<P> property, Element value) {
- super();
-
- this.property = property;
- this.value = (value == null) ? property.getDefaultValues().get(0) : value;
- this.typeMapper = new SimpleTypeMapperExtension();
- }
-
- @SuppressWarnings("unchecked")
- public P getInstance() throws ObjectCreationException {
- if (value == null) {
- return null;
- }
- if (instance == null) {
- String text = value.getTextContent();
- TypeInfo xmlType = null;
- if (property.getJavaType() == null) {
- xmlType = new TypeInfo(property.getXmlType(), true, null);
- } else {
- xmlType = typeMapper.getXMLType(property.getJavaType());
- }
- if (xmlType == null) {
- throw new IllegalArgumentException("Complex property is not supported.");
- }
- instance = (P)typeMapper.toJavaObject(xmlType.getQName(), text, null);
- }
- return instance;
- }
-
-}