-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
100 changed files
with
9,001 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,10 @@ | ||
# Compiled class file | ||
*.class | ||
|
||
# Log file | ||
.* | ||
*.bak | ||
*.log | ||
|
||
# BlueJ files | ||
*.ctxt | ||
|
||
# Mobile Tools for Java (J2ME) | ||
.mtj.tmp/ | ||
|
||
# Package Files # | ||
*.jar | ||
*.war | ||
*.ear | ||
*.zip | ||
*.tar.gz | ||
*.rar | ||
|
||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | ||
hs_err_pid* | ||
*.diff | ||
*.patch | ||
*.iml | ||
target | ||
eclipse-target | ||
gwt-unitCache | ||
war |
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,14 @@ | ||
= Mature Modular Meta-framework (mmm) | ||
|
||
image:https://raw.github.com/m-m-m/mmm/master/src/site/resources/images/logo.png[logo] | ||
|
||
*Welcome to the wonderful world of http://m-m-m.sourceforge.net/index.html[mmm]* | ||
|
||
== mmm-property | ||
|
||
image:https://travis-ci.org/m-m-m/property.svg?branch=master["build-status",link="https://travis-ci.org/m-m-m/property"] | ||
|
||
The `mmm-property` brings extended property support with build in type reflection and validation support as well as JavaFx compatibility. | ||
|
||
* https://m-m-m.github.io/maven/apidocs/net/sf/mmm/property/api/package-summary.html#package.description[Properties API] | ||
* https://m-m-m.github.io/maven/apidocs/[and much more... ] |
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,32 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>net.sf.m-m-m</groupId> | ||
<artifactId>mmm-property-modules</artifactId> | ||
<version>dev-SNAPSHOT</version> | ||
<relativePath>../modules/pom.xml</relativePath> | ||
</parent> | ||
<artifactId>mmm-property-api</artifactId> | ||
<version>${net.sf.mmm.property.version}</version> | ||
<packaging>jar</packaging> | ||
<name>${project.artifactId}</name> | ||
<description>The API for advanced properties and beans.</description> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>mmm-util-validation</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>mmm-util-json</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>mmm-util-data</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
105 changes: 105 additions & 0 deletions
105
api/src/main/java/net/sf/mmm/property/api/AbstractContainerProperty.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,105 @@ | ||
/* Copyright (c) The m-m-m Team, Licensed under the Apache License, Version 2.0 | ||
* http://www.apache.org/licenses/LICENSE-2.0 */ | ||
package net.sf.mmm.property.api; | ||
|
||
import java.util.function.Supplier; | ||
|
||
import net.sf.mmm.property.api.lang.BooleanProperty; | ||
import net.sf.mmm.property.api.lang.ReadableBooleanProperty; | ||
import net.sf.mmm.property.api.math.IntegerProperty; | ||
import net.sf.mmm.property.api.math.ReadableIntegerProperty; | ||
import net.sf.mmm.property.api.util.ReadableContainerProperty; | ||
import net.sf.mmm.util.reflect.api.GenericType; | ||
import net.sf.mmm.util.validation.base.AbstractValidator; | ||
|
||
/** | ||
* This is the abstract base implementation of {@link WritableProperty} and {@link ReadableContainerProperty}. | ||
* | ||
* @param <V> the generic type of the {@link #getValue() value}. | ||
* | ||
* @author hohwille | ||
* @since 1.0.0 | ||
*/ | ||
public abstract class AbstractContainerProperty<V> extends AbstractValueProperty<V> implements ReadableContainerProperty<V> { | ||
|
||
private final GenericType<? extends V> type; | ||
|
||
private IntegerProperty sizeProperty; | ||
|
||
private BooleanProperty emptyProperty; | ||
|
||
/** | ||
* The constructor. | ||
* | ||
* @param name - see {@link #getName()}. | ||
* @param type - see {@link #getType()}. | ||
* @param bean - see {@link #getBean()}. | ||
*/ | ||
public AbstractContainerProperty(String name, GenericType<? extends V> type, Object bean) { | ||
this(name, type, bean, (AbstractValidator<? super V>) null); | ||
} | ||
|
||
/** | ||
* The constructor. | ||
* | ||
* @param name - see {@link #getName()}. | ||
* @param type - see {@link #getType()}. | ||
* @param bean - see {@link #getBean()}. | ||
* @param validator - see {@link #validate()}. | ||
*/ | ||
public AbstractContainerProperty(String name, GenericType<? extends V> type, Object bean, AbstractValidator<? super V> validator) { | ||
super(name, bean, validator); | ||
this.type = type; | ||
} | ||
|
||
/** | ||
* The constructor. | ||
* | ||
* @param name - see {@link #getName()}. | ||
* @param type - see {@link #getType()}. | ||
* @param bean - see {@link #getBean()}. | ||
* @param expression the {@link Supplier} {@link Supplier#get() providing} the actual {@link #getValue() value}. | ||
*/ | ||
public AbstractContainerProperty(String name, GenericType<? extends V> type, Object bean, Supplier<? extends V> expression) { | ||
super(name, bean, expression); | ||
this.type = type; | ||
} | ||
|
||
@Override | ||
public GenericType<? extends V> getType() { | ||
|
||
return this.type; | ||
} | ||
|
||
@Override | ||
public ReadableIntegerProperty sizeProperty() { | ||
|
||
if (this.sizeProperty == null) { | ||
this.sizeProperty = new IntegerProperty(getName() + ".size", getBean(), () -> Integer.valueOf(size())); | ||
} | ||
return this.sizeProperty; | ||
} | ||
|
||
@Override | ||
public ReadableBooleanProperty emptyProperty() { | ||
|
||
if (this.emptyProperty == null) { | ||
this.emptyProperty = new BooleanProperty(getName() + ".empty", getBean(), () -> Boolean.valueOf(isEmpty())); | ||
} | ||
return this.emptyProperty; | ||
} | ||
|
||
/** | ||
* Invalidates internal properties such as {@link #sizeProperty()} and {@link #emptyProperty()}. | ||
*/ | ||
protected void invalidateProperties() { | ||
|
||
if (this.sizeProperty != null) { | ||
this.sizeProperty.fireValueChangedEvent(); | ||
} | ||
if (this.emptyProperty != null) { | ||
this.emptyProperty.fireValueChangedEvent(); | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.