|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.tapestry5.internal.TapestryInternalUtils
public class TapestryInternalUtils
Shared utility methods used by various implementation classes.
| Field Summary | |
|---|---|
static Mapper<Asset,StylesheetLink> |
assetToStylesheetLink
Common mapper, used primarily with Flow.map(org.apache.tapestry5.func.Mapper) |
| Constructor Summary | |
|---|---|
TapestryInternalUtils()
|
|
| Method Summary | ||
|---|---|---|
static void |
copy(java.io.InputStream in,
java.io.OutputStream out)
Copies some content from an input stream to an output stream. |
|
static java.lang.String |
defaultLabel(java.lang.String id,
Messages messages,
java.lang.String propertyExpression)
Looks for a label within the messages based on the id. |
|
static java.lang.String |
extractIdFromPropertyExpression(java.lang.String expression)
Used to convert a property expression into a key that can be used to locate various resources (Blocks, messages, etc.). |
|
static
|
getAndDeref(java.util.Map<K,? extends java.lang.ref.Reference<V>> map,
K key)
Extracts a value from a map of references. |
|
static java.lang.String |
getLabelForEnum(Messages messages,
java.lang.Enum value)
|
|
static java.lang.String |
getLabelForEnum(Messages messages,
java.lang.String prefix,
java.lang.Enum value)
Converts an enum to a label string, allowing for overrides from a message catalog. |
|
static boolean |
isEqual(EventContext left,
EventContext right)
|
|
static
|
isEqual(T left,
T right)
Determines if the two values are equal. |
|
static java.lang.String |
lastTerm(java.lang.String input)
Strips a dotted sequence (such as a property expression, or a qualified class name) down to the last term of that expression, by locating the last period ('.') in the string. |
|
static java.util.Map<java.lang.String,java.lang.String> |
mapFromKeysAndValues(java.lang.String... keysAndValues)
|
|
static Orderable<java.lang.String> |
mixinTypeAndOrder(java.lang.String mixinDef)
|
|
static KeyValue |
parseKeyValue(java.lang.String input)
Parses a key/value pair where the key and the value are seperated by an equals sign. |
|
static void |
performIO(OperationTracker tracker,
java.lang.String description,
IOOperation operation)
Performs an operation and re-throws the IOException that may occur. |
|
static java.lang.String[] |
splitAtCommas(java.lang.String value)
Splits a value around commas. |
|
static java.lang.String[] |
splitMixinConstraints(java.lang.String s)
|
|
static java.lang.String[] |
splitPath(java.lang.String path)
Splits a path at each slash. |
|
static Asset2 |
toAsset2(Asset asset)
Converts an Asset to an Asset2 if necessary. |
|
static java.lang.String |
toClassAttributeValue(java.util.List<java.lang.String> classes)
Converts an list of strings into a space-separated string combining them all, suitable for use as an HTML class attribute value. |
|
static java.lang.String |
toFileSuffix(java.lang.String fileName)
|
|
static InternalPropertyConduit |
toInternalPropertyConduit(PropertyConduit conduit)
|
|
static LinkCreationListener2 |
toLinkCreationListener2(LinkCreationListener delegate)
|
|
static OptionModel |
toOptionModel(java.util.Map.Entry input)
Converts a map entry to an OptionModel. |
|
static OptionModel |
toOptionModel(java.lang.Object input)
Converts an object to an OptionModel. |
|
static OptionModel |
toOptionModel(java.lang.String input)
Converts a string to an OptionModel. |
|
static
|
toOptionModels(java.util.List<E> input)
Processes a list input into a series of objects compatible with toOptionModel(Object). |
|
static
|
toOptionModels(java.util.Map<K,V> input)
Processes a map input into a series of map entries compatible with toOptionModel(Map.Entry). |
|
static java.util.List<OptionModel> |
toOptionModels(java.lang.String input)
Parses a string input into a series of value=label pairs compatible with toOptionModel(String). |
|
static
|
toSelectModel(java.util.List<E> input)
Wraps the result of toOptionModels(List) as a SelectModel (with no option groups). |
|
static
|
toSelectModel(java.util.Map<K,V> input)
Wraps the result of toOptionModels(Map) as a SelectModel (with no option groups). |
|
static SelectModel |
toSelectModel(java.lang.String input)
Wraps the result of toOptionModels(String) as a SelectModel (with no option groups). |
|
static java.lang.String |
toUserPresentable(java.lang.String id)
Capitalizes the string, and inserts a space before each upper case character (or sequence of upper case characters). |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static Mapper<Asset,StylesheetLink> assetToStylesheetLink
Flow.map(org.apache.tapestry5.func.Mapper)
| Constructor Detail |
|---|
public TapestryInternalUtils()
| Method Detail |
|---|
public static java.lang.String toUserPresentable(java.lang.String id)
public static java.util.Map<java.lang.String,java.lang.String> mapFromKeysAndValues(java.lang.String... keysAndValues)
public static OptionModel toOptionModel(java.lang.String input)
OptionModel. The string is of the form "value=label". If the equals sign is
omitted, then the same value is used for both value and label.
public static java.util.List<OptionModel> toOptionModels(java.lang.String input)
toOptionModel(String). Splits
on commas. Ignores whitespace around commas.
input - comma seperated list of terms
public static SelectModel toSelectModel(java.lang.String input)
toOptionModels(String) as a SelectModel (with no option groups).
public static OptionModel toOptionModel(java.util.Map.Entry input)
OptionModel.
public static <K,V> java.util.List<OptionModel> toOptionModels(java.util.Map<K,V> input)
toOptionModel(Map.Entry).
input - map of elements
public static <K,V> SelectModel toSelectModel(java.util.Map<K,V> input)
toOptionModels(Map) as a SelectModel (with no option groups).
public static OptionModel toOptionModel(java.lang.Object input)
OptionModel.
public static <E> java.util.List<OptionModel> toOptionModels(java.util.List<E> input)
toOptionModel(Object).
input - list of elements
public static <E> SelectModel toSelectModel(java.util.List<E> input)
toOptionModels(List) as a SelectModel (with no option groups).
public static KeyValue parseKeyValue(java.lang.String input)
KeyValue.
public static java.lang.String extractIdFromPropertyExpression(java.lang.String expression)
expression - a property expression
public static java.lang.String defaultLabel(java.lang.String id,
Messages messages,
java.lang.String propertyExpression)
public static java.lang.String lastTerm(java.lang.String input)
public static java.lang.String toClassAttributeValue(java.util.List<java.lang.String> classes)
classes - classes to combine
public static java.lang.String getLabelForEnum(Messages messages,
java.lang.String prefix,
java.lang.Enum value)
messages - the messages to search for the labelprefix - prepended to keyvalue - to get a label for
public static java.lang.String getLabelForEnum(Messages messages,
java.lang.Enum value)
public static <T> boolean isEqual(T left,
T right)
left - value to compare, possibly nullright - value to compare, possibly null
public static java.lang.String[] splitPath(java.lang.String path)
public static java.lang.String[] splitAtCommas(java.lang.String value)
public static void copy(java.io.InputStream in,
java.io.OutputStream out)
throws java.io.IOException
in - source of dataout - sink of data
java.io.IOException
public static boolean isEqual(EventContext left,
EventContext right)
public static Asset2 toAsset2(Asset asset)
public static InternalPropertyConduit toInternalPropertyConduit(PropertyConduit conduit)
public static Orderable<java.lang.String> mixinTypeAndOrder(java.lang.String mixinDef)
mixinDef - the original mixin definition.
public static java.lang.String[] splitMixinConstraints(java.lang.String s)
public static LinkCreationListener2 toLinkCreationListener2(LinkCreationListener delegate)
public static java.lang.String toFileSuffix(java.lang.String fileName)
public static void performIO(OperationTracker tracker,
java.lang.String description,
IOOperation operation)
throws java.io.IOException
java.io.IOException
public static <K,V> V getAndDeref(java.util.Map<K,? extends java.lang.ref.Reference<V>> map,
K key)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||