/** * Translates the {@code object} into resource key that will be used to lookup the value shown * to the user * * @param object * @return resource key */ protected String resourceKey(Boolean object) { return Classes.simpleName(Boolean.class) + '.' + object; } }
/** * Gets the target property type. * * @return the target property type. */ public final Class<?> getTargetType() { return Classes.resolveClass(targetTypeName); }
/** * Determines whether or not a conversation should be activated fro the * specified handler. This method is used to filter out conversation * activation for utility handlers such as the * {@link BufferedResponseRequestHandler} * * @param handler * @return {@code true} iff a conversation should be activated */ protected boolean activateForHandler(IRequestHandler handler) { if (handler != null) { String handlerClassName = Classes.name(handler.getClass()); if (handler instanceof BufferedResponseRequestHandler) { // we do not care about pages that are being rendered from a buffer return false; } else if ("org.apache.wicket.protocol.ws.api.WebSocketMessageBroadcastHandler".equals(handlerClassName)) { return false; } else if ("org.apache.wicket.protocol.ws.api.WebSocketRequestHandler".equals(handlerClassName)) { // injection is not supported in web sockets communication return false; } } return true; }
/** * Determines whether or not a conversation should be activated fro the * specified handler. This method is used to filter out conversation * activation for utility handlers such as the * {@link BufferedResponseRequestHandler} * * @param handler * @return {@code true} iff a conversation should be activated */ protected boolean activateForHandler(IRequestHandler handler) { if (handler != null) { String handlerClassName = Classes.name(handler.getClass()); if (handler instanceof BufferedResponseRequestHandler) { // we do not care about pages that are being rendered from a buffer return false; } else if ("org.apache.wicket.protocol.ws.api.WebSocketMessageBroadcastHandler".equals(handlerClassName)) { return false; } else if ("org.apache.wicket.protocol.ws.api.WebSocketRequestHandler".equals(handlerClassName)) { // injection is not supported in web sockets communication return false; } } return true; }
/** * Get a standardized key for a CSS class. * * @param scope * scope of CSS class * @param facet * facet of CSS class * @return CSS key */ public static String key(Class<?> scope, String facet) { return Classes.simpleName(scope) + ".CSS." + facet; } }
/** * assert component class * * @param <C> * * @param path * path to component * @param expectedComponentClass * expected component class * @return a <code>Result</code> */ public <C extends Component> Result isComponent(String path, Class<C> expectedComponentClass) { Component component = assertExists(path); return isTrue("component '" + Classes.name(component.getClass()) + "' is not of type: " + Classes.name(expectedComponentClass), expectedComponentClass.isAssignableFrom(component.getClass())); }
/** * Gets the scoping class, used for class loading and to determine the package. * * @return the scoping class */ public final Class<?> getScope() { return Classes.resolveClass(scopeName); }
/** * Get a standardized key for a CSS class. * * @param scope * scope of CSS class * @param facet * facet of CSS class * @return CSS key */ public static String key(Class<?> scope, String facet) { return Classes.simpleName(scope) + ".CSS." + facet; } }
/** * assert component class * * @param <C> * * @param path * path to component * @param expectedComponentClass * expected component class * @return a <code>Result</code> */ public <C extends Component> Result isComponent(String path, Class<C> expectedComponentClass) { Component component = assertExists(path); return isTrue( "component '" + Classes.name(component.getClass()) + "' is not of type: " + Classes.name(expectedComponentClass), expectedComponentClass.isAssignableFrom(component.getClass())); }
/** * Get the actual component class the markup is directly associated with. Note: it not * necessarily must be the container class. * * @return The directly associated class */ public Class getMarkupClass() { return Classes.resolveClass(markupClassName); }
/** * Gets the resource key for validator's error message from the ApplicationSettings class. * * @return the resource key based on the form component */ protected String resourceKey() { return Classes.simpleName(getClass()); } }
/** * Dump with indentation. * * @param type * the type that couldn't be serialized * @return A very pretty dump */ protected final String toPrettyPrintedStack(String type) { StringBuilder result = new StringBuilder(512); StringBuilder spaces = new StringBuilder(32); result.append("A problem occurred while checking object with type: "); result.append(type); result.append("\nField hierarchy is:"); for (TraceSlot slot : traceStack) { spaces.append(' ').append(' '); result.append('\n').append(spaces).append(slot.fieldDescription); result.append(" [class=").append(Classes.name(slot.object.getClass())); if (slot.object instanceof Component) { Component component = (Component)slot.object; result.append(", path=").append(component.getPath()); } result.append(']'); } result.append(" <----- field that is causing the problem"); return result.toString(); }
/** * @return Scope */ public final Class getScope() { return Classes.resolveClass(scopeName); }
/** * Gets the resource key for validator's error message from the ApplicationSettings class. * * @return the resource key based on the form component */ protected String resourceKey() { return Classes.simpleName(getClass()); } }
/** * Dump with indentation. * * @param type * the type that couldn't be serialized * @return A very pretty dump */ protected final String toPrettyPrintedStack(String type) { StringBuilder result = new StringBuilder(512); StringBuilder spaces = new StringBuilder(32); result.append("A problem occurred while checking object with type: "); result.append(type); result.append("\nField hierarchy is:"); for (TraceSlot slot : traceStack) { spaces.append(' ').append(' '); result.append('\n').append(spaces).append(slot.fieldDescription); result.append(" [class=").append(Classes.name(slot.object.getClass())); if (slot.object instanceof Component) { Component component = (Component)slot.object; result.append(", path=").append(component.getPath()); } result.append(']'); } result.append(" <----- field that is causing the problem"); return result.toString(); }
/** * Gets the scoping class, used for class loading and to determine the package. * * @return the scoping class */ public final Class getScope() { return Classes.resolveClass(scopeName); }
private void assertNotFrozen(boolean frozen, Class<?> clazz) { if (frozen) { throw new IllegalStateException(Classes.simpleName(clazz) + "s can no longer be added"); } }
/** * @see org.apache.wicket.jmx.ApplicationSettingsMBean#getPageExpiredErrorPage() */ @Override public String getPageExpiredErrorPage() { return Classes.name(application.getApplicationSettings().getPageExpiredErrorPage()); }
/** * Get tge page class registered with the link * * @return Page class */ public final Class getPageClass() { return Classes.resolveClass(pageClassName); }
@Override public String toString() { return (renderBase == null ? "null" : Classes.simpleName(renderBase.getClass())) + '@' + indexInRenderBase; } }