This file contains hidden or 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
| public class DateAdapter extends XmlAdapter<String, XMLGregorianCalendar> { | |
| @Override | |
| public XMLGregorianCalendar unmarshal(String value) throws Exception { | |
| ... | |
| } | |
| @Override | |
| public String marshal(XMLGregorianCalendar value) throws Exception { | |
| ... |
This file contains hidden or 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
| <faces-config> | |
| xmlns="http://java.sun.com/xml/ns/javaee" | |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| xsi:schemaLocation="http://java.sun.com/xml/ns/javaee java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd" | |
| version="2.0"> | |
| <application> | |
| <el-resolver> | |
| de.openknowledge.extensions.el.FluentELResolver | |
| </el-resolver> | |
| </application> |
This file contains hidden or 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
| class FluentELResolver extends BeanELResolver { | |
| public boolean isReadOnly(ELContext context, Object base, Object property) { | |
| if (base == null || !(property instanceof String)) { | |
| return true; | |
| } | |
| Method method = getFluentMethod(context, base, property.toString()); | |
| if (method == null) { | |
| return true; | |
| } |
This file contains hidden or 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
| class FluentELResolver extends BeanELResolver { | |
| public boolean isReadOnly(ELContext context, Object base, Object property) { | |
| return getFluentMethod(context, base, property.toString()) != null; | |
| } | |
| public void setValue(ELContext context, Object base, Object property, Object value) { | |
| invoke(getFluentMethod(context, base, property.toString), base, value); | |
| } |
This file contains hidden or 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
| @Named("address") | |
| @ConversationScoped | |
| public class AddressBuilder { | |
| ... | |
| } |
This file contains hidden or 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
| public class Address { | |
| public static Builder newAddress() { | |
| return new Address().new Builder(); | |
| } | |
| private String street; | |
| ... | |
| public class Builder { | |
| public Builder ofStreet(String initialStreet) { | |
| street = validateStreet(initialStreet); | |
| return this; |
This file contains hidden or 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
| public class AddressBuilder { | |
| ... | |
| public Address build() { | |
| Address address = new Address(); | |
| address.setStreet(validateStreet(street)); | |
| ... | |
| return address; | |
| } | |
| } |
This file contains hidden or 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
| public class Address { | |
| private String street; | |
| ... | |
| public Address(AddressBuilder builder) { | |
| street = validateStreet(builder.getStreet()); | |
| ... | |
| } | |
| ... | |
| } |
This file contains hidden or 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
| Address address = newAddress() | |
| .forStreetNumber(...).ofStreet(...) | |
| .inCity(...).withZipCode(...) | |
| .lyingInState(...).ofCountry(...) | |
| .build(); |
This file contains hidden or 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
| public class AddressBuilder { | |
| public static AddressBuilder newAddress() { | |
| return new AddressBuilder(); | |
| } | |
| } |