forked from modelmapper/modelmapper
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[maven-release-plugin] prepare for next development iteration
Support named empty type map Add UuidConverter Add error message while skip conflict Throw error if skip conflict Update asm-tree lib version [maven-release-plugin] prepare release modelmapper-parent-3.1.1 [maven-release-plugin] prepare for next development iteration add support for Permazen proxies change configs equals method to check for namingConventions change != to equals call add NamingConventions to hashcode of InheritingConfig Fix the order of actual value and expected value in the test code update .gitignore file Bump asm and bytebuddy for java 21 support (modelmapper#729) [maven-release-plugin] prepare release modelmapper-parent-3.2.0 [maven-release-plugin] prepare for next development iteration Update CHANGES.md for 3.2.0 release
- Loading branch information
1 parent
251772e
commit 50491be
Showing
35 changed files
with
410 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,5 @@ release.properties | |
.settings/ | ||
_site/ | ||
user-manual/ | ||
*.iml | ||
*.iml | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
core/src/main/java/org/modelmapper/internal/converter/UuidConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.modelmapper.internal.converter; | ||
|
||
import java.util.UUID; | ||
import org.modelmapper.spi.ConditionalConverter; | ||
import org.modelmapper.spi.MappingContext; | ||
|
||
/** | ||
* Converts objects to UUID. | ||
*/ | ||
class UuidConverter implements ConditionalConverter<Object, UUID> { | ||
|
||
public UUID convert(MappingContext<Object, UUID> context) { | ||
Object source = context.getSource(); | ||
if (source == null) { | ||
return null; | ||
} | ||
|
||
Class<?> sourceType = context.getSourceType(); | ||
if (isCharArray(sourceType)) { | ||
return UUID.fromString(new String((char[]) source)); | ||
} | ||
return UUID.fromString(source.toString()); | ||
} | ||
|
||
public MatchResult match(Class<?> sourceType, Class<?> destinationType) { | ||
boolean destMatch = destinationType == UUID.class; | ||
return destMatch ? isCharArray(sourceType) || sourceType == String.class | ||
? MatchResult.FULL | ||
: MatchResult.PARTIAL | ||
: MatchResult.NONE; | ||
} | ||
|
||
private boolean isCharArray(Class<?> sourceType) { | ||
return sourceType.isArray() && (sourceType.getComponentType() == Character.TYPE | ||
|| sourceType.getComponentType() == Character.class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.