public Object fromString(String str) { try { return new URI(str); } catch (URISyntaxException e) { throw new ConversionException(e); } } }
public Object fromString(String str) { try { return UUID.fromString(str); } catch(IllegalArgumentException e) { throw new ConversionException("Cannot create UUID instance", e); } }
public Object fromString(String str) { try { return new URL(str); } catch (MalformedURLException e) { throw new ConversionException(e); } }
@Override public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) { throw new ConversionException("Refusing to unmarshal " + reader.getNodeName() + " for security reasons; see https://jenkins.io/redirect/class-filter/"); }
public Object fromString(String str) { try { return ctor.newInstance(new Object[] {str}); } catch (InstantiationException e) { throw new ConversionException("Unable to instantiate single String param constructor", e); } catch (IllegalAccessException e) { throw new ObjectAccessException("Unable to access single String param constructor", e); } catch (InvocationTargetException e) { throw new ConversionException("Unable to target single String param constructor", e.getTargetException()); } } }
@Override public Object fromString(final String str) { try { return LocalTime.parse(str); } catch (final DateTimeParseException e) { final ConversionException exception = new ConversionException("Cannot parse value as local time", e); exception.add("value", str); throw exception; } }
public int accept(Method method) { if (!callbackIndexMap.containsKey(method)) { ConversionException exception = new ConversionException( "CGLIB callback not detected in reverse engineering"); exception.add("CGLIB-callback", method.toString()); throw exception; } return ((Integer)callbackIndexMap.get(method)).intValue(); }
@Override public Instant fromString(final String str) { try { return Instant.parse(str); } catch (final DateTimeParseException ex) { final ConversionException exception = new ConversionException("Cannot parse value as instant", ex); exception.add("value", str); throw exception; } } }
@Override public Object fromString(final String str) { try { return LocalDateTime.parse(str); } catch (final DateTimeParseException e) { final ConversionException exception = new ConversionException("Cannot parse value as local date time", e); exception.add("value", str); throw exception; } }
@Override public Object fromString(final String str) { try { return LocalDate.parse(str); } catch (final DateTimeParseException e) { final ConversionException exception = new ConversionException("Cannot parse value as local date", e); exception.add("value", str); throw exception; } }
@Override public Object fromString(String str) { URL url = (URL) super.fromString(str); try { return URLDeserializationHelper.wrapIfRequired(url); } catch (IOException e) { throw new ConversionException(e); } } }
public Object fromString(final String str) { if (attributeMap.containsKey(str)) { return attributeMap.get(str); } ConversionException exception = new ConversionException("Cannot find attribute"); exception.add("attribute-type", type.getName()); exception.add("attribute-name", str); throw exception; }
public Object newInstance() { ErrorWritingException ex = null; try { return editorType.newInstance(); } catch (InstantiationException e) { ex = new ConversionException("Faild to call default constructor", e); } catch (IllegalAccessException e) { ex = new ObjectAccessException("Cannot call default constructor", e); } ex.add("construction-type", editorType.getName()); throw ex; }
@Override public Year fromString(final String str) { try { return Year.of(Integer.parseInt(str)); } catch (final NumberFormatException ex) { final ConversionException exception = new ConversionException("Cannot parse value as year", ex); exception.add("value", str); throw exception; } } }
@Override public MonthDay fromString(final String str) { try { return MonthDay.parse(str); } catch (final DateTimeParseException ex) { final ConversionException exception = new ConversionException("Cannot parse value as month day", ex); exception.add("value", str); throw exception; } } }
@Override public Period fromString(final String str) { try { return Period.parse(str); } catch (final DateTimeParseException ex) { final ConversionException exception = new ConversionException("Cannot parse period value", ex); exception.add("period", str); throw exception; } } }
public Object fromString(String str) { try { return mapper.realClass(str); } catch (CannotResolveClassException e) { throw new ConversionException("Cannot load java class " + str, e.getCause()); } } }
@Override public Duration fromString(final String str) { try { return Duration.parse(str); } catch (final DateTimeParseException ex) { final ConversionException exception = new ConversionException("Cannot parse value as duration", ex); exception.add("value", str); throw exception; } } }
@Override public YearMonth fromString(final String str) { try { return YearMonth.parse(str); } catch (final DateTimeParseException ex) { final ConversionException exception = new ConversionException("Cannot parse value as year month", ex); exception.add("value", str); throw exception; } } }
@SuppressWarnings("unchecked") public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) { String attributeName = mapper().aliasForSystemAttribute("enum-type"); if (attributeName == null) { throw new ConversionException("No EnumType specified for EnumMap"); } Class type = mapper().realClass(reader.getAttribute(attributeName)); EnumMap map = new EnumMap(type); populateMap(reader, context, map); return map; } }