http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/metrics/MetricsCounterFactory.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsCounterFactory.java b/core/api/src/main/java/org/apache/zest/api/metrics/MetricsCounterFactory.java deleted file mode 100644 index 5941c39..0000000 --- a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsCounterFactory.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package org.apache.zest.api.metrics; - -/** - * Create MetricsCounter instances. - */ -public interface MetricsCounterFactory extends MetricsFactory -{ - /** - * Create a MetricsCounter instance. - * If the same arguments are given twice, the same instance must be returned. - * - * @param name A human readable, short name of the metric. - * - * @return A Metric instance to be used, OR org.apache.zest.spi.metrics.DefaultMetric.NULL if not supported. - */ - MetricsCounter createCounter( String name ); -}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/metrics/MetricsFactory.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsFactory.java b/core/api/src/main/java/org/apache/zest/api/metrics/MetricsFactory.java deleted file mode 100644 index 175f1b6..0000000 --- a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsFactory.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package org.apache.zest.api.metrics; - -import java.util.stream.Stream; - -/** - * Metrics Factory. - */ -public interface MetricsFactory -{ - Stream<Metric> registered(); -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/metrics/MetricsGauge.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsGauge.java b/core/api/src/main/java/org/apache/zest/api/metrics/MetricsGauge.java deleted file mode 100644 index e19410f..0000000 --- a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsGauge.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package org.apache.zest.api.metrics; - -/** - * MetricsGauge is the most basic Metric type, and is completely flexible and therefor handled slightly differently in - * the MetricsFactory than all other Gauges. It needs to pass on custom code, so the implementation is typically - * an anonymous class, inlined at the implementation. - * - * @param <T> Any type holding the MetricsGauge's current value. - */ -public interface MetricsGauge<T> extends Metric -{ - /** - * Returns the metric's current value. - * - * @return the metric's current value - */ - T value(); -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/metrics/MetricsGaugeFactory.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsGaugeFactory.java b/core/api/src/main/java/org/apache/zest/api/metrics/MetricsGaugeFactory.java deleted file mode 100644 index a5213f6..0000000 --- a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsGaugeFactory.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package org.apache.zest.api.metrics; - -/** - * Register MetricsGauge with the underlying Metrics system. - */ -public interface MetricsGaugeFactory extends MetricsFactory -{ - /** - * Register a MetricsGauge with the underlying Metrics system. - * - * @param name A human readable, short name of the metric. - * @param gauge The implementation of the MetricsGauge. - * @param <T> Any type holding the MetricsGauge's current value. - * - * @return The same MetricsGauge or the DefaultMetric.NULL MetricsGauge instance. - */ - <T> MetricsGauge<T> registerGauge( String name, MetricsGauge<T> gauge ); -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/metrics/MetricsHealthCheck.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsHealthCheck.java b/core/api/src/main/java/org/apache/zest/api/metrics/MetricsHealthCheck.java deleted file mode 100644 index 4c97e66..0000000 --- a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsHealthCheck.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package org.apache.zest.api.metrics; - -/** - * Metrics Health Check. - */ -public interface MetricsHealthCheck extends Metric -{ - Result check() - throws Exception; - - final class Result - { - private final boolean healthy; - private final String message; - private final Throwable exception; - - public Result( boolean isHealthy, String message, Throwable exception ) - { - healthy = isHealthy; - this.message = message; - this.exception = exception; - } - - public boolean isHealthy() - { - return healthy; - } - - public String getMessage() - { - return message; - } - - public Throwable getException() - { - return exception; - } - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/metrics/MetricsHealthCheckFactory.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsHealthCheckFactory.java b/core/api/src/main/java/org/apache/zest/api/metrics/MetricsHealthCheckFactory.java deleted file mode 100644 index ccc3bf8..0000000 --- a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsHealthCheckFactory.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package org.apache.zest.api.metrics; - -/** - * Create MetricsHealthCheck instances. - */ -public interface MetricsHealthCheckFactory extends MetricsFactory -{ - /** - * Create a MetricsHealthCheck instance. - * If the same arguments are given twice, the same instance must be returned. - * - * @param name A human readable, short name of the metric. - * @param check The health check to be performed regularly. - * - * @return A MetricsHealthCheck instance to be used, OR org.apache.zest.spi.metrics.DefaultMetric.NULL if not supported. - * - */ - MetricsHealthCheck registerHealthCheck( String name, MetricsHealthCheck check ); -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/metrics/MetricsHistogram.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsHistogram.java b/core/api/src/main/java/org/apache/zest/api/metrics/MetricsHistogram.java deleted file mode 100644 index 6fa7a5d..0000000 --- a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsHistogram.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package org.apache.zest.api.metrics; - -/** - * A metric which calculates the distribution of a value. - * - * @see <a href="http://www.johndcook.com/standard_deviation.html">Accurately computing running variance</a> - */ -public interface MetricsHistogram extends Metric -{ - void update( long newValue ); -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/metrics/MetricsHistogramFactory.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsHistogramFactory.java b/core/api/src/main/java/org/apache/zest/api/metrics/MetricsHistogramFactory.java deleted file mode 100644 index 44e2c8c..0000000 --- a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsHistogramFactory.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package org.apache.zest.api.metrics; - -/** - * Create MetricsHistogram instances. - */ -public interface MetricsHistogramFactory extends MetricsFactory -{ - /** - * Create a MetricsHistogram instance. - * If the same arguments are given twice, the same instance must be returned. - * - * @param name A human readable, short name of the metric. - * - * @return A Metric instance to be used, OR org.apache.zest.spi.metrics.DefaultMetric.NULL if not supported. - * - */ - MetricsHistogram createHistogram( String name ); -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/metrics/MetricsMeter.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsMeter.java b/core/api/src/main/java/org/apache/zest/api/metrics/MetricsMeter.java deleted file mode 100644 index 207c1fd..0000000 --- a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsMeter.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package org.apache.zest.api.metrics; - -/** - * A meter metric which measures mean throughput and one-, five-, and fifteen-minute - * exponentially-weighted moving average throughputs. - * - * @see <a href="http://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average">EMA</a> - */ -public interface MetricsMeter extends Metric -{ - void mark(); - - /** - * Mark the occurrence of a given number of events. - * - * @param numberOfEvents the number of events - */ - void mark( int numberOfEvents ); -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/metrics/MetricsMeterFactory.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsMeterFactory.java b/core/api/src/main/java/org/apache/zest/api/metrics/MetricsMeterFactory.java deleted file mode 100644 index cad8f57..0000000 --- a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsMeterFactory.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package org.apache.zest.api.metrics; - -/** - * Create MetricsMeter instances. - */ -public interface MetricsMeterFactory extends MetricsFactory -{ - /** - * Create a MetricsMeter instance. - * If the same arguments are given twice, the same instance must be returned. - * - * @param name A human readable, short name of the metric. - * - * @return A Metric instance to be used, OR org.apache.zest.spi.metrics.DefaultMetric.NULL if not supported. - */ - MetricsMeter createMeter( String name ); -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/metrics/MetricsNotSupportedException.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsNotSupportedException.java b/core/api/src/main/java/org/apache/zest/api/metrics/MetricsNotSupportedException.java deleted file mode 100644 index 9fa318d..0000000 --- a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsNotSupportedException.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ -package org.apache.zest.api.metrics; - -/** - * Thrown when the underlying MetricsProvider do not support a Metric type. - */ -public class MetricsNotSupportedException extends RuntimeException -{ - public MetricsNotSupportedException( Class<? extends MetricsFactory> factoryType, - Class<? extends MetricsProvider> providerType - ) - { - super( "Metrics [" + factoryType.getName() + "] is not supported by MetricsProvider [" + providerType.getName() + "]." ); - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/metrics/MetricsProvider.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsProvider.java b/core/api/src/main/java/org/apache/zest/api/metrics/MetricsProvider.java deleted file mode 100644 index 6473b8d..0000000 --- a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsProvider.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package org.apache.zest.api.metrics; - -/** - * Metrics Provider SPI. - * <p> - * The Polygene Runtime will automatically look for a service that implements the MetricsProvider interface - * and use it for internal Runtime metrics, such as the UnitOfWork measuring the time from creation to close. - * </p> - * <p> - * The Metrics Library is available to add metric functionality to applications in the same way, and - * will use the same MetricsProvider. - * </p> - * <p> - * Note that the usual visibility rules applies, so you might have more than one MetricsProvider server, - * perhaps per layer. - * </p> - */ -public interface MetricsProvider -{ - /** - * Creates a new factory instance. - * - * The instantiation is done by providing a Metric type, which is one of - * <ul> - * <li>{@link MetricsCounter}</li> - * <li>{@link MetricsGauge}</li> - * <li>{@link MetricsHealthCheck}</li> - * <li>{@link MetricsHistogram}</li> - * <li>{@link MetricsMeter}</li> - * <li>{@link MetricsTimer}</li> - * </ul> - * - * @param factoryType The class of the metric type needed. - * @param <T> The metric type requested. - * - * @return A factory instance - * - * @throws MetricsNotSupportedException when the MetricsProvider is not supporting the factory type requested. - */ - <T extends MetricsFactory> T createFactory( Class<T> factoryType ) - throws MetricsNotSupportedException; -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/metrics/MetricsTimer.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsTimer.java b/core/api/src/main/java/org/apache/zest/api/metrics/MetricsTimer.java deleted file mode 100644 index a302dbe..0000000 --- a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsTimer.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package org.apache.zest.api.metrics; - -/** - * Timer Metrics. - */ -public interface MetricsTimer extends Metric -{ - /** - * Start the Timer Metrics. - */ - Context start(); - - /** - * Timer Metrics Context. - */ - interface Context - { - /** - * Stop the Timer Metrics. - */ - void stop(); - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/metrics/MetricsTimerFactory.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsTimerFactory.java b/core/api/src/main/java/org/apache/zest/api/metrics/MetricsTimerFactory.java deleted file mode 100644 index 3139a19..0000000 --- a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsTimerFactory.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package org.apache.zest.api.metrics; - -/** - * Create MetricsTimer instances. - */ -public interface MetricsTimerFactory extends MetricsFactory -{ - /** - * Create a MetricsTimer instance. - * If the same arguments are given twice, the same instance must be returned. - * - * @param name A human readable, short name of the metric. - * - * @return A Metric instance to be used, OR org.apache.zest.spi.metrics.DefaultMetric.NULL if not supported. - * - */ - MetricsTimer createTimer( String name ); -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/metrics/package.html ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/metrics/package.html b/core/api/src/main/java/org/apache/zest/api/metrics/package.html deleted file mode 100644 index 3657fe5..0000000 --- a/core/api/src/main/java/org/apache/zest/api/metrics/package.html +++ /dev/null @@ -1,24 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - ~ - ~ - --> -<html> - <body> - <h2>Metrics API.</h2> - </body> -</html> http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/mixin/Initializable.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/mixin/Initializable.java b/core/api/src/main/java/org/apache/zest/api/mixin/Initializable.java deleted file mode 100644 index 04c6b91..0000000 --- a/core/api/src/main/java/org/apache/zest/api/mixin/Initializable.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package org.apache.zest.api.mixin; - -/** - * Fragments which want to be initialized can implement - * this callback interface. It will be invoked after - * the fragment has bee instantiated and all injections have been done. - */ -public interface Initializable -{ - /** - * Initialize the fragment - * - * @throws Exception if something went wrong - */ - void initialize() throws Exception; -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/mixin/InitializationException.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/mixin/InitializationException.java b/core/api/src/main/java/org/apache/zest/api/mixin/InitializationException.java deleted file mode 100644 index 3826779..0000000 --- a/core/api/src/main/java/org/apache/zest/api/mixin/InitializationException.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ -package org.apache.zest.api.mixin; - -/** - * Thrown when a Fragment or object could not be initialized. - */ -public class InitializationException - extends RuntimeException -{ - private static final long serialVersionUID = 1L; - - public InitializationException() - { - } - - public InitializationException( String message, Throwable cause ) - { - super( message, cause ); - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/mixin/InvalidMixinException.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/mixin/InvalidMixinException.java b/core/api/src/main/java/org/apache/zest/api/mixin/InvalidMixinException.java deleted file mode 100644 index 1c5687a..0000000 --- a/core/api/src/main/java/org/apache/zest/api/mixin/InvalidMixinException.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package org.apache.zest.api.mixin; - -import java.lang.reflect.Method; - -/** - * This exception is thrown if a Mixin is invalid (missing method implementation). - */ -public class InvalidMixinException - extends RuntimeException -{ - public InvalidMixinException( Class mixinClass, Method method ) - { - super( mixinClass.getName() + "does not have a method implementation for " + method ); - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/mixin/MixinDescriptor.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/mixin/MixinDescriptor.java b/core/api/src/main/java/org/apache/zest/api/mixin/MixinDescriptor.java deleted file mode 100644 index 1b60d6a..0000000 --- a/core/api/src/main/java/org/apache/zest/api/mixin/MixinDescriptor.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package org.apache.zest.api.mixin; - -/** - * Mixin Descriptor. - */ -public interface MixinDescriptor -{ - Class<?> mixinClass(); -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/mixin/MixinMappingException.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/mixin/MixinMappingException.java b/core/api/src/main/java/org/apache/zest/api/mixin/MixinMappingException.java deleted file mode 100644 index 3306c5a..0000000 --- a/core/api/src/main/java/org/apache/zest/api/mixin/MixinMappingException.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ -package org.apache.zest.api.mixin; - -/** - * This Exception is thrown when it is not possible to map the MixinType to a valid - * CompositeType. - */ -public class MixinMappingException - extends RuntimeException -{ - private static final long serialVersionUID = 6843167709252705294L; - - public MixinMappingException( String message ) - { - super( message ); - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/mixin/Mixins.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/mixin/Mixins.java b/core/api/src/main/java/org/apache/zest/api/mixin/Mixins.java deleted file mode 100644 index 3bc325a..0000000 --- a/core/api/src/main/java/org/apache/zest/api/mixin/Mixins.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package org.apache.zest.api.mixin; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * This annotation is used in composites to declare mixin implementation classes. - * <p> - * Mixins tells the runtime which implementation class of a Mixin should be - * used. The @Mixins annotation can occur at any level in the composite hierarchy - * and the runtime will match each found Mixin implementation against a Mixins annotation. - * All mixin interfaces must have a Mixin implementation in the composite hierarchy or - * a runtime exception will occur. - * </p> - * <p> - * Example; - * </p> - * <pre><code> - * - * @Mixins( MyBeerOrder.class ) - * public interface BeerOrderComposite extends BeerOrder, Composite - * { - * } - * - * public class MyBeerOrder - * implements BeerOrder - * { - * : - * } - * </code></pre> - * <p> - * Many implementations can be listed, - * </p> - * <pre><code> - * @Mixins( { MyBeerOrder.class, DescriptionImpl.class } ) - * public interface BeerOrderComposite extends BeerOrder, Description, Composite - * { - * } - * </code></pre> - * <p> - * If the Mixins is a class that implements InvocationHandler, it will be - * used for all mixins. To avoid that an invocation handler based implementation - * not service all mixin, use the AppliesTo annotation. - * </p> - * - * <p> - * It is valid to have multiple Mixins for a mixin. The first one found - * will be used. The search order is in the order they are written in the Mixins - * annotation left-to-right, and depth-first recursive search of the super-interfaces again - * left-to-right. - * </p> - * - * @see org.apache.zest.api.common.AppliesTo - */ -@Retention( RetentionPolicy.RUNTIME ) -@Target( ElementType.TYPE ) -@Documented -public @interface Mixins -{ - Class<?>[] value(); -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/mixin/NoopMixin.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/mixin/NoopMixin.java b/core/api/src/main/java/org/apache/zest/api/mixin/NoopMixin.java deleted file mode 100644 index 7f7490a..0000000 --- a/core/api/src/main/java/org/apache/zest/api/mixin/NoopMixin.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package org.apache.zest.api.mixin; - -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; - -/** - * Generic mixin that is a no-op. Can be useful if the functionality - * of a method is mainly provided by concerns and side-effects. - */ -public final class NoopMixin - implements InvocationHandler -{ - private static final Boolean BOOLEAN_DEFAULT = Boolean.FALSE; - private static final Short SHORT_DEFAULT = 0; - private static final Character CHARACTER_DEFAULT = 0; - private static final Integer INTEGER_DEFAULT = 0; - private static final Long LONG_DEFAULT = 0L; - private static final Float FLOAT_DEFAULT = 0f; - private static final Double DOUBLE_DEFAULT = 0.0; - - @Override - public Object invoke( Object object, Method method, Object[] args ) - throws Throwable - { - Class<?> retType = method.getReturnType(); - if( !retType.isPrimitive() ) - { - return null; - } - if( Void.TYPE == retType ) - { - return null; - } - if( Boolean.TYPE == retType ) - { - return BOOLEAN_DEFAULT; - } - if( Short.TYPE == retType ) - { - return SHORT_DEFAULT; - } - if( Character.TYPE == retType ) - { - return CHARACTER_DEFAULT; - } - if( Integer.TYPE == retType ) - { - return INTEGER_DEFAULT; - } - if( Long.TYPE == retType ) - { - return LONG_DEFAULT; - } - if( Float.TYPE == retType ) - { - return FLOAT_DEFAULT; - } - if( Double.TYPE == retType ) - { - return DOUBLE_DEFAULT; - } - return null; - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/mixin/package.html ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/mixin/package.html b/core/api/src/main/java/org/apache/zest/api/mixin/package.html deleted file mode 100644 index 7c916a3..0000000 --- a/core/api/src/main/java/org/apache/zest/api/mixin/package.html +++ /dev/null @@ -1,24 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - ~ - ~ - --> -<html> - <body> - <h2>Mixin API.</h2> - </body> -</html> http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/object/NoSuchObjectException.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/object/NoSuchObjectException.java b/core/api/src/main/java/org/apache/zest/api/object/NoSuchObjectException.java deleted file mode 100644 index 075d697..0000000 --- a/core/api/src/main/java/org/apache/zest/api/object/NoSuchObjectException.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ -package org.apache.zest.api.object; - -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.zest.api.common.InvalidApplicationException; - -/** - * This exception is thrown if no visible Object of the requested type can be found. - */ -public class NoSuchObjectException - extends InvalidApplicationException -{ - private static final long serialVersionUID = -1121690536365682511L; - - private final String objectType; - private final String moduleName; - - public NoSuchObjectException( String type, String moduleName, Stream<Class<?>> visible ) - { - super( "Could not find any visible Object of type [" + type + "] in module [" - + moduleName - + "]. The visible types are: \n" - + visible.map( Class::getName ).collect( Collectors.joining("\n") ) - ); - this.objectType = type; - this.moduleName = moduleName; - } - - public String objectType() - { - return objectType; - } - - public String moduleName() - { - return moduleName; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/object/ObjectDescriptor.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/object/ObjectDescriptor.java b/core/api/src/main/java/org/apache/zest/api/object/ObjectDescriptor.java deleted file mode 100644 index 733a790..0000000 --- a/core/api/src/main/java/org/apache/zest/api/object/ObjectDescriptor.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package org.apache.zest.api.object; - -import org.apache.zest.api.composite.ModelDescriptor; - -/** - * Object Descriptor. - */ -public interface ObjectDescriptor - extends ModelDescriptor -{ -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/object/ObjectFactory.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/object/ObjectFactory.java b/core/api/src/main/java/org/apache/zest/api/object/ObjectFactory.java deleted file mode 100644 index d694c48..0000000 --- a/core/api/src/main/java/org/apache/zest/api/object/ObjectFactory.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ -package org.apache.zest.api.object; - -import org.apache.zest.api.common.ConstructionException; - -/** - * This factory creates and injects POJO's. - */ -public interface ObjectFactory -{ - /** - * Create new objects of the given type. - * - * @param type an object class which will be instantiated. - * - * @return new objects. - * - * @throws ConstructionException Thrown if instantiation fails. - * @throws NoSuchObjectException Thrown if {@code type} class is not an object. - */ - <T> T newObject( Class<T> type, Object... uses ) - throws NoSuchObjectException, ConstructionException; - - /** - * Inject an existing instance. Only fields and methods will be called. - * - * @param instance instance - * @param uses dependencies - * - * @throws ConstructionException if it was not possible to construct the Object dependencies - */ - void injectTo( Object instance, Object... uses ) - throws ConstructionException; -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/object/package.html ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/object/package.html b/core/api/src/main/java/org/apache/zest/api/object/package.html deleted file mode 100644 index 6956f39..0000000 --- a/core/api/src/main/java/org/apache/zest/api/object/package.html +++ /dev/null @@ -1,24 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - ~ - ~ - --> -<html> - <body> - <h2>Object API.</h2> - </body> -</html> http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/package.html ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/package.html b/core/api/src/main/java/org/apache/zest/api/package.html deleted file mode 100644 index 1964935..0000000 --- a/core/api/src/main/java/org/apache/zest/api/package.html +++ /dev/null @@ -1,24 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - ~ - ~ - --> -<html> - <body> - <h2>Apache Polygene⢠API.</h2> - </body> -</html> http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/property/DefaultValues.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/property/DefaultValues.java b/core/api/src/main/java/org/apache/zest/api/property/DefaultValues.java deleted file mode 100644 index 8eb5c09..0000000 --- a/core/api/src/main/java/org/apache/zest/api/property/DefaultValues.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package org.apache.zest.api.property; - -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Set; - -/** - * Default values for various property types - */ -public final class DefaultValues -{ - private static final Map<Type, Object> DEFAULT_VALUES = new HashMap<Type, Object>(); - - static - { - DEFAULT_VALUES.put( Byte.class, 0 ); - DEFAULT_VALUES.put( Short.class, 0 ); - DEFAULT_VALUES.put( Character.class, 0 ); - DEFAULT_VALUES.put( Integer.class, 0 ); - DEFAULT_VALUES.put( Long.class, 0L ); - DEFAULT_VALUES.put( Double.class, 0D ); - DEFAULT_VALUES.put( Float.class, 0F ); - DEFAULT_VALUES.put( Boolean.class, false ); - DEFAULT_VALUES.put( String.class, "" ); - } - - public static Object getDefaultValueOf( Type type ) - { - Object value = DEFAULT_VALUES.get( type ); - if( value != null ) - { - return value; - } - if( type instanceof ParameterizedType ) - { - // List<Foo> -> List - type = ( (ParameterizedType) type ).getRawType(); - } - - if( type instanceof Class ) - { - Class typeAsClass = (Class) type; - if( Set.class.isAssignableFrom( typeAsClass ) ) - { - return new HashSet(); - } - else if( Map.class.isAssignableFrom( typeAsClass ) ) - { - return new LinkedHashMap(); - } - else if( Collection.class.isAssignableFrom( typeAsClass ) ) - { - return new ArrayList(); - } - else if( typeAsClass.isEnum() ) - { - return ( (Class) type ).getEnumConstants()[ 0 ]; - } - } - throw new IllegalArgumentException( "Cannot use @UseDefaults with type " + type.toString() ); - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/property/GenericPropertyInfo.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/property/GenericPropertyInfo.java b/core/api/src/main/java/org/apache/zest/api/property/GenericPropertyInfo.java deleted file mode 100644 index 0efb64d..0000000 --- a/core/api/src/main/java/org/apache/zest/api/property/GenericPropertyInfo.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ -package org.apache.zest.api.property; - -import java.lang.reflect.AccessibleObject; -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; - -import static org.apache.zest.api.util.Classes.typeOf; - -/** - * Generic Property info utility class. - */ -public final class GenericPropertyInfo -{ - public static Type propertyTypeOf( AccessibleObject accessor ) - { - return toPropertyType( typeOf( accessor ) ); - } - - public static Type toPropertyType( Type methodReturnType ) - { - if( methodReturnType instanceof ParameterizedType ) - { - ParameterizedType parameterizedType = (ParameterizedType) methodReturnType; - if( Property.class.isAssignableFrom( (Class<?>) parameterizedType.getRawType() ) ) - { - return parameterizedType.getActualTypeArguments()[ 0 ]; - } - } - - if( methodReturnType instanceof Class<?> ) - { - Type[] interfaces = ( (Class<?>) methodReturnType ).getGenericInterfaces(); - for( Type anInterface : interfaces ) - { - Type propertyType = toPropertyType( anInterface ); - if( propertyType != null ) - { - return propertyType; - } - } - } - return null; - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/property/Immutable.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/property/Immutable.java b/core/api/src/main/java/org/apache/zest/api/property/Immutable.java deleted file mode 100644 index 964140f..0000000 --- a/core/api/src/main/java/org/apache/zest/api/property/Immutable.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package org.apache.zest.api.property; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * This annotation adds Immutability to Types, Properties and Associations - */ -@Retention( RetentionPolicy.RUNTIME ) -@Target( { ElementType.TYPE, ElementType.METHOD } ) -@Documented -public @interface Immutable -{ -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/property/InvalidPropertyTypeException.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/property/InvalidPropertyTypeException.java b/core/api/src/main/java/org/apache/zest/api/property/InvalidPropertyTypeException.java deleted file mode 100644 index e14ec15..0000000 --- a/core/api/src/main/java/org/apache/zest/api/property/InvalidPropertyTypeException.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ -package org.apache.zest.api.property; - -import java.lang.reflect.AccessibleObject; -import org.apache.zest.api.common.ConstructionException; - -/** - * Thrown when attempting to subclass Property. - */ -public class InvalidPropertyTypeException extends ConstructionException -{ - public InvalidPropertyTypeException( AccessibleObject accessor ) - { - super( createMessage(accessor) ); - } - - private static String createMessage( AccessibleObject accessor ) - { - StringBuilder builder = new StringBuilder(); - builder.append( "Not allowed to subclass " + Property.class.getName() + ". Property accessor " + accessor + " is returning a Property subclass." ); - return builder.toString(); - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/property/Numbers.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/property/Numbers.java b/core/api/src/main/java/org/apache/zest/api/property/Numbers.java deleted file mode 100644 index 515214b..0000000 --- a/core/api/src/main/java/org/apache/zest/api/property/Numbers.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package org.apache.zest.api.property; - -import java.math.BigDecimal; - -/** - * Convenience class for mathematical operations on numerical properties. - * <pre>import static org.apache.zest.api.property.Numbers.*; - * ... - * add( object.numberProperty(), 5 );</pre> - */ -public final class Numbers -{ - // Integer operations - - public static Property<Integer> add( Property<Integer> property, int amount ) - { - property.set( property.get() + amount ); - return property; - } - - public static Property<Integer> mult( Property<Integer> property, int amount ) - { - property.set( property.get() * amount ); - return property; - } - - public static Property<Integer> sub( Property<Integer> property, int amount ) - { - property.set( property.get() - amount ); - return property; - } - - public static Property<Integer> div( Property<Integer> property, int amount ) - { - property.set( property.get() / amount ); - return property; - } - - // Long operations - - public static Property<Long> add( Property<Long> property, long amount ) - { - property.set( property.get() + amount ); - return property; - } - - public static Property<Long> mult( Property<Long> property, long amount ) - { - property.set( property.get() * amount ); - return property; - } - - public static Property<Long> sub( Property<Long> property, long amount ) - { - property.set( property.get() - amount ); - return property; - } - - public static Property<Long> div( Property<Long> property, long amount ) - { - property.set( property.get() / amount ); - return property; - } - - // Double operations - - public static Property<Double> add( Property<Double> property, double amount ) - { - property.set( property.get() + amount ); - return property; - } - - public static Property<Double> mult( Property<Double> property, double amount ) - { - property.set( property.get() * amount ); - return property; - } - - public static Property<Double> sub( Property<Double> property, double amount ) - { - property.set( property.get() - amount ); - return property; - } - - public static Property<Double> div( Property<Double> property, double amount ) - { - property.set( property.get() / amount ); - return property; - } - - // Float operations - - public static Property<Float> add( Property<Float> property, float amount ) - { - property.set( property.get() + amount ); - return property; - } - - public static Property<Float> mult( Property<Float> property, float amount ) - { - property.set( property.get() * amount ); - return property; - } - - public static Property<Float> sub( Property<Float> property, float amount ) - { - property.set( property.get() - amount ); - return property; - } - - public static Property<Float> div( Property<Float> property, float amount ) - { - property.set( property.get() / amount ); - return property; - } - - // BigDecimal operations - - public static Property<BigDecimal> add( Property<BigDecimal> property, BigDecimal amount ) - { - property.set( property.get().add( amount ) ); - return property; - } - - public static Property<BigDecimal> mult( Property<BigDecimal> property, BigDecimal amount ) - { - property.set( property.get().multiply( amount ) ); - return property; - } - - public static Property<BigDecimal> sub( Property<BigDecimal> property, BigDecimal amount ) - { - property.set( property.get().subtract( amount ) ); - return property; - } - - public static Property<BigDecimal> div( Property<BigDecimal> property, BigDecimal amount ) - { - property.set( property.get().divide( amount ) ); - return property; - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/property/Property.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/property/Property.java b/core/api/src/main/java/org/apache/zest/api/property/Property.java deleted file mode 100644 index 1c351cd..0000000 --- a/core/api/src/main/java/org/apache/zest/api/property/Property.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ -package org.apache.zest.api.property; - -/** - * Properties are declared in Composite interfaces by using this interface. - * <p> - * It creates a first-class object for the property from which you can get and set the value, and access any - * metadata about it. - * </p> - * <p>The type of the Property can be one of the following:</p> - * <ul> - * <li> A boxed primitive (Long,Integer,Boolean, etc.)</li> - * <li> String</li> - * <li> BigInteger</li> - * <li> BigDecimal</li> - * <li> Date</li> - * <li> DateTime (Joda Time)</li> - * <li> LocalDateTime (Joda Time)</li> - * <li> A serializable</li> - * <li> A ValueComposite</li> - * <li> A List, Set or Collection of any of the above</li> - * </ul> - * - * @param <T> Parameterized type of the Property - */ -public interface Property<T> -{ - /** - * Get the value of the property. - * - * @return the value - */ - T get(); - - /** - * Set the value of the property - * - * @param newValue the new value - * - * @throws IllegalArgumentException if the value has an invalid value - * @throws IllegalStateException if the property is immutable - */ - void set( T newValue ) - throws IllegalArgumentException, IllegalStateException; -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/property/PropertyDescriptor.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/property/PropertyDescriptor.java b/core/api/src/main/java/org/apache/zest/api/property/PropertyDescriptor.java deleted file mode 100644 index 97f9083..0000000 --- a/core/api/src/main/java/org/apache/zest/api/property/PropertyDescriptor.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package org.apache.zest.api.property; - -import java.lang.reflect.AccessibleObject; -import java.lang.reflect.Type; -import org.apache.zest.api.common.QualifiedName; -import org.apache.zest.api.structure.MetaInfoHolder; -import org.apache.zest.api.structure.Module; -import org.apache.zest.api.structure.ModuleDescriptor; -import org.apache.zest.api.type.ValueType; - -/** - * Property Descriptor. - */ -public interface PropertyDescriptor extends MetaInfoHolder -{ - boolean isImmutable(); - - /** - * Get the qualified name of the property which is equal to: - * <pre><code> - * <interface name>:<method name> - * </code></pre> - * - * @return the qualified name of the property - */ - QualifiedName qualifiedName(); - - /** - * Get the type of the property. If the property is declared - * as Property<X> then X is returned. - * - * @return the property type - */ - Type type(); - - AccessibleObject accessor(); - - Object initialValue( ModuleDescriptor module ); - - ValueType valueType(); - - boolean queryable(); -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/property/PropertyMixin.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/property/PropertyMixin.java b/core/api/src/main/java/org/apache/zest/api/property/PropertyMixin.java deleted file mode 100644 index ea3fd3c..0000000 --- a/core/api/src/main/java/org/apache/zest/api/property/PropertyMixin.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package org.apache.zest.api.property; - -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; -import org.apache.zest.api.common.AppliesTo; -import org.apache.zest.api.common.AppliesToFilter; -import org.apache.zest.api.injection.scope.State; - -/** - * Generic mixin for properties. - */ -// START SNIPPET: actual -@AppliesTo( { PropertyMixin.PropertyFilter.class } ) -public final class PropertyMixin - implements InvocationHandler -{ - @State - private StateHolder state; - - @Override - public Object invoke( Object proxy, Method method, Object[] args ) - throws Throwable - { - return state.propertyFor( method ); - } - - /** - * Filter Property methods to apply generic Property Mixin. - */ - public static class PropertyFilter - implements AppliesToFilter - { - @Override - public boolean appliesTo( Method method, Class<?> mixin, Class<?> compositeType, Class<?> modifierClass ) - { - return Property.class.isAssignableFrom( method.getReturnType() ); - } - } -} -// END SNIPPET: actual http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/property/PropertyWrapper.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/property/PropertyWrapper.java b/core/api/src/main/java/org/apache/zest/api/property/PropertyWrapper.java deleted file mode 100644 index 1638529..0000000 --- a/core/api/src/main/java/org/apache/zest/api/property/PropertyWrapper.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ -package org.apache.zest.api.property; - -/** - * If you want to catch getting and setting properties, then create a GenericConcern - * that wraps the Polygene-supplied Property instance with PropertyWrappers. Override - * get() and/or set() to perform your custom code. - */ -public class PropertyWrapper - implements Property<Object> -{ - protected Property<Object> next; - - public PropertyWrapper( Property<Object> next ) - { - this.next = next; - } - - public Property<Object> next() - { - return next; - } - - @Override - public Object get() - { - return next.get(); - } - - @Override - public void set( Object newValue ) - throws IllegalArgumentException, IllegalStateException - { - next.set( newValue ); - } - - @Override - public int hashCode() - { - return next.hashCode(); - } - - @Override - public boolean equals( Object obj ) - { - return next.equals( obj ); - } - - @Override - public String toString() - { - return next.toString(); - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/property/StateHolder.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/property/StateHolder.java b/core/api/src/main/java/org/apache/zest/api/property/StateHolder.java deleted file mode 100644 index 8ae0089..0000000 --- a/core/api/src/main/java/org/apache/zest/api/property/StateHolder.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package org.apache.zest.api.property; - -import java.lang.reflect.AccessibleObject; -import java.util.stream.Stream; - -/** - * This represents the state of a composite (properties). - */ -public interface StateHolder -{ - /** - * Get a property for a specific accessor - * - * @param accessor of the property - * - * @return the property - * - * @throws IllegalArgumentException if no property for given accessor exists - */ - <T> Property<T> propertyFor( AccessibleObject accessor ) - throws IllegalArgumentException; - - Stream<? extends Property<?>> properties(); -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/property/package.html ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/property/package.html b/core/api/src/main/java/org/apache/zest/api/property/package.html deleted file mode 100644 index 95d7f77..0000000 --- a/core/api/src/main/java/org/apache/zest/api/property/package.html +++ /dev/null @@ -1,24 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - ~ - ~ - --> -<html> - <body> - <h2>Property API.</h2> - </body> -</html> http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/MissingIndexingSystemException.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/query/MissingIndexingSystemException.java b/core/api/src/main/java/org/apache/zest/api/query/MissingIndexingSystemException.java deleted file mode 100644 index ff37a08..0000000 --- a/core/api/src/main/java/org/apache/zest/api/query/MissingIndexingSystemException.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ -package org.apache.zest.api.query; - -/** - * This Exception is thrown in <code>QueryBuilderFactory.newQueryBuilder()</code> method if - * no indexing subsystem has been declared in the assembly. - */ -public final class MissingIndexingSystemException - extends QueryException -{ - private static final long serialVersionUID = 5147421865890379209L; - - public MissingIndexingSystemException() - { - super( "No EntityFinder has been declared in the assembly of the application." ); - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/NotQueryableException.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/query/NotQueryableException.java b/core/api/src/main/java/org/apache/zest/api/query/NotQueryableException.java deleted file mode 100644 index a2805da..0000000 --- a/core/api/src/main/java/org/apache/zest/api/query/NotQueryableException.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ -package org.apache.zest.api.query; - -import java.lang.reflect.AccessibleObject; -import java.lang.reflect.Member; -import org.apache.zest.api.entity.Queryable; -import org.apache.zest.api.property.GenericPropertyInfo; -import org.apache.zest.api.util.Classes; - -/** - * Thrown in case that a non queryable type or accessor (marked with @Queriable(false)) is used during query building, - * or when non-Property, non-Associations are trying to be queried (possibly can not happen). - */ -public class NotQueryableException - extends QueryException -{ - private static final long serialVersionUID = 1L; - - /** - * Constructor. - * - * @param message exception message - */ - public NotQueryableException( final String message ) - { - super( message ); - } - - /** - * Verify that the provided accessor method has not been marked with a Queryable(false). - * - * @param accessor accessor method - * - * @throws NotQueryableException - If accessor method has been marked as not queryable - */ - public static void throwIfNotQueryable( final AccessibleObject accessor ) - { - Queryable queryable = accessor.getAnnotation( Queryable.class ); - if( queryable != null && !queryable.value() ) - { - throw new NotQueryableException( - String.format( - "%1$s \"%2$s\" (%3$s) is not queryable as has been marked with @Queryable(false)", - Classes.RAW_CLASS.apply( GenericPropertyInfo.propertyTypeOf( accessor ) ).getSimpleName(), - ( (Member) accessor ).getName(), - ( (Member) accessor ).getDeclaringClass().getName() - ) - ); - } - } - - /** - * Verify that the provided type has not been marked with a Queryable(false). - * - * @param type a type - * - * @throws NotQueryableException - If type has been marked as not queryable - */ - public static void throwIfNotQueryable( final Class<?> type ) - { - Queryable queryable = type.getAnnotation( Queryable.class ); - if( queryable != null && !queryable.value() ) - { - throw new NotQueryableException( - String.format( - "Type \"%1$s\" is not queryable as has been marked with @Queryable(false)", - type.getName() - ) - ); - } - } -} \ No newline at end of file
