Java Code Examples for org.springframework.expression.spel.support.ReflectionHelper.ArgumentsMatchKind#EXACT

The following examples show how to use org.springframework.expression.spel.support.ReflectionHelper.ArgumentsMatchKind#EXACT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReflectionHelperTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
/**
 * Used to validate the match returned from a compareArguments call.
 */
private void checkMatch(Class<?>[] inputTypes, Class<?>[] expectedTypes, StandardTypeConverter typeConverter, ArgumentsMatchKind expectedMatchKind) {
	ReflectionHelper.ArgumentsMatchInfo matchInfo = ReflectionHelper.compareArguments(getTypeDescriptors(expectedTypes), getTypeDescriptors(inputTypes), typeConverter);
	if (expectedMatchKind == null) {
		assertNull("Did not expect them to match in any way", matchInfo);
	}
	else {
		assertNotNull("Should not be a null match", matchInfo);
	}

	if (expectedMatchKind == ArgumentsMatchKind.EXACT) {
		assertTrue(matchInfo.isExactMatch());
	}
	else if (expectedMatchKind == ArgumentsMatchKind.CLOSE) {
		assertTrue(matchInfo.isCloseMatch());
	}
	else if (expectedMatchKind == ArgumentsMatchKind.REQUIRES_CONVERSION) {
		assertTrue("expected to be a match requiring conversion, but was " + matchInfo, matchInfo.isMatchRequiringConversion());
	}
}
 
Example 2
Source File: ReflectionHelperTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
/**
 * Used to validate the match returned from a compareArguments call.
 */
private void checkMatch2(Class<?>[] inputTypes, Class<?>[] expectedTypes, StandardTypeConverter typeConverter, ArgumentsMatchKind expectedMatchKind) {
	ReflectionHelper.ArgumentsMatchInfo matchInfo = ReflectionHelper.compareArgumentsVarargs(getTypeDescriptors(expectedTypes), getTypeDescriptors(inputTypes), typeConverter);
	if (expectedMatchKind == null) {
		assertNull("Did not expect them to match in any way: " + matchInfo, matchInfo);
	}
	else {
		assertNotNull("Should not be a null match", matchInfo);
	}

	if (expectedMatchKind == ArgumentsMatchKind.EXACT) {
		assertTrue(matchInfo.isExactMatch());
	}
	else if (expectedMatchKind == ArgumentsMatchKind.CLOSE) {
		assertTrue(matchInfo.isCloseMatch());
	}
	else if (expectedMatchKind == ArgumentsMatchKind.REQUIRES_CONVERSION) {
		assertTrue("expected to be a match requiring conversion, but was " + matchInfo, matchInfo.isMatchRequiringConversion());
	}
}
 
Example 3
Source File: ReflectionHelperTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
/**
 * Used to validate the match returned from a compareArguments call.
 */
private void checkMatch(Class<?>[] inputTypes, Class<?>[] expectedTypes, StandardTypeConverter typeConverter, ArgumentsMatchKind expectedMatchKind) {
	ReflectionHelper.ArgumentsMatchInfo matchInfo = ReflectionHelper.compareArguments(getTypeDescriptors(expectedTypes), getTypeDescriptors(inputTypes), typeConverter);
	if (expectedMatchKind == null) {
		assertNull("Did not expect them to match in any way", matchInfo);
	}
	else {
		assertNotNull("Should not be a null match", matchInfo);
	}

	if (expectedMatchKind == ArgumentsMatchKind.EXACT) {
		assertTrue(matchInfo.isExactMatch());
	}
	else if (expectedMatchKind == ArgumentsMatchKind.CLOSE) {
		assertTrue(matchInfo.isCloseMatch());
	}
	else if (expectedMatchKind == ArgumentsMatchKind.REQUIRES_CONVERSION) {
		assertTrue("expected to be a match requiring conversion, but was " + matchInfo, matchInfo.isMatchRequiringConversion());
	}
}
 
Example 4
Source File: ReflectionHelperTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
/**
 * Used to validate the match returned from a compareArguments call.
 */
private void checkMatch2(Class<?>[] inputTypes, Class<?>[] expectedTypes, StandardTypeConverter typeConverter, ArgumentsMatchKind expectedMatchKind) {
	ReflectionHelper.ArgumentsMatchInfo matchInfo = ReflectionHelper.compareArgumentsVarargs(getTypeDescriptors(expectedTypes), getTypeDescriptors(inputTypes), typeConverter);
	if (expectedMatchKind == null) {
		assertNull("Did not expect them to match in any way: " + matchInfo, matchInfo);
	}
	else {
		assertNotNull("Should not be a null match", matchInfo);
	}

	if (expectedMatchKind == ArgumentsMatchKind.EXACT) {
		assertTrue(matchInfo.isExactMatch());
	}
	else if (expectedMatchKind == ArgumentsMatchKind.CLOSE) {
		assertTrue(matchInfo.isCloseMatch());
	}
	else if (expectedMatchKind == ArgumentsMatchKind.REQUIRES_CONVERSION) {
		assertTrue("expected to be a match requiring conversion, but was " + matchInfo, matchInfo.isMatchRequiringConversion());
	}
}
 
Example 5
Source File: ReflectionHelperTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
/**
 * Used to validate the match returned from a compareArguments call.
 */
private void checkMatch(Class<?>[] inputTypes, Class<?>[] expectedTypes, StandardTypeConverter typeConverter, ArgumentsMatchKind expectedMatchKind) {
	ReflectionHelper.ArgumentsMatchInfo matchInfo = ReflectionHelper.compareArguments(getTypeDescriptors(expectedTypes), getTypeDescriptors(inputTypes), typeConverter);
	if (expectedMatchKind == null) {
		assertNull("Did not expect them to match in any way", matchInfo);
	}
	else {
		assertNotNull("Should not be a null match", matchInfo);
	}

	if (expectedMatchKind == ArgumentsMatchKind.EXACT) {
		assertTrue(matchInfo.isExactMatch());
	}
	else if (expectedMatchKind == ArgumentsMatchKind.CLOSE) {
		assertTrue(matchInfo.isCloseMatch());
	}
	else if (expectedMatchKind == ArgumentsMatchKind.REQUIRES_CONVERSION) {
		assertTrue("expected to be a match requiring conversion, but was " + matchInfo, matchInfo.isMatchRequiringConversion());
	}
}
 
Example 6
Source File: ReflectionHelperTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
/**
 * Used to validate the match returned from a compareArguments call.
 */
private void checkMatch2(Class<?>[] inputTypes, Class<?>[] expectedTypes, StandardTypeConverter typeConverter, ArgumentsMatchKind expectedMatchKind) {
	ReflectionHelper.ArgumentsMatchInfo matchInfo = ReflectionHelper.compareArgumentsVarargs(getTypeDescriptors(expectedTypes), getTypeDescriptors(inputTypes), typeConverter);
	if (expectedMatchKind == null) {
		assertNull("Did not expect them to match in any way: " + matchInfo, matchInfo);
	}
	else {
		assertNotNull("Should not be a null match", matchInfo);
	}

	if (expectedMatchKind == ArgumentsMatchKind.EXACT) {
		assertTrue(matchInfo.isExactMatch());
	}
	else if (expectedMatchKind == ArgumentsMatchKind.CLOSE) {
		assertTrue(matchInfo.isCloseMatch());
	}
	else if (expectedMatchKind == ArgumentsMatchKind.REQUIRES_CONVERSION) {
		assertTrue("expected to be a match requiring conversion, but was " + matchInfo, matchInfo.isMatchRequiringConversion());
	}
}