Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2011 the original author or authors.
   *
   * Licensed 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.springframework.data.mongodb.core.convert;
 
 import  org.springframework.core.convert.converter.GenericConverter.ConvertiblePair;
 import  org.springframework.util.Assert;

Conversion registration information.

Author(s):
Oliver Gierke
 
 
 	private final ConvertiblePair convertiblePair;
 	private final boolean reading;
 	private final boolean writing;

Creates a new ConverterRegistration.

Parameters:
convertiblePair must not be null.
isReading whether to force to consider the converter for reading.
isWritingwhether to force to consider the converter for reading.
 
 	public ConverterRegistration(ConvertiblePair convertiblePairboolean isReadingboolean isWriting) {
 
 		Assert.notNull(convertiblePair);
 
 		this. = convertiblePair;
 		this. = isReading;
 		this. = isWriting;
 	}

Creates a new ConverterRegistration from the given source and target type and read/write flags.

Parameters:
source the source type to be converted from, must not be null.
target the target type to be converted to, must not be null.
isReading whether to force to consider the converter for reading.
isWriting whether to force to consider the converter for writing.
 
 	public ConverterRegistration(Class<?> sourceClass<?> targetboolean isReadingboolean isWriting) {
 		this(new ConvertiblePair(sourcetarget), isReadingisWriting);
 	}

Returns whether the converter shall be used for writing.

Returns:
 
 	public boolean isWriting() {
 		return  == true || (! && isSimpleTargetType());
 	}

Returns whether the converter shall be used for reading.

Returns:
 
 	public boolean isReading() {
 		return  == true || (! && isSimpleSourceType());
 	}

Returns the actual conversion pair.

Returns:
 
 	public ConvertiblePair getConvertiblePair() {
 		return ;
 	}

Returns whether the source type is a Mongo simple one.

Returns:
 
 	public boolean isSimpleSourceType() {
 		return isMongoBasicType(.getSourceType());
 	}

Returns whether the target type is a Mongo simple one.

Returns:
	public boolean isSimpleTargetType() {
		return isMongoBasicType(.getTargetType());
	}

Returns whether the given type is a type that Mongo can handle basically.

Parameters:
type
Returns:
	private static boolean isMongoBasicType(Class<?> type) {
	}
New to GrepCode? Check out our FAQ X