Skip to content

Commit

Permalink
#17 rough idea of how to implement custom attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
vaadin-miki committed May 6, 2020
1 parent 429b478 commit 24ca23d
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Maven dependency:
<dependency>
<groupId>org.vaadin.miki</groupId>
<artifactId>super-template</artifactId>
<version>0.2.1</version>
<version>0.2.2</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>org.vaadin.miki</groupId>
<artifactId>super-template</artifactId>
<version>0.2.1</version>
<version>0.2.2-SNAPSHOT</version>

<name>Super Template</name>
<description>An extension of PolymerTemplate that reads properties from the template and makes them available on the server side. Requires Vaadin 14.X.</description>
Expand Down
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);

}
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;
}
}

0 comments on commit 24ca23d

Please sign in to comment.