Spring Framework GenericConverter.ConvertiblePair - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework GenericConverter.ConvertiblePair class.

This code example shows how to use the following methods:
 */ 
public enum StringToPointConverter implements Converter<String, Point> {
 
	INSTANCE;
 
	public static final ConvertiblePair CONVERTIBLE = new ConvertiblePair(String.class, Point.class);
 
	private static final String INVALID_FORMAT = "Expected two doubles separated by a semicolon but got '%s'!";
 
	/*  
	 * (non-Javadoc) 
	 * @see org.springframework.core.convert.converter.Converter#convert(java.lang.Object) 
	 */ 
	@Override 
	public Point convert(String source) {
 
		String[] parts = source.split(",");
 
		if (parts.length != 2) {
			throw new IllegalArgumentException(String.format(INVALID_FORMAT, source));
5
CodeRank
This code example shows how to use the following methods:
   * @param target the target type to be converted to, must not be {@literal null}. 
   * @param isReading whether to force to consider the converter for reading. 
   * @param isWriting whether to force to consider the converter for writing. 
   */ 
  public ConverterRegistration(Class<?> source, Class<?> target, boolean isReading, boolean isWriting) {
    this(new ConvertiblePair(source, target), isReading, isWriting);
  } 
 
  /** 
   * Returns whether the converter shall be used for writing. 
   * 
   * @return 
   */ 
  public boolean isWriting() { 
    return writing == true || (!reading && isSimpleTargetType());
  } 
 
  /** 
   * Returns whether the converter shall be used for reading. 
   * 
3
CodeRank
This code example shows how to use the following methods:
	 * @param target the target type to be converted to, must not be {@literal null}. 
	 * @param isReading whether to force to consider the converter for reading. 
	 * @param isWriting whether to force to consider the converter for writing. 
	 */ 
	public ConverterRegistration(Class<?> source, Class<?> target, boolean isReading, boolean isWriting) {
		this(new ConvertiblePair(source, target), isReading, isWriting);
	} 
 
	/** 
	 * Returns whether the converter shall be used for writing. 
	 *  
	 * @return 
	 */ 
	public boolean isWriting() { 
		return writing == true || (!reading && isSimpleTargetType());
	} 
 
	/** 
	 * Returns whether the converter shall be used for reading. 
	 *  
3
CodeRank