本文整理汇总了Java中ma.glasnost.orika.metadata.Type类的典型用法代码示例。如果您正苦于以下问题:Java Type类的具体用法?Java Type怎么用?Java Type使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Type类属于ma.glasnost.orika.metadata包,在下文中一共展示了Type类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shouldMap
import ma.glasnost.orika.metadata.Type; //导入依赖的package包/类
@Override
public <S, D> boolean shouldMap(Type<S> type, String s, S s1, Type<D> type1, String s2, D d,
MappingContext mappingContext) {
if (type != null && s1 != null) {
if (type.isCollection()) {
if (s1 instanceof AbstractPersistentCollection) {
return false;
}
if (((PersistentSet) s1).wasInitialized()) {
return false;
}
}
}
return true;
}
示例2: MappingBuilder
import ma.glasnost.orika.metadata.Type; //导入依赖的package包/类
public MappingBuilder(MapperFactory mapperFactory, Type<?> sourceType, Type<?> destinationType, ApplicationContext applicationContext) {
this.sourceType = sourceType;
this.destinationType = destinationType;
this.mapperFactory = mapperFactory;
this.sourceClass = this.sourceType.getRawType();
this.destinationClass = this.destinationType.getRawType();
this.buildMapping();
this.buildConverts();
this.applicationContext = applicationContext;
}
示例3: addMappingIfNotRegistered
import ma.glasnost.orika.metadata.Type; //导入依赖的package包/类
private void addMappingIfNotRegistered(Type<?> sourceType, Type<?> destinationType){
if(!this.mapperFactory.existsRegisteredMapper(sourceType,destinationType,true)){
synchronized (mapperBuildLock){
if(!this.mapperFactory.existsRegisteredMapper(sourceType,destinationType,true)) {
new MappingBuilder(this.mapperFactory, sourceType, destinationType,applicationContext).build();
}
}
}
}
示例4: map
import ma.glasnost.orika.metadata.Type; //导入依赖的package包/类
@Override
public <S, D> void map(S sourceObject, D destinationObject, Type<S> sourceType, Type<D> destinationType) {
if(sourceObject==null){
return;
}
addMappingIfNotRegistered(sourceType,destinationType);
this.mapper.map(sourceObject,destinationObject,sourceType,destinationType);
}
示例5: mapAsSet
import ma.glasnost.orika.metadata.Type; //导入依赖的package包/类
@Override
public <S, D> Set<D> mapAsSet(Iterable<S> source, Type<S> sourceType, Type<D> destinationType) {
Class<S> elclass = this.getElementClass(source);
if(elclass==null){
return new HashSet<D>();
}
addMappingIfNotRegistered(sourceType,destinationType);
return this.mapper.mapAsSet(source,sourceType,destinationType);
}
示例6: mapAsList
import ma.glasnost.orika.metadata.Type; //导入依赖的package包/类
@Override
public <S, D> List<D> mapAsList(Iterable<S> source, Type<S> sourceType, Type<D> destinationType) {
Class<S> elclass = this.getElementClass(source);
if(elclass==null){
return new ArrayList<D>();
}
addMappingIfNotRegistered(sourceType,destinationType);
return this.mapper.mapAsList(source,sourceType,destinationType);
}
示例7: mapAsArray
import ma.glasnost.orika.metadata.Type; //导入依赖的package包/类
@Override
public <S, D> D[] mapAsArray(D[] destination, Iterable<S> source, Type<S> sourceType, Type<D> destinationType) {
Class<S> elclass = this.getElementClass(source);
if(elclass==null){
return (D[]) new Object[1];
}
addMappingIfNotRegistered(sourceType,destinationType);
return this.mapper.mapAsArray(destination,source,sourceType,destinationType);
}
示例8: mapAsCollection
import ma.glasnost.orika.metadata.Type; //导入依赖的package包/类
@Override
public <S, D> void mapAsCollection(Iterable<S> source, Collection<D> destination, Type<S> sourceType, Type<D> destinationType) {
Class<S> elclass = this.getElementClass(source);
if(elclass==null){
return;
}
addMappingIfNotRegistered(sourceType,destinationType);
this.mapper.mapAsCollection(source,destination,sourceType,destinationType);
}
示例9: convert
import ma.glasnost.orika.metadata.Type; //导入依赖的package包/类
@Override
public <S, D> D convert(S source, Type<S> sourceType, Type<D> destinationType, String converterId) {
if(source==null){
return null;
}
addMappingIfNotRegistered(sourceType,destinationType);
return this.mapper.convert(source,sourceType,destinationType,converterId);
}
示例10: mapAsMap
import ma.glasnost.orika.metadata.Type; //导入依赖的package包/类
@Override
public <Sk, Sv, Dk, Dv> Map<Dk, Dv> mapAsMap(Map<Sk, Sv> source, Type<? extends Map<Sk, Sv>> sourceType, Type<? extends Map<Dk, Dv>> destinationType) {
if(source==null){
return null;
}
addMappingIfNotRegistered(sourceType,destinationType);
return this.mapper.mapAsMap(source,sourceType,destinationType);
}
示例11: newObject
import ma.glasnost.orika.metadata.Type; //导入依赖的package包/类
@Override
public <S, D> D newObject(S source, Type<? extends D> destinationType, MappingContext context) {
if(source==null){
return null;
}
addMappingIfNotRegistered(TypeFactory.valueOf(source.getClass()),destinationType);
return this.mapper.newObject(source,destinationType,context);
}
示例12: convert
import ma.glasnost.orika.metadata.Type; //导入依赖的package包/类
@Override
public BasicInfo convert(BasicInfo source, Type<? extends BasicInfo> destinationType, MappingContext mappingContext) {
if (source == null) {
return null;
}
return new BasicInfo(source.getKeyword(), source.getName(), source.getArguments());
}
示例13: ClonerConverter
import ma.glasnost.orika.metadata.Type; //导入依赖的package包/类
/**
* Constructs a new ClonerConverter configured to handle the provided list of types by
* cloning.
* @param cloneStrategy Strategy to be used
* @param types one or more types that should be copied using the ClonerConverter
*/
public ClonerConverter(CloneStrategy cloneStrategy, java.lang.reflect.Type... types) {
this.cloner = new BasicCloner(cloneStrategy);
if (types.length == 0) {
this.types = null;
}
for (java.lang.reflect.Type type : types) {
this.types.add(TypeFactory.valueOf(type));
}
}