}
RestrictionDefinition definition = supported.get(oakName);
if (definition == null) {
throw new AccessControlException("Unsupported restriction: " + oakName);
}
Type requiredType = definition.getRequiredType();
int tag = requiredType.tag();
if (tag != PropertyType.UNDEFINED && tag != value.getType()) {
throw new AccessControlException("Unsupported restriction: Expected value of type " + requiredType);
}
PropertyState propertyState;
if (requiredType.isArray()) {
propertyState = PropertyStates.createProperty(oakName, ImmutableList.of(value));
} else {
propertyState = PropertyStates.createProperty(oakName, value);
}
return createRestriction(propertyState, definition);