1 14 15 package com.sun.facelets.util; 16 17 import javax.faces.application.Application; 18 import javax.faces.component.UIComponent; 19 import javax.faces.component.UIComponentBase; 20 21 public final class FacesAPI { 22 23 private static final int version = specifyVersion(); 24 private static final Class [] UIC_SIG = new Class [] { String .class }; 25 26 private FacesAPI() { 27 super(); 28 } 29 30 private final static int specifyVersion() { 31 try { 32 Application.class.getMethod("getExpressionFactory", null); 33 } catch (NoSuchMethodException e) { 34 return 11; 35 } 36 return 12; 37 } 38 39 public final static int getVersion() { 40 return version; 41 } 42 43 public final static int getComponentVersion(UIComponent c) { 44 return (version >= 12 && c instanceof UIComponentBase) ? 12 : 11; 45 } 46 47 public final static int getComponentVersion(Class c) { 48 return (version >= 12 && UIComponentBase.class.isAssignableFrom(c)) ? 12 : 11; 49 } 50 } 51 | Popular Tags |