congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
PropertyDescriptor.accessor
Code IndexAdd Tabnine to your IDE (free)

How to use
accessor
method
in
org.qi4j.api.property.PropertyDescriptor

Best Java code snippets using org.qi4j.api.property.PropertyDescriptor.accessor (Showing top 15 results out of 315)

origin: org.qi4j.library/org.qi4j.library.conversion

  @Override
  public Object map( PropertyDescriptor ePropDesc )
  {
    try
    {
      return vState.propertyFor( ePropDesc.accessor() ).get();
    }
    catch( IllegalArgumentException propNotFoundOnValue )
    {
      // Property not found
      return null;
    }
  }
};
origin: org.qi4j.library/org.qi4j.library.sql

@Override
public void exportDataSources()
    throws MalformedObjectNameException, MBeanRegistrationException, InstanceAlreadyExistsException, NotCompliantMBeanException
{
  for ( ServiceReference<DataSource> dataSource : dataSources ) {
    String name = dataSource.identity();
    Module module = ( Module ) spi.moduleOf( dataSource );
    EntityDescriptor descriptor = module.entityDescriptor( DataSourceConfiguration.class.getName() );
    List<MBeanAttributeInfo> attributes = new ArrayList<MBeanAttributeInfo>();
    Map<String, AccessibleObject> properties = new LinkedHashMap<String, AccessibleObject>();
    for ( PropertyDescriptor persistentProperty : descriptor.state().properties() ) {
      if ( !persistentProperty.isImmutable() ) {
        String propertyName = persistentProperty.qualifiedName().name();
        String type = persistentProperty.valueType().mainType().getName();
        attributes.add( new MBeanAttributeInfo( propertyName, type, propertyName, true, true, type.equals( "java.lang.Boolean" ) ) );
        properties.put( propertyName, persistentProperty.accessor() );
      }
    }
    List<MBeanOperationInfo> operations = new ArrayList<MBeanOperationInfo>();
    operations.add( new MBeanOperationInfo( "restart", "Restart DataSource", new MBeanParameterInfo[ 0 ], "void", MBeanOperationInfo.ACTION_INFO ) );
    MBeanInfo mbeanInfo = new MBeanInfo( DataSourceConfiguration.class.getName(), name, attributes.toArray( new MBeanAttributeInfo[ attributes.size() ] ), null, operations.toArray( new MBeanOperationInfo[ operations.size() ] ), null );
    Object mbean = new ConfigurableDataSource( dataSourceService, mbeanInfo, name, properties );
    ObjectName configurableDataSourceName = new ObjectName( "Zest:application=" + application.name() + ",class=Datasource,name=" + name );
    server.registerMBean( mbean, configurableDataSourceName );
    configurationNames.add( configurableDataSourceName );
  }
}
origin: org.qi4j.library/org.qi4j.library.conversion

  @Override
  public Object map( PropertyDescriptor ePropDesc )
  {
    String propName = ePropDesc.qualifiedName().name();
    try
    {
      PropertyDescriptor vPropDesc = vStateDesc.findPropertyModelByName( propName );
      return vState.propertyFor( vPropDesc.accessor() ).get();
    }
    catch( IllegalArgumentException propNotFoundOnValue )
    {
      // Property not found on Value
      return null;
    }
  }
};
origin: org.qi4j.library/org.qi4j.library.rest-server

@Override
public TemplateModel get( String key )
  throws TemplateModelException
{
  try
  {
    return wrapper.wrap( Qi4j.FUNCTION_COMPOSITE_INSTANCE_OF
                 .map( composite )
                 .state()
                 .propertyFor( descriptor.state().findPropertyModelByName( key ).accessor() )
                 .get() );
  }
  catch( IllegalArgumentException e )
  {
    return null;
  }
}
origin: org.qi4j.library/org.qi4j.library.conversion

  @Override
  public EntityReference map( AssociationDescriptor eAssocDesc )
  {
    try
    {
      return EntityReference.entityReferenceFor( vState.associationFor( eAssocDesc.accessor() ) );
    }
    catch( IllegalArgumentException assocNotFoundOnValue )
    {
      // Find String Property and convert to Association
      String propName = eAssocDesc.qualifiedName().name();
      try
      {
        PropertyDescriptor vPropDesc = vStateDesc.findPropertyModelByName( propName );
        if( STRING_TYPE_SPEC.satisfiedBy( vPropDesc.valueType() ) )
        {
          String assocState = (String) vState.propertyFor( vPropDesc.accessor() ).get();
          return EntityReference.parseEntityReference( assocState );
        }
        return null;
      }
      catch( IllegalArgumentException propNotFoundOnValue )
      {
        return null;
      }
    }
  }
};
origin: org.qi4j.library/org.qi4j.library.conversion

return associationState.propertyFor( descriptor.accessor() ).get();
origin: org.qi4j.library/org.qi4j.library.conversion

  @Override
  public Map<String, EntityReference> map( AssociationDescriptor eAssocDesc )
  {
    try
    {
      NamedAssociation<?> vAssocState = vState.namedAssociationFor( eAssocDesc.accessor() );
      return NAMED_ASSOC_TO_ENTITY_REF_MAP.map( vAssocState );
    }
    catch( IllegalArgumentException assocNotFoundOnValue )
    {
      // Find Map<String,String> Property and convert to NamedAssociation
      String propName = eAssocDesc.qualifiedName().name();
      try
      {
        PropertyDescriptor vPropDesc = vStateDesc.findPropertyModelByName( propName );
        if( STRING_MAP_TYPE_SPEC.satisfiedBy( vPropDesc.valueType() ) )
        {
          Map<String, String> vAssocState = (Map) vState
            .propertyFor( vPropDesc.accessor() ).get();
          return STRING_MAP_TO_ENTITY_REF_MAP.map( vAssocState );
        }
        return Collections.EMPTY_MAP;
      }
      catch( IllegalArgumentException propNotFoundOnValue )
      {
        return Collections.EMPTY_MAP;
      }
    }
  }
};
origin: org.qi4j.library/org.qi4j.library.conversion

  @Override
  public Iterable<EntityReference> map( AssociationDescriptor eAssocDesc )
  {
    try
    {
      ManyAssociation<Object> vAssocState = vState.manyAssociationFor( eAssocDesc.accessor() );
      return MANY_ASSOC_TO_ENTITY_REF_ITERABLE.map( vAssocState );
    }
    catch( IllegalArgumentException assocNotFoundOnValue )
    {
      // Find Collection<String> Property and convert to ManyAssociation
      String propName = eAssocDesc.qualifiedName().name();
      try
      {
        PropertyDescriptor vPropDesc = vStateDesc.findPropertyModelByName( propName );
        if( STRING_COLLECTION_TYPE_SPEC.satisfiedBy( vPropDesc.valueType() ) )
        {
          Collection<String> vAssocState = (Collection) vState
            .propertyFor( vPropDesc.accessor() ).get();
          return STRING_COLLEC_TO_ENTITY_REF_ITERABLE.map( vAssocState );
        }
        return Iterables.empty();
      }
      catch( IllegalArgumentException propNotFoundOnValue )
      {
        return Iterables.empty();
      }
    }
  }
};
origin: org.qi4j.library/org.qi4j.library.conversion

  .propertyFor( vPropDesc.accessor() ).get();
return STRING_MAP_TO_ENTITY_REF_MAP.map( vAssocState );
origin: org.qi4j.library/org.qi4j.library.conversion

  @Override
  public EntityReference map( AssociationDescriptor eAssocDesc )
  {
    String assocName = eAssocDesc.qualifiedName().name();
    try
    {
      AssociationDescriptor vAssocDesc = vStateDesc.getAssociationByName( assocName );
      Object assocEntity = vState.associationFor( vAssocDesc.accessor() ).get();
      return assocEntity == null ? null : EntityReference.entityReferenceFor( assocEntity );
    }
    catch( IllegalArgumentException assocNotFoundOnValue )
    {
      // Association not found on Value, find Property<String> and convert to Association
      try
      {
        PropertyDescriptor vPropDesc = vStateDesc.findPropertyModelByName( assocName );
        if( STRING_TYPE_SPEC.satisfiedBy( vPropDesc.valueType() ) )
        {
          String assocId = (String) vState.propertyFor( vPropDesc.accessor() ).get();
          return assocId == null ? null : EntityReference.parseEntityReference( assocId );
        }
        return null;
      }
      catch( IllegalArgumentException propNotFoundOnValue )
      {
        return null;
      }
    }
  }
};
origin: org.qi4j.library/org.qi4j.library.conversion

  .propertyFor( vPropDesc.accessor() ).get();
return STRING_COLLEC_TO_ENTITY_REF_ITERABLE.map( vAssocState );
origin: org.qi4j.library/org.qi4j.library.conversion

return associationState.propertyFor( propertyDescriptor.accessor() ).get();
origin: org.qi4j.library/org.qi4j.library.conversion

eState.propertyFor( ePropDesc.accessor() ).set( vState.propertyFor( vPropDesc.accessor() ).get() );
  if( STRING_TYPE_SPEC.satisfiedBy( vPropDesc.valueType() ) )
    String assocId = (String) vState.propertyFor( vPropDesc.accessor() ).get();
    if( assocId != null )
  if( STRING_COLLECTION_TYPE_SPEC.satisfiedBy( vPropDesc.valueType() ) )
    Collection<String> vAssocState = (Collection) vState.propertyFor( vPropDesc.accessor() ).get();
    for( Object assoc : eManyAssoc.toList() )
  if( STRING_MAP_TYPE_SPEC.satisfiedBy( vPropDesc.valueType() ) )
    Map<String, String> vAssocState = (Map) vState.propertyFor( vPropDesc.accessor() ).get();
    for( String assocName : Iterables.toList( eNamedAssoc ) )
origin: org.qi4j.library/org.qi4j.library.rdf

.map( (Composite) value )
.state()
.propertyFor( persistentProperty.accessor() )
.get();
origin: org.qi4j.library/org.qi4j.library.conversion

eState.propertyFor( ePropDesc.accessor() ).set( vState.propertyFor( vPropDesc.accessor() ).get() );
  if( STRING_TYPE_SPEC.satisfiedBy( vPropDesc.valueType() ) )
    String assocId = (String) vState.propertyFor( vPropDesc.accessor() ).get();
    if( assocId != null )
  if( STRING_COLLECTION_TYPE_SPEC.satisfiedBy( vPropDesc.valueType() ) )
    Collection<String> vAssocState = (Collection) vState.propertyFor( vPropDesc.accessor() ).get();
    for( Object ass : eManyAssoc.toList() )
  if( STRING_MAP_TYPE_SPEC.satisfiedBy( vPropDesc.valueType() ) )
    Map<String, String> vAssocState = (Map) vState.propertyFor( vPropDesc.accessor() ).get();
    for( String assocName : Iterables.toList( eNamedAssoc ) )
org.qi4j.api.propertyPropertyDescriptoraccessor

Popular methods of PropertyDescriptor

  • qualifiedName
    Get the qualified name of the property which is equal to: :
  • valueType
  • initialValue
  • isImmutable
  • queryable

Popular in Java

  • Creating JSON documents from java classes using gson
  • addToBackStack (FragmentTransaction)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • Path (java.nio.file)
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Top 17 Plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now