@Override
public boolean canApplyTo(final FunctionCompilationContext context, final ComputationTarget target) {
if (context.getViewCalculationConfiguration() == null) {
return false;
}
final ValueProperties defaults = context.getViewCalculationConfiguration().getDefaultProperties();
if (defaults.getProperties() == null) {
return false;
}
final String prefix = getPrefix(context, target) + ".";
if (isIdentifier()) {
final List<String> identifiers = getIdentifiers(target);
if (identifiers == null) {
return false;
}
final List<String> suffixes = new ArrayList<String>(identifiers.size());
for (String identifier : identifiers) {
suffixes.add("." + identifier);
}
for (String property : defaults.getProperties()) {
for (String suffix : suffixes) {
if (property.startsWith(prefix) && property.endsWith(suffix)) {
final int i = property.indexOf(SEP, prefix.length());
if (i > 0) {
return true;
}
}
}
}
} else {
for (String property : defaults.getProperties()) {
if (property.startsWith(prefix)) {
final int i = property.indexOf(SEP, prefix.length());
if ((i > 0) && (property.indexOf('.', i + 1) < 0)) {
return true;
}