Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * 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.sca.interfacedef.impl;
 
 import java.util.Map;
 
Representation of the type of data associated with an operation. Data is represented in two forms: the physical form used by the runtime and a logical form used by the assembly. The physical form is a Java Type because the runtime is written in Java. This may be the same form used by the application but it may not; for example, an application that is performing stream processing may want a physical form such as an InputStream to semantically operate on application data such as a purchase order. The logical description is that used by the assembly model and is an identifier into some well-known type space; examples may be a Java type represented by its Class or an XML type represented by its QName. Every data type may also contain metadata describing the expected data; for example, it could specify a preferred data binding technology or the size of a typical instance.

Version:
$Rev: 998232 $ $Date: 2010-09-17 19:10:18 +0100 (Fri, 17 Sep 2010) $
Tuscany.spi.extension.asclient:
 
 public class DataTypeImpl<L> implements DataType<L> {
     private String dataBinding;
     private Class<?> physical;
     private Type genericType;
     private L logical;
     private Map<Class<?>, ObjectmetaDataMap;

    
Construct a data type specifying the physical and logical types.

Parameters:
physical the physical class used by the runtime
logical the logical type
See also:
getLogical()
 
     public DataTypeImpl(Class<?> physical, L logical) {
         this(nullphysicalphysicallogical);
     }

    

Parameters:
dataBinding
physical
logical
 
     public DataTypeImpl(String dataBindingClass<?> physical, L logical) {
         this(dataBindingphysicalphysicallogical);
     }

    

Parameters:
dataBinding
physical
genericType
logical
 
     public DataTypeImpl(String dataBindingClass<?> physicalType genericType, L logical) {
         super();
         this. = dataBinding;
         this. = physical;
         this. = genericType;
         this. = logical;
     }

    
Returns the physical type used by the runtime.

Returns:
the physical type used by the runtime
 
     public Class<?> getPhysical() {
         return ;
     }

    

Parameters:
physical the physical to set
 
     public void setPhysical(Class<?> physical) {
         this. = physical;
    }

    
Get the java generic type

Returns:
The java generic type
    public Type getGenericType() {
        return ;
    }

    
Set the java generic type

Parameters:
genericType
    public void setGenericType(Type genericType) {
        this. = genericType;
    }

    
Returns the logical identifier used by the assembly. The type of this value identifies the logical type system in use. Known values are:
  • a java.lang.reflect.Type identifies a Java type by name and ClassLoader; this includes Java Classes as they are specializations of Type
  • a javax.xml.namespace.QName identifies an XML type by local name and namespace

Returns:
the logical type name
    public L getLogical() {
        return ;
    }

    

Parameters:
logical the logical to set
    public void setLogical(L logical) {
        this. = logical;
    }
    public String getDataBinding() {
        return ;
    }

    

Parameters:
dataBinding the dataBinding to set
    public void setDataBinding(String dataBinding) {
        this. = dataBinding;
    }
        
    @Override
    public String toString() {    	
    	StringBuilder b = new StringBuilder( 256 );
    	b.append"DataType[" );
    	b.append"dataBinding=" + ((==null) ? "null" : ) );
    	b.append", genericType=" + ((==null) ? "null" : ) ); 
    	b.append", physical=" + ((==null) ? "null" : ) ); 
    	b.append", logical=" + ((==null) ? "null" : ) );
    	b.append", metaData size=" + ((==null) ? "0" : .size()) );
    	b.append"]" );
    	return b.toString();
    }
    @SuppressWarnings("unchecked")
    @Override
    public Object clone() throws CloneNotSupportedException {
        DataTypeImpl copy = (DataTypeImpl)super.clone();
        return copy;
    }
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + (( == null) ? 0 : .hashCode());
        result = prime * result + (( == null) ? 0 : .hashCode());
        result = prime * result + (( == null) ? 0 : .hashCode());
        result = prime * result + (( == null) ? 0 : .hashCode());
        return result;
    }
    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        final DataTypeImpl other = (DataTypeImpl)obj;
        if ( == null) {
            if (other.dataBinding != null)
                return false;
        } else if (!.equals(other.dataBinding))
            return false;
        if ( == null) {
            if (other.genericType != null)
                return false;
        } else if (!.equals(other.genericType))
            return false;
        if ( == null) {
            if (other.logical != null)
                return false;
        } else if (!.equals(other.logical))
            return false;
        if ( == null) {
            if (other.physical != null)
                return false;
        } else if (!.equals(other.physical))
            return false;
        return true;
    }
    public <T> T getMetaData(Class<T> type) {
        return  == null ? null : type.cast(.get(type));
    }
    public <T> void setMetaData(Class<T> type, T metaData) {
        if ( == null) {
             = new ConcurrentHashMap<Class<?>, Object>();
        }
        .put(typemetaData);
    }
New to GrepCode? Check out our FAQ X