}
@Override
public Pattern getPattern() {
// The receiver should be the class object itself.
Pattern receiver = Pattern.value(Expr.name(mClass.getName()));
// The argument should be a record with fields for each declared field
// in the class.
Map<String, Pattern> fields = new HashMap<String, Pattern>();
for (Entry<String, FieldObj> field : mClass.getFieldDefinitions().entrySet()) {
// Only care about fields that don't have initializers.
if (field.getValue().getInitializer() == null) {
fields.put(field.getKey(), field.getValue().getPattern());
}
}
Pattern argument = Pattern.record(fields);
return Pattern.record(receiver, argument);
}