All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.cflint.tools.CFTool Maven / Gradle / Ivy

Go to download

A static code analysis tool for ColdFusion (in the spirit of FindBugs and Lint). With CFLint, you are able to analyze your ColdFusion code base for code violations.

There is a newer version: 1.5.0
Show newest version
package com.cflint.tools;

import java.lang.reflect.Field;

import cfml.parsing.cfscript.CFExpression;
import cfml.parsing.cfscript.CFUnaryExpression;
import net.htmlparser.jericho.Element;

public class CFTool {

	public static CFExpression sub(CFUnaryExpression expression){
		Field f;
		try {
			f = CFUnaryExpression.class.getDeclaredField("sub");
			f.setAccessible(true);
			return (CFExpression)(f.get(expression));
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}return null;
	}
	
	public static Element getNamedParent(Element elem, final String tagName) {
		elem = elem.getParentElement();
		while (elem != null && !elem.getName().equals(tagName)) {
			elem = elem.getParentElement();
		}
		return elem;
	}
	
	public static boolean toBoolean(final String value) {
		if(value == null){
			return false;
		}
		return value.trim().equalsIgnoreCase("yes") || value.trim().equalsIgnoreCase("true");
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy