-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#17 rough idea of how to implement custom attributes
- Loading branch information
1 parent
429b478
commit 24ca23d
Showing
4 changed files
with
34 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/main/java/org/vaadin/miki/supertemplate/ObjectAttributeHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.vaadin.miki.supertemplate; | ||
|
||
import org.jsoup.nodes.Attribute; | ||
import org.jsoup.nodes.Element; | ||
|
||
/** | ||
* A marker interface for objects that can update an attribute. | ||
*/ | ||
@FunctionalInterface | ||
public interface ObjectAttributeHandler { | ||
|
||
/** | ||
* Updates the object, based on the value found in the passed attribute. | ||
* @param object Object to update. | ||
* @param attribute Attribute. | ||
* @param element Element that corresponds to the object, for reference. | ||
* @return {@code true} when the object has been successfully updated, {@code false} otherwise. | ||
*/ | ||
boolean updateObject(Object object, Attribute attribute, Element element); | ||
|
||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/org/vaadin/miki/supertemplate/ReflectionAttributeHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.vaadin.miki.supertemplate; | ||
|
||
import org.jsoup.nodes.Attribute; | ||
import org.jsoup.nodes.Element; | ||
|
||
public class ReflectionAttributeHandler implements ObjectAttributeHandler { | ||
@Override | ||
public boolean updateObject(Object object, Attribute attribute, Element element) { | ||
return false; | ||
} | ||
} |