Skip to content

Commit 486eeac

Browse files
committed
Revert "Add type support to BeanAdapter."
This reverts commit e720a29.
1 parent e720a29 commit 486eeac

File tree

5 files changed

+44
-578
lines changed

5 files changed

+44
-578
lines changed

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 0 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -751,24 +751,6 @@ Although the values are actually stored in the strongly typed properties of the
751751
}
752752
```
753753

754-
### Typed Access
755-
`BeanAdapter` can also be used to facilitate type-safe access to deserialized JSON and CSV data. For example, `JSONDecoder` would parse the data returned by the previous example into a collection of list and map values. The `adapt()` method of the `BeanAdapter` class can be used to convert this loosely typed data structure into a strongly typed object hierarchy. This method takes an object and a result type as arguments, and returns an instance of the given type that adapts the underlying value:
756-
757-
```java
758-
public static <T> T adapt(Object value, Type type) { ... }
759-
```
760-
761-
If the value is already an instance of the requested type, it is returned as is. Otherwise:
762-
763-
* If the target type is a number or boolean, the value is parsed or coerced using the appropriate conversion method. Missing or `null` values are automatically converted to `0` or `false` for primitive types.
764-
* If the target type is a `String`, the value is adapted via its `toString()` method.
765-
* If the target type is `java.util.Date`, the value is parsed or coerced to a long value representing epoch time in milliseconds and then converted to a `Date`.
766-
* If the target type is `java.util.time.LocalDate`, `java.util.time.LocalTime`, or `java.util.time.LocalDateTime`, the value is converted to a string and parsed using the appropriate `parse()` method.
767-
* If the target type is `java.net.URL`, the value is converted to a string and passed to the string-based `URL` constructor.
768-
* If the target type is `java.util.List` or `java.util.Map`, the value is wrapped in an adapter of the same type that automatically adapts its sub-elements.
769-
770-
Otherwise, the target is assumed to be a bean, and the value is assumed to be a map. An instance of the given type is dynamically created and populated using the entries in the map. Property values are adapted as described above. If a property provides multiple setters, the first applicable setter will be applied.
771-
772754
### Custom Property Keys
773755
The `Key` annotation can be used to associate a custom key with a bean property. For example, the following property would appear as "first_name" in the resulting map instead of "firstName":
774756

0 commit comments

Comments
 (0)