You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cz...@apache.org on 2017/11/08 08:18:12 UTC
svn commit: r1814560 -
/felix/trunk/osgi-r7/scr/src/main/java/org/apache/felix/scr/impl/metadata/ReferenceMetadata.java
Author: cziegeler
Date: Wed Nov 8 08:18:12 2017
New Revision: 1814560
URL: http://svn.apache.org/viewvc?rev=1814560&view=rev
Log:
FELIX-5455 : [R7] Constructor Injection
Modified:
felix/trunk/osgi-r7/scr/src/main/java/org/apache/felix/scr/impl/metadata/ReferenceMetadata.java
Modified: felix/trunk/osgi-r7/scr/src/main/java/org/apache/felix/scr/impl/metadata/ReferenceMetadata.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/scr/src/main/java/org/apache/felix/scr/impl/metadata/ReferenceMetadata.java?rev=1814560&r1=1814559&r2=1814560&view=diff
==============================================================================
--- felix/trunk/osgi-r7/scr/src/main/java/org/apache/felix/scr/impl/metadata/ReferenceMetadata.java (original)
+++ felix/trunk/osgi-r7/scr/src/main/java/org/apache/felix/scr/impl/metadata/ReferenceMetadata.java Wed Nov 8 08:18:12 2017
@@ -118,7 +118,7 @@ public class ReferenceMetadata
// Name of the value type for the field (optional, since DS 1.3)
// Since 1.4 also used for the parameter collection type (constructor)
- private String m_field_collection_type;
+ private String m_collection_type;
// Policy attribute (optional, default = static)
private String m_policy;
@@ -375,7 +375,7 @@ public class ReferenceMetadata
return;
}
- m_field_collection_type = valuetype;
+ m_collection_type = valuetype;
}
public void setScope(String scopeName) {
@@ -534,7 +534,7 @@ public class ReferenceMetadata
*/
public String getFieldCollectionType()
{
- return m_field_collection_type;
+ return m_collection_type;
}
/**
@@ -558,7 +558,7 @@ public class ReferenceMetadata
*/
public String getParameterCollectionType()
{
- return m_field_collection_type;
+ return m_collection_type;
}
// Getters for boolean values that determine both policy and cardinality
@@ -746,18 +746,19 @@ public class ReferenceMetadata
if ( !m_isMultiple )
{
// value type must not be specified for unary references
- if ( m_field_collection_type != null )
+ if ( m_collection_type != null )
{
- throw componentMetadata.validationFailure( "Field value type must not be set for unary field references." );
+ // spec says to ignore this
+ this.m_collection_type = null;
}
}
else
{
- if ( m_field_collection_type == null )
+ if ( m_collection_type == null )
{
setFieldCollectionType( FIELD_VALUE_TYPE_SERVICE );
}
- else if ( !FIELD_VALUE_TYPE_VALID.contains( m_field_collection_type ) )
+ else if ( !FIELD_VALUE_TYPE_VALID.contains( m_collection_type ) )
{
throw componentMetadata.validationFailure( "Field value type must be one of " + FIELD_VALUE_TYPE_VALID );
}
@@ -787,18 +788,19 @@ public class ReferenceMetadata
if ( !m_isMultiple )
{
// value type must not be specified for unary references
- if ( m_field_collection_type != null )
+ if ( m_collection_type != null )
{
- throw componentMetadata.validationFailure( "Collection value type must not be set for unary constructor references." );
+ // spec says to ignore this
+ this.m_collection_type = null;
}
}
else
{
- if ( m_field_collection_type == null )
+ if ( m_collection_type == null )
{
setFieldCollectionType( FIELD_VALUE_TYPE_SERVICE );
}
- else if ( !FIELD_VALUE_TYPE_VALID.contains( m_field_collection_type ) )
+ else if ( !FIELD_VALUE_TYPE_VALID.contains( m_collection_type ) )
{
throw componentMetadata.validationFailure( "Collection value type must be one of " + FIELD_VALUE_TYPE_VALID );
}
@@ -819,7 +821,7 @@ public class ReferenceMetadata
", updated=" + this.getUpdated() +
", field=" + this.getField() +
", field-option=" + this.getFieldOption() +
- ", field-collection-type=" + this.getFieldCollectionType() +
+ ", collection-type=" + this.getFieldCollectionType() +
", parameter=" + this.getParameterIndex();
}
}
\ No newline at end of file