@ JsonCreator public static RegionRequest fromString ( String str ) throws ResolvingException { if ( str . equals ( "full" ) ) { return new RegionRequest ( ) ; } if ( str . equals ( "square" ) ) { return new RegionRequest ( true ) ; } Matcher matcher = PARSE_PAT . matcher ( str ) ; if ( ! matcher . matches ( ) ) { throw new ResolvingException ( "Bad format: " + str ) ; } if ( matcher . group ( 1 ) == null ) { return new RegionRequest ( Integer . valueOf ( matcher . group ( 2 ) ) , Integer . valueOf ( matcher . group ( 3 ) ) , Integer . valueOf ( matcher . group ( 4 ) ) , Integer . valueOf ( matcher . group ( 5 ) ) ) ; } else { return new RegionRequest ( new BigDecimal ( matcher . group ( 2 ) ) , new BigDecimal ( matcher . group ( 3 ) ) , new BigDecimal ( matcher . group ( 4 ) ) , new BigDecimal ( matcher . group ( 5 ) ) ) ; } }
Parse an IIIF Image API compliant region request string