Annotate the given schema with the masking information. Format of the string is a mask-list. mask-list = mask (';' mask-list)? mask = mask-name (',' parameter) ':' field-list field-list = field-name ( ',' field-list )? field-name = number | field-part ('.
(StringPosition source, TypeDescription schema)
| 559 | * @throws IllegalArgumentException if there are conflicting masks for a field |
| 560 | */ |
| 561 | public static void parseMasks(StringPosition source, TypeDescription schema) { |
| 562 | if (source.hasCharactersLeft()) { |
| 563 | do { |
| 564 | // parse the mask and parameters, but only get the underlying string |
| 565 | int start = source.position; |
| 566 | parseName(source); |
| 567 | while (consumeChar(source, ',')) { |
| 568 | parseName(source); |
| 569 | } |
| 570 | String maskString = source.fromPosition(start); |
| 571 | requireChar(source, ':'); |
| 572 | for (TypeDescription field : findSubtypeList(schema, source)) { |
| 573 | String prev = field.getAttributeValue(TypeDescription.MASK_ATTRIBUTE); |
| 574 | if (prev != null && !prev.equals(maskString)) { |
| 575 | throw new IllegalArgumentException("Conflicting encryption masks " + |
| 576 | maskString + " and " + prev); |
| 577 | } |
| 578 | field.setAttribute(TypeDescription.MASK_ATTRIBUTE, maskString); |
| 579 | } |
| 580 | } while (consumeChar(source, ';')); |
| 581 | } |
| 582 | } |
| 583 | |
| 584 | public static MaskDescriptionImpl buildMaskDescription(String value) { |
| 585 | StringPosition source = new StringPosition(value); |
no test coverage detected