Package com.vaadin.copilot.javarewriter
Class FlowComponentQuirks
java.lang.Object
com.vaadin.copilot.javarewriter.FlowComponentQuirks
This class contains hacks related to Flow components and how they work.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanchildrenGeneratesData(JavaComponent parent, JavaComponent child) Returns true if child is not a component but an item that is used in DataProvider.static ObjectcomponentSpecificValueMapping(Class<?> componentType, String prop, Object value) Rewrites the value of a property for a specific component type.static StringconvertReactPropertyToJavaSetter(String property, Class<?> type) Converts a React property name to a Java setter method name.static StringgetClassForTag(String tag) Returns the Java class name for a given HTML tag.static booleanhasSetItemsProps(JavaComponent component) Checks the given component has items property and supported.static booleanisInvertedBoolean(String property, Class<?> type) static booleanskipProps(JavaComponent component, String propKey)
-
Method Details
-
getClassForTag
Returns the Java class name for a given HTML tag.- Parameters:
tag- the HTML tag- Returns:
- the Java class name
-
componentSpecificValueMapping
public static Object componentSpecificValueMapping(Class<?> componentType, String prop, Object value) Rewrites the value of a property for a specific component type.- Parameters:
componentType- the component typeprop- the property namevalue- the property value- Returns:
- the rewritten value or the original value if no rewriting is needed
-
convertReactPropertyToJavaSetter
Converts a React property name to a Java setter method name.Used to map React properties to Java setters when the react property API does not match the Java API.
- Parameters:
property- the property nametype- the component type- Returns:
- the Java setter method name or
nullif no mapping is found
-
isInvertedBoolean
-
childrenGeneratesData
Returns true if child is not a component but an item that is used in DataProvider.- Parameters:
parent- Parent componentchild- Child definition- Returns:
- true if it is, false otherwise.
-
hasSetItemsProps
Checks the given component has items property and supported.- Parameters:
component- component which has tag and props.- Returns:
- true if component tag is listed in supported list and has items property, false otherwise.
-
skipProps
-