Repository: polygene-java Updated Branches: refs/heads/develop 21c6a0b20 -> 8f534efe2
Rename ValueType.mainType() to ValueType.primaryType() for consistency Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/8187f2ff Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/8187f2ff Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/8187f2ff Branch: refs/heads/develop Commit: 8187f2ff165f6a10b8078be52a045b75caeef64d Parents: 21c6a0b Author: Paul Merlin <[email protected]> Authored: Sun Jan 15 18:58:10 2017 +0100 Committer: Paul Merlin <[email protected]> Committed: Sun Jan 15 18:58:10 2017 +0100 ---------------------------------------------------------------------- .../org/apache/polygene/api/type/ValueType.java | 4 +- .../runtime/structure/VisibilityPredicate.java | 48 ++++++++++++++++++++ .../runtime/structure/Visibilitypredicate.java | 48 -------------------- .../prefs/PreferencesEntityStoreMixin.java | 28 ++++++------ .../skeletons/SQLCompatEntityStateWrapper.java | 20 ++++---- .../appbrowser/json/ValueModelFormatter.java | 2 +- .../jmx/ConfigurationManagerService.java | 4 +- .../rdf/entity/EntityTypeSerializer.java | 2 +- .../library/restlet/crud/EntityResource.java | 2 +- .../DataSourceConfigurationManagerService.java | 2 +- 10 files changed, 80 insertions(+), 80 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/polygene-java/blob/8187f2ff/core/api/src/main/java/org/apache/polygene/api/type/ValueType.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/polygene/api/type/ValueType.java b/core/api/src/main/java/org/apache/polygene/api/type/ValueType.java index 768750e..fc39a0f 100644 --- a/core/api/src/main/java/org/apache/polygene/api/type/ValueType.java +++ b/core/api/src/main/java/org/apache/polygene/api/type/ValueType.java @@ -99,7 +99,7 @@ public class ValueType public static boolean isPrimitiveValueType( ValueType valueType ) { - return isPrimitiveValueType( valueType.mainType() ); + return isPrimitiveValueType( valueType.primaryType() ); } /** @@ -133,7 +133,7 @@ public class ValueType this.types = types; } - public Class<?> mainType() + public Class<?> primaryType() { return types.stream().findFirst().orElse( null ); } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/8187f2ff/core/runtime/src/main/java/org/apache/polygene/runtime/structure/VisibilityPredicate.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/structure/VisibilityPredicate.java b/core/runtime/src/main/java/org/apache/polygene/runtime/structure/VisibilityPredicate.java new file mode 100644 index 0000000..df013c3 --- /dev/null +++ b/core/runtime/src/main/java/org/apache/polygene/runtime/structure/VisibilityPredicate.java @@ -0,0 +1,48 @@ +/* + * 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.polygene.runtime.structure; + +import java.util.function.Predicate; +import org.apache.polygene.api.common.Visibility; +import org.apache.polygene.api.composite.ModelDescriptor; + +/** + * TODO + */ +public class Visibilitypredicate + implements Predicate<ModelDescriptor> +{ + public static final Predicate<ModelDescriptor> MODULE = new Visibilitypredicate( Visibility.module ); + public static final Predicate<ModelDescriptor> LAYER = new Visibilitypredicate( Visibility.layer ); + public static final Predicate<ModelDescriptor> APPLICATION = new Visibilitypredicate( Visibility.application ); + + private final Visibility visibility; + + public Visibilitypredicate( Visibility visibility ) + { + this.visibility = visibility; + } + + @Override + public boolean test( ModelDescriptor item ) + { + return item.visibility().ordinal() >= visibility.ordinal(); + } +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/8187f2ff/core/runtime/src/main/java/org/apache/polygene/runtime/structure/Visibilitypredicate.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/structure/Visibilitypredicate.java b/core/runtime/src/main/java/org/apache/polygene/runtime/structure/Visibilitypredicate.java deleted file mode 100644 index df013c3..0000000 --- a/core/runtime/src/main/java/org/apache/polygene/runtime/structure/Visibilitypredicate.java +++ /dev/null @@ -1,48 +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.polygene.runtime.structure; - -import java.util.function.Predicate; -import org.apache.polygene.api.common.Visibility; -import org.apache.polygene.api.composite.ModelDescriptor; - -/** - * TODO - */ -public class Visibilitypredicate - implements Predicate<ModelDescriptor> -{ - public static final Predicate<ModelDescriptor> MODULE = new Visibilitypredicate( Visibility.module ); - public static final Predicate<ModelDescriptor> LAYER = new Visibilitypredicate( Visibility.layer ); - public static final Predicate<ModelDescriptor> APPLICATION = new Visibilitypredicate( Visibility.application ); - - private final Visibility visibility; - - public Visibilitypredicate( Visibility visibility ) - { - this.visibility = visibility; - } - - @Override - public boolean test( ModelDescriptor item ) - { - return item.visibility().ordinal() >= visibility.ordinal(); - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/8187f2ff/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/PreferencesEntityStoreMixin.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/PreferencesEntityStoreMixin.java b/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/PreferencesEntityStoreMixin.java index 97d92c3..72f4298 100644 --- a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/PreferencesEntityStoreMixin.java +++ b/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/PreferencesEntityStoreMixin.java @@ -237,25 +237,25 @@ public class PreferencesEntityStoreMixin else { ValueType propertyType = persistentPropertyDescriptor.valueType(); - Class<?> mainType = propertyType.mainType(); - if( Number.class.isAssignableFrom( mainType ) ) + Class<?> primaryType = propertyType.primaryType(); + if( Number.class.isAssignableFrom( primaryType ) ) { - if( mainType.equals( Long.class ) ) + if( primaryType.equals( Long.class ) ) { properties.put( persistentPropertyDescriptor.qualifiedName(), this.getNumber( propsPrefs, persistentPropertyDescriptor, LONG_PARSER ) ); } - else if( mainType.equals( Integer.class ) ) + else if( primaryType.equals( Integer.class ) ) { properties.put( persistentPropertyDescriptor.qualifiedName(), this.getNumber( propsPrefs, persistentPropertyDescriptor, INT_PARSER ) ); } - else if( mainType.equals( Double.class ) ) + else if( primaryType.equals( Double.class ) ) { properties.put( persistentPropertyDescriptor.qualifiedName(), this.getNumber( propsPrefs, persistentPropertyDescriptor, DOUBLE_PARSER ) ); } - else if( mainType.equals( Float.class ) ) + else if( primaryType.equals( Float.class ) ) { properties.put( persistentPropertyDescriptor.qualifiedName(), this.getNumber( propsPrefs, persistentPropertyDescriptor, FLOAT_PARSER ) ); @@ -277,7 +277,7 @@ public class PreferencesEntityStoreMixin properties.put( persistentPropertyDescriptor.qualifiedName(), value ); } } - else if( mainType.equals( Boolean.class ) ) + else if( primaryType.equals( Boolean.class ) ) { Boolean initialValue = (Boolean) persistentPropertyDescriptor.initialValue( module ); properties.put( persistentPropertyDescriptor.qualifiedName(), @@ -503,24 +503,24 @@ public class PreferencesEntityStoreMixin else { ValueType valueType = persistentProperty.valueType(); - Class<?> mainType = valueType.mainType(); - if( Number.class.isAssignableFrom( mainType ) ) + Class<?> primaryType = valueType.primaryType(); + if( Number.class.isAssignableFrom( primaryType ) ) { - if( mainType.equals( Long.class ) ) + if( primaryType.equals( Long.class ) ) { propsPrefs.putLong( persistentProperty.qualifiedName().name(), (Long) value ); } - else if( mainType.equals( Integer.class ) ) + else if( primaryType.equals( Integer.class ) ) { propsPrefs.putInt( persistentProperty.qualifiedName() .name(), (Integer) value ); } - else if( mainType.equals( Double.class ) ) + else if( primaryType.equals( Double.class ) ) { propsPrefs.putDouble( persistentProperty.qualifiedName() .name(), (Double) value ); } - else if( mainType.equals( Float.class ) ) + else if( primaryType.equals( Float.class ) ) { propsPrefs.putFloat( persistentProperty.qualifiedName() .name(), (Float) value ); @@ -532,7 +532,7 @@ public class PreferencesEntityStoreMixin propsPrefs.put( persistentProperty.qualifiedName().name(), jsonString ); } } - else if( mainType.equals( Boolean.class ) ) + else if( primaryType.equals( Boolean.class ) ) { propsPrefs.putBoolean( persistentProperty.qualifiedName() .name(), (Boolean) value ); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/8187f2ff/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/support/skeletons/SQLCompatEntityStateWrapper.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/support/skeletons/SQLCompatEntityStateWrapper.java b/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/support/skeletons/SQLCompatEntityStateWrapper.java index dd29448..b3c7621 100644 --- a/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/support/skeletons/SQLCompatEntityStateWrapper.java +++ b/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/support/skeletons/SQLCompatEntityStateWrapper.java @@ -75,16 +75,16 @@ class SQLCompatEntityStateWrapper CollectionType collectionType = (CollectionType) valueType; return isSupported( collectionType.collectedType() ); } - Class<?> mainType = valueType.mainType(); - return Number.class.isAssignableFrom( mainType ) - || Boolean.class.isAssignableFrom( mainType ) - || Character.class.isAssignableFrom( mainType ) - || Enum.class.isAssignableFrom( mainType ) - || String.class.isAssignableFrom( mainType ) - // || Date.class.isAssignableFrom( mainType ) - // || DateTime.class.isAssignableFrom( mainType ) - // || LocalDateTime.class.isAssignableFrom( mainType ) - // || LocalDate.class.isAssignableFrom( mainType ) + Class<?> primaryType = valueType.primaryType(); + return Number.class.isAssignableFrom( primaryType ) + || Boolean.class.isAssignableFrom( primaryType ) + || Character.class.isAssignableFrom( primaryType ) + || Enum.class.isAssignableFrom( primaryType ) + || String.class.isAssignableFrom( primaryType ) + // || Date.class.isAssignableFrom( primaryType ) + // || DateTime.class.isAssignableFrom( primaryType ) + // || LocalDateTime.class.isAssignableFrom( primaryType ) + // || LocalDate.class.isAssignableFrom( primaryType ) || valueType instanceof ValueCompositeType; } }; http://git-wip-us.apache.org/repos/asf/polygene-java/blob/8187f2ff/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ValueModelFormatter.java ---------------------------------------------------------------------- diff --git a/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ValueModelFormatter.java b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ValueModelFormatter.java index 4d19f4f..48aa399 100644 --- a/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ValueModelFormatter.java +++ b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ValueModelFormatter.java @@ -35,7 +35,7 @@ public class ValueModelFormatter extends AbstractJsonFormatter<ValueDescriptor,V throws JSONException { object(); - field( "type", visited.valueType().mainType().getName() ); + field( "type", visited.valueType().primaryType().getName() ); field( "visibility", visited.visibility().toString() ); } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/8187f2ff/libraries/jmx/src/main/java/org/apache/polygene/library/jmx/ConfigurationManagerService.java ---------------------------------------------------------------------- diff --git a/libraries/jmx/src/main/java/org/apache/polygene/library/jmx/ConfigurationManagerService.java b/libraries/jmx/src/main/java/org/apache/polygene/library/jmx/ConfigurationManagerService.java index 8a27e24..58d39f5 100644 --- a/libraries/jmx/src/main/java/org/apache/polygene/library/jmx/ConfigurationManagerService.java +++ b/libraries/jmx/src/main/java/org/apache/polygene/library/jmx/ConfigurationManagerService.java @@ -168,7 +168,7 @@ public interface ConfigurationManagerService if( !persistentProperty.isImmutable() ) { String propertyName = persistentProperty.qualifiedName().name(); - String type = persistentProperty.valueType().mainType().getName(); + String type = persistentProperty.valueType().primaryType().getName(); Descriptor attrDescriptor = new DescriptorSupport(); attrDescriptor.setField( "name", propertyName ); @@ -183,7 +183,7 @@ public interface ConfigurationManagerService { Set<String> legalValues = new LinkedHashSet<>(); Class<?> enumType = getClass().getClassLoader() - .loadClass( persistentProperty.valueType().mainType().getName() ); + .loadClass( persistentProperty.valueType().primaryType().getName() ); for( Field field : enumType.getFields() ) { legalValues.add( field.getName() ); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/8187f2ff/libraries/rdf/src/main/java/org/apache/polygene/library/rdf/entity/EntityTypeSerializer.java ---------------------------------------------------------------------- diff --git a/libraries/rdf/src/main/java/org/apache/polygene/library/rdf/entity/EntityTypeSerializer.java b/libraries/rdf/src/main/java/org/apache/polygene/library/rdf/entity/EntityTypeSerializer.java index 46e7b15..e16c4e0 100644 --- a/libraries/rdf/src/main/java/org/apache/polygene/library/rdf/entity/EntityTypeSerializer.java +++ b/libraries/rdf/src/main/java/org/apache/polygene/library/rdf/entity/EntityTypeSerializer.java @@ -159,7 +159,7 @@ public class EntityTypeSerializer graph.add( propertyURI, Rdfs.TYPE, Rdfs.PROPERTY ); // TODO Support more types - URI type = dataTypes.get( persistentProperty.valueType().mainType().getName() ); + URI type = dataTypes.get( persistentProperty.valueType().primaryType().getName() ); if( type != null ) { graph.add( propertyURI, Rdfs.RANGE, type ); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/8187f2ff/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/crud/EntityResource.java ---------------------------------------------------------------------- diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/crud/EntityResource.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/crud/EntityResource.java index 45e2ca9..d7ab52c 100644 --- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/crud/EntityResource.java +++ b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/crud/EntityResource.java @@ -150,7 +150,7 @@ public interface EntityResource<T extends HasIdentity> extends ServerResource<T> { return null; } - Class<?> propertyType = descriptor.valueType().mainType(); + Class<?> propertyType = descriptor.valueType().primaryType(); Property<String> value = field.value(); if( value == null ) { http://git-wip-us.apache.org/repos/asf/polygene-java/blob/8187f2ff/libraries/sql/src/main/java/org/apache/polygene/library/sql/jmx/DataSourceConfigurationManagerService.java ---------------------------------------------------------------------- diff --git a/libraries/sql/src/main/java/org/apache/polygene/library/sql/jmx/DataSourceConfigurationManagerService.java b/libraries/sql/src/main/java/org/apache/polygene/library/sql/jmx/DataSourceConfigurationManagerService.java index 4c3b483..0b56f0f 100644 --- a/libraries/sql/src/main/java/org/apache/polygene/library/sql/jmx/DataSourceConfigurationManagerService.java +++ b/libraries/sql/src/main/java/org/apache/polygene/library/sql/jmx/DataSourceConfigurationManagerService.java @@ -137,7 +137,7 @@ public interface DataSourceConfigurationManagerService descriptor.state().properties().forEach(persistentProperty -> { if ( !persistentProperty.isImmutable() ) { String propertyName = persistentProperty.qualifiedName().name(); - String type = persistentProperty.valueType().mainType().getName(); + String type = persistentProperty.valueType().primaryType().getName(); attributes.add( new MBeanAttributeInfo( propertyName, type, propertyName, true, true, type.equals( "java.lang.Boolean" ) ) ); properties.put( propertyName, persistentProperty.accessor() ); }
