@Override public final String toString() { return descriptor.name(); }
public NoSuchConfigurationTypeException( Class<?> configType, ModuleDescriptor module ) { super( "No configuration type " + configType.getName() + " has been registered, or is not visible from " + module.name() ); this.configType = configType; } }
public NoSuchConfigurationTypeException( Class<?> configType, ModuleDescriptor module ) { super( "No configuration type " + configType.getName() + " has been registered, or is not visible from " + module.name() ); this.configType = configType; } }
protected static String compositeDescriptorToString( LayerDescriptor layer, ModuleDescriptor module, CompositeDescriptor descriptor ) { return DESCRIPTOR_COMPONENT_SEPARATOR_START + layer.name() + DESCRIPTOR_COMPONENT_SEPARATOR_END + DESCRIPTOR_COMPONENT_SEPARATOR_START + module.name() + DESCRIPTOR_COMPONENT_SEPARATOR_END + DESCRIPTOR_COMPONENT_SEPARATOR_START + descriptor.types().map( Object::toString ).collect( Collectors.joining( DESCRIPTOR_TYPE_SEPARATOR ) ) + DESCRIPTOR_COMPONENT_SEPARATOR_END; }
protected NoSuchCompositeTypeException( String metaType, String compositeType, ModuleDescriptor module ) { super( NL + "\tCould not find any visible " + metaType + " of type [" + compositeType + "] in module [" + module.name() + "]." ); this.metaType = metaType; this.compositeType = compositeType; this.moduleName = module.name(); visibleTypes = formatVisibleTypes( module.typeLookup() ); candidateTypes = findCandidateTypes( module ); }
private String formatVisibleTypes( TypeLookup typeLookup ) { return descriptors( typeLookup ) .map( descriptor -> { String moduleName = descriptor.module().name(); String typeName = descriptor.primaryType().getName(); return "\t\t[" + typeName + "] in [" + moduleName + "]"; } ) .sorted() .distinct() .collect( joining( NL, "\tVisible " + metaType + " types are:" + NL, "" ) ); }
protected NoSuchCompositeTypeException( String metaType, String compositeType, ModuleDescriptor module ) { super( NL + "\tCould not find any visible " + metaType + " of type [" + compositeType + "] in module [" + module.name() + "]." ); this.metaType = metaType; this.compositeType = compositeType; this.moduleName = module.name(); visibleTypes = formatVisibleTypes( module.typeLookup() ); candidateTypes = findCandidateTypes( module ); }
private String formatVisibleTypes( TypeLookup typeLookup ) { return descriptors( typeLookup ) .map( descriptor -> { String moduleName = descriptor.module().name(); String typeName = descriptor.primaryType().getName(); return "\t\t[" + typeName + "] in [" + moduleName + "]"; } ) .sorted() .distinct() .collect( joining( NL, "\tVisible " + metaType + " types are:" + NL, "" ) ); }
@Override public boolean visitEnter( Object visited ) { boolean thisResult = true; if( visited instanceof LayerDescriptor ) { thisResult = ( (LayerDescriptor) visited ).name().equals( layerName ); } else if( visited instanceof ModuleDescriptor ) { thisResult = ( (ModuleDescriptor) visited ).name().equals( moduleName ); } else if( descriptorClass.isAssignableFrom( visited.getClass() ) ) { CompositeDescriptor desc = (CompositeDescriptor) visited; Set<String> names = desc.types().map( Class::getName ).collect( Collectors.toSet() ); if( classNames.equals( names ) ) { result[ 0 ] = desc; thisResult = false; } } return thisResult; }
@Override public String toString() { return serviceModel.identity() + "(active=" + isActive() + ",module='" + module.name() + "')"; }
private void decorateModuleInfo( Throwable throwable, String methodName ) { StackTraceElement[] trace = throwable.getStackTrace(); // Only add originating Module/Layer/ if( trace[0].getClassName().startsWith( "method " )) { return; } StackTraceElement[] newTrace = new StackTraceElement[ trace.length + 1 ]; String message = "method \"" + methodName + "\" of " + this.toString() + " in module [" + module.name() + "] of layer [" + module.layer().name() + "]"; String compositeName = this.toString(); newTrace[ 0 ] = new StackTraceElement( message, "", "", 0 ); System.arraycopy( trace, 0, newTrace, 1, trace.length ); throwable.setStackTrace( newTrace ); }
@Override public String getMessage() { String typeNames = typesString(); String primary = primaryType == null ? "" : " primary: " + primaryType.toGenericString() + NL; String methodName = memberString(); String message = super.getMessage() == null ? "" : " message: " + super.getMessage() + NL; String fragment = fragmentClass == null ? "" : " fragmentClass: " + fragmentClass.getName() + NL; String valueType = this.valueType == null ? "" : " valueType: " + this.valueType.getTypeName() + NL; String module = this.module == null ? "" : " layer: " + this.module.layer().name() + NL + " module: " + this.module.name() + NL; return message + module + primary + fragment + methodName + valueType + typeNames; }
private String findCandidateTypes( ModuleDescriptor module ) { return Stream.concat( Stream.of( module.layer() ), module.layer().usedLayers().layers() ) .flatMap( LayerDescriptor::modules ) .map( ModuleDescriptor::typeLookup ) .flatMap( this::descriptors ) .filter( type -> compositeType.equals( type.primaryType().getName() ) ) .map( descriptor -> { Class<?> primarytype = descriptor.primaryType(); String typeName = primarytype.getName(); return "\t\t[ " + typeName + "] in [" + descriptor.module().name() + "] with visibility " + descriptor.visibility(); } ) .distinct() .collect( joining( NL, "\tInvisible " + metaType + " types are:" + NL, "" ) ); }
private String findCandidateTypes( ModuleDescriptor module ) { return Stream.concat( Stream.of( module.layer() ), module.layer().usedLayers().layers() ) .flatMap( LayerDescriptor::modules ) .map( ModuleDescriptor::typeLookup ) .flatMap( this::descriptors ) .filter( type -> compositeType.equals( type.primaryType().getName() ) ) .map( descriptor -> { Class<?> primarytype = descriptor.primaryType(); String typeName = primarytype.getName(); return "\t\t[ " + typeName + "] in [" + descriptor.module().name() + "] with visibility " + descriptor.visibility(); } ) .distinct() .collect( joining( NL, "\tInvisible " + metaType + " types are:" + NL, "" ) ); }
@Override public String getMessage() { String typeNames = typesString(); String primary = primaryType == null ? "" : " primary: " + primaryType.toGenericString() + NL; String methodName = memberString(); String message = super.getMessage() == null ? "" : " message: " + super.getMessage() + NL; String fragment = fragmentClass == null ? "" : " fragmentClass: " + fragmentClass.getName() + NL; String valueType = this.valueType == null ? "" : " valueType: " + this.valueType.getTypeName() + NL; String module = this.module == null ? "" : " layer: " + this.module.layer().name() + NL + " module: " + this.module.name() + NL; return message + module + primary + fragment + methodName + valueType + typeNames; }
String message = "[Module " + context.module().name() + "] InjectionProvider unable to resolve @" + injectionAnnotation.annotationType().getSimpleName() + " " + injectionType.toString(); throw new ConstructionException( message, ex ); String message = "[Module " + context.module().name() + "] Non-optional @" + simpleName + " " + injectionType.toString() + " was null in " + injectedClass.getName();
+ " in [" + handler.module().name() + "] of [" + handler.layer().name() + "]";
tempModuleName = ( (ModuleDescriptor) visited ).name(); return true;
public JsonObject toJson() { JsonObjectBuilder builder = Json.createObjectBuilder(); builder.add( "name", descriptor.name() ); { JsonArrayBuilder servicesBuilder = Json.createArrayBuilder(); services().forEach( service -> servicesBuilder.add( service.toJson() ) ); builder.add( "services", servicesBuilder.build() ); } { JsonArrayBuilder activatorsBuilder = Json.createArrayBuilder(); activators().forEach( activator -> activatorsBuilder.add( activator.toJson() ) ); builder.add( "activators", activatorsBuilder.build() ); } return builder.build(); } }