|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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(InputStream in,
OutputStream out)
Copies some content from an input stream to an output stream. |
|
static String |
defaultLabel(String id,
Messages messages,
String propertyExpression)
Looks for a label within the messages based on the id. |
|
static String |
extractIdFromPropertyExpression(String expression)
Used to convert a property expression into a key that can be used to locate various resources (Blocks, messages, etc.). |
|
static
|
getAndDeref(Map<K,? extends Reference<V>> map,
K key)
Extracts a value from a map of references. |
|
static String |
getLabelForEnum(Messages messages,
Enum value)
|
|
static String |
getLabelForEnum(Messages messages,
String prefix,
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 String |
lastTerm(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 Map<String,String> |
mapFromKeysAndValues(String... keysAndValues)
|
|
static Orderable<String> |
mixinTypeAndOrder(String mixinDef)
|
|
static KeyValue |
parseKeyValue(String input)
Parses a key/value pair where the key and the value are seperated by an equals sign. |
|
static void |
performIO(OperationTracker tracker,
String description,
IOOperation operation)
Performs an operation and re-throws the IOException that may occur. |
|
static String[] |
splitAtCommas(String value)
Splits a value around commas. |
|
static String[] |
splitMixinConstraints(String s)
|
|
static String[] |
splitPath(String path)
Splits a path at each slash. |
|
static Asset2 |
toAsset2(Asset asset)
Converts an Asset to an Asset2 if necessary. |
|
static String |
toClassAttributeValue(List<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 String |
toFileSuffix(String fileName)
|
|
static InternalPropertyConduit |
toInternalPropertyConduit(PropertyConduit conduit)
|
|
static LinkCreationListener2 |
toLinkCreationListener2(LinkCreationListener delegate)
|
|
static OptionModel |
toOptionModel(Map.Entry input)
Converts a map entry to an OptionModel . |
|
static OptionModel |
toOptionModel(Object input)
Converts an object to an OptionModel . |
|
static OptionModel |
toOptionModel(String input)
Converts a string to an OptionModel . |
|
static
|
toOptionModels(List<E> input)
Processes a list input into a series of objects compatible with toOptionModel(Object) . |
|
static
|
toOptionModels(Map<K,V> input)
Processes a map input into a series of map entries compatible with toOptionModel(Map.Entry) . |
|
static List<OptionModel> |
toOptionModels(String input)
Parses a string input into a series of value=label pairs compatible with toOptionModel(String) . |
|
static
|
toSelectModel(List<E> input)
Wraps the result of toOptionModels(List) as a SelectModel (with no option groups). |
|
static
|
toSelectModel(Map<K,V> input)
Wraps the result of toOptionModels(Map) as a SelectModel (with no option groups). |
|
static SelectModel |
toSelectModel(String input)
Wraps the result of toOptionModels(String) as a SelectModel (with no option groups). |
|
static String |
toUserPresentable(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 String toUserPresentable(String id)
public static Map<String,String> mapFromKeysAndValues(String... keysAndValues)
public static OptionModel toOptionModel(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 List<OptionModel> toOptionModels(String input)
toOptionModel(String)
. Splits
on commas. Ignores whitespace around commas.
input
- comma seperated list of terms
public static SelectModel toSelectModel(String input)
toOptionModels(String)
as a SelectModel
(with no option groups).
public static OptionModel toOptionModel(Map.Entry input)
OptionModel
.
public static <K,V> List<OptionModel> toOptionModels(Map<K,V> input)
toOptionModel(Map.Entry)
.
input
- map of elements
public static <K,V> SelectModel toSelectModel(Map<K,V> input)
toOptionModels(Map)
as a SelectModel
(with no option groups).
public static OptionModel toOptionModel(Object input)
OptionModel
.
public static <E> List<OptionModel> toOptionModels(List<E> input)
toOptionModel(Object)
.
input
- list of elements
public static <E> SelectModel toSelectModel(List<E> input)
toOptionModels(List)
as a SelectModel
(with no option groups).
public static KeyValue parseKeyValue(String input)
KeyValue
.
public static String extractIdFromPropertyExpression(String expression)
expression
- a property expression
public static String defaultLabel(String id, Messages messages, String propertyExpression)
public static String lastTerm(String input)
public static String toClassAttributeValue(List<String> classes)
classes
- classes to combine
public static String getLabelForEnum(Messages messages, String prefix, Enum value)
messages
- the messages to search for the labelprefix
- prepended to keyvalue
- to get a label for
public static String getLabelForEnum(Messages messages, Enum value)
public static <T> boolean isEqual(T left, T right)
left
- value to compare, possibly nullright
- value to compare, possibly null
public static String[] splitPath(String path)
public static String[] splitAtCommas(String value)
public static void copy(InputStream in, OutputStream out) throws IOException
in
- source of dataout
- sink of data
IOException
public static boolean isEqual(EventContext left, EventContext right)
public static Asset2 toAsset2(Asset asset)
public static InternalPropertyConduit toInternalPropertyConduit(PropertyConduit conduit)
public static Orderable<String> mixinTypeAndOrder(String mixinDef)
mixinDef
- the original mixin definition.
public static String[] splitMixinConstraints(String s)
public static LinkCreationListener2 toLinkCreationListener2(LinkCreationListener delegate)
public static String toFileSuffix(String fileName)
public static void performIO(OperationTracker tracker, String description, IOOperation operation) throws IOException
IOException
public static <K,V> V getAndDeref(Map<K,? extends Reference<V>> map, K key)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |